2019-05-29 16:57:49 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-23 21:47:00 +03:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-08 10:11:12 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2015-05-28 11:35:41 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-02-24 19:53:34 +01:00
|
|
|
|
2015-09-04 01:39:56 +02:00
|
|
|
|
2016-02-26 14:59:57 -08:00
|
|
|
|
2016-11-18 15:31:45 -08:00
|
|
|
|
2017-03-18 15:04:13 -07:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2017-11-28 12:40:30 -06:00
|
|
|
|
scsi: target: tcmu: Fix possible data corruption
When tcmu_vma_fault() gets a page successfully, before the current context
completes page fault procedure, find_free_blocks() may run and call
unmap_mapping_range() to unmap the page. Assume that when
find_free_blocks() initially completes and the previous page fault
procedure starts to run again and completes, then one truncated page has
been mapped to userspace. But note that tcmu_vma_fault() has gotten a
refcount for the page so any other subsystem won't be able to use the page
unless the userspace address is unmapped later.
If another command subsequently runs and needs to extend dbi_thresh it may
reuse the corresponding slot for the previous page in data_bitmap. Then
though we'll allocate new page for this slot in data_area, no page fault
will happen because we have a valid map and the real request's data will be
lost.
Filesystem implementations will also run into this issue but they usually
lock the page when vm_operations_struct->fault gets a page and unlock the
page after finish_fault() completes. For truncate filesystems lock pages in
truncate_inode_pages() to protect against racing wrt. page faults.
To fix this possible data corruption scenario we can apply a method similar
to the filesystems. For pages that are to be freed, tcmu_blocks_release()
locks and unlocks. Make tcmu_vma_fault() also lock found page under
cmdr_lock. At the same time, since tcmu_vma_fault() gets an extra page
refcount, tcmu_blocks_release() won't free pages if pages are in page fault
procedure, which means it is safe to call tcmu_blocks_release() before
unmap_mapping_range().
With these changes tcmu_blocks_release() will wait for all page faults to
be completed before calling unmap_mapping_range(). And later, if
unmap_mapping_range() is called, it will ensure stale mappings are removed.
Link: https://lore.kernel.org/r/20220421023735.9018-1-xiaoguang.wang@linux.alibaba.com
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-04-21 10:37:35 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2015-05-08 10:11:12 +02:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-28 05:11:24 +00:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2018-04-14 10:51:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-14 10:51:05 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:53 +01:00
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
2021-03-24 20:57:53 +01:00
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
|
|
|
|
|
2016-02-26 14:59:57 -08:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
2018-06-22 16:40:22 -05:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2017-05-17 04:34:37 -05:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-02-27 11:00:04 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
2020-07-26 17:35:10 +02:00
|
|
|
|
2021-05-12 16:06:54 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:51 -05:00
|
|
|
|
2021-03-24 20:57:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2016-08-25 08:55:54 -07:00
|
|
|
|
2016-02-26 14:59:57 -08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
2021-03-24 20:57:53 +01:00
|
|
|
|
2016-02-26 14:59:57 -08:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
|
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2021-02-24 19:53:34 +01:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
2017-03-09 02:42:09 -06:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:31 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-09-13 14:01:22 +09:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-26 14:59:57 -08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2020-09-10 17:50:39 +02:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2020-09-10 17:50:41 +02:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-22 10:53:01 -07:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:31 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2018-06-22 16:40:22 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-11 14:10:56 +01:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-07 02:31:36 -04:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
2018-06-26 11:47:20 -05:00
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
2018-06-22 16:40:22 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-02 14:49:54 -07:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
2019-04-26 14:07:31 +02:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-26 14:07:31 +02:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-26 14:07:31 +02:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-26 14:07:31 +02:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2016-10-24 14:40:05 +02:00
|
|
|
|
2016-10-24 14:40:03 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
genetlink: make policy common to family
Since maxattr is common, the policy can't really differ sanely,
so make it common as well.
The only user that did in fact manage to make a non-common policy
is taskstats, which has to be really careful about it (since it's
still using a common maxattr!). This is no longer supported, but
we can fake it using pre_doit.
This reduces the size of e.g. nl80211.o (which has lots of commands):
text data bss dec hex filename
398745 14323 2240 415308 6564c net/wireless/nl80211.o (before)
397913 14331 2240 414484 65314 net/wireless/nl80211.o (after)
--------------------------------
-832 +8 0 -824
Which is obviously just 8 bytes for each command, and an added 8
bytes for the new policy pointer. I'm not sure why the ops list is
counted as .text though.
Most of the code transformations were done using the following spatch:
@ops@
identifier OPS;
expression POLICY;
@@
struct genl_ops OPS[] = {
...,
{
- .policy = POLICY,
},
...
};
@@
identifier ops.OPS;
expression ops.POLICY;
identifier fam;
expression M;
@@
struct genl_family fam = {
.ops = OPS,
.maxattr = M,
+ .policy = POLICY,
...
};
This also gets rid of devlink_nl_cmd_region_read_dumpit() accessing
the cb->data as ops, which we want to change in a later genl patch.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-21 22:51:02 +01:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2016-01-13 17:26:13 -08:00
|
|
|
|
2020-10-02 14:49:54 -07:00
|
|
|
|
|
|
|
|
|
2022-08-24 17:18:30 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2021-05-19 15:54:40 +02:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
|
|
|
|
|
2021-05-19 15:54:40 +02:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2021-10-13 19:16:06 +02:00
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:39 +02:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2020-09-10 17:50:39 +02:00
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2020-09-10 17:50:39 +02:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:39 +02:00
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2020-09-10 17:50:39 +02:00
|
|
|
|
2020-09-10 17:50:41 +02:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:41 +02:00
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
2020-09-10 17:50:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
|
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
2020-09-10 17:50:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2020-09-10 17:50:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
2020-09-10 17:50:41 +02:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-11-08 17:29:01 +09:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:39 +02:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2019-11-08 17:29:01 +09:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-25 21:49:27 +08:00
|
|
|
|
2017-11-28 12:40:27 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-18 15:16:32 +02:00
|
|
|
|
2017-11-28 12:40:27 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2021-05-19 15:54:40 +02:00
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2021-05-19 15:54:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:41 +02:00
|
|
|
|
|
|
|
|
|
2016-02-26 14:59:57 -08:00
|
|
|
|
2020-09-10 17:50:41 +02:00
|
|
|
|
2015-04-23 21:47:00 +03:00
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
|
|
|
|
|
2016-02-26 14:59:56 -08:00
|
|
|
|
|
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
2018-05-24 18:49:41 +02:00
|
|
|
|
2015-04-23 21:47:00 +03:00
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
|
|
|
|
|
2017-03-31 10:35:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:39 +02:00
|
|
|
|
2017-03-31 10:35:25 +08:00
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
|
|
|
|
|
2017-03-31 10:35:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-23 21:47:00 +03:00
|
|
|
|
2020-10-19 13:51:18 +02:00
|
|
|
|
|
|
|
|
|
2015-04-23 21:47:00 +03:00
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2016-02-26 14:59:57 -08:00
|
|
|
|
2017-11-28 12:40:35 -06:00
|
|
|
|
2016-02-26 14:59:57 -08:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2016-02-27 18:25:22 -08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-02 10:23:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:39 +02:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2020-09-10 17:50:39 +02:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:39 +02:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-05-02 15:54:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
2017-10-25 11:47:15 -05:00
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
2017-10-25 11:47:15 -05:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
2017-10-25 11:47:15 -05:00
|
|
|
|
|
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-26 17:35:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:53 +01:00
|
|
|
|
2020-07-26 17:35:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-27 11:00:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-12 16:06:54 +02:00
|
|
|
|
2021-02-27 11:00:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-12 16:06:54 +02:00
|
|
|
|
2021-02-27 11:00:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:37 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2017-11-28 12:40:37 -06:00
|
|
|
|
2018-11-27 15:51:55 -08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-26 17:35:07 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2021-02-24 19:53:34 +01:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2020-09-10 17:50:39 +02:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-11-28 12:40:37 -06:00
|
|
|
|
|
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:37 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2017-11-28 12:40:37 -06:00
|
|
|
|
|
|
|
|
|
2016-08-25 08:55:53 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:33 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
2016-02-26 14:59:57 -08:00
|
|
|
|
2021-02-24 19:53:34 +01:00
|
|
|
|
|
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
2017-11-28 12:40:37 -06:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
2017-11-28 12:40:37 -06:00
|
|
|
|
|
|
|
|
|
2017-10-25 11:47:15 -05:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:53 +01:00
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:41 +02:00
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
2017-10-25 11:47:15 -05:00
|
|
|
|
|
|
|
|
|
2017-05-02 15:54:29 +08:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-28 21:31:08 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
|
|
|
|
|
2021-05-12 16:06:54 +02:00
|
|
|
|
2021-02-27 11:00:04 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-11-28 12:40:37 -06:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-10 17:50:40 +02:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:53 +01:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-06 10:07:07 -05:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2020-07-26 17:35:06 +02:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-06 10:07:07 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2020-07-26 17:35:06 +02:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2021-01-13 11:45:08 +09:00
|
|
|
|
|
|
|
|
|
2020-07-26 17:35:05 +02:00
|
|
|
|
2017-11-28 12:40:37 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
scsi: target: tcmu: Fix and simplify timeout handling
During cmd timeout handling in check_timedout_devices(), due to a race, it
can happen that tcmu_set_next_deadline() does not start a timer as
expected:
1) Either tcmu_check_expired_ring_cmd() checks the inflight_queue or
tcmu_check_expired_queue_cmd() checks the qfull_queue while jiffies has
the value X
2) At the end of the check the queue contains one remaining command with
deadline X (time_after(X, X) is false and thus the command is not
handled as being timed out).
3) After tcmu_check_expired_xxxxx_cmd() a timer interrupt happens and
jiffies is incremented to X+1.
4) Now tcmu_set_next_deadline() is called, but it skips the command, since
time_after(X+1, X) is true. Therefore tcmu_set_next_deadline() finds no
new deadline and stops the timer, which it shouldn't.
Since commands that time out are removed from inflight_queue or
qfull_queue, we don't need the check with time_after() in
tcmu_set_next_deadline() but can use the deadline from the first cmd in
the queue.
Additionally, replace the remaining time_after() calls in
tcmu_check_expired_xxxxx_cmd() with time_after_eq(), because it is not
useful to set the timeout to deadline but then check for jiffies being
greater than deadline.
Simplify the end of tcmu_handle_completions() and change the check for no
more pending commands from
mb->cmd_tail == mb->cmd_head
to
idr_is_empty(&udev->commands)
because the old check doesn't work correctly if paddings or in the future
TMRs are in the ring.
Finally tcmu_set_next_deadline() was shifted in the source as
preparation for later implementation of tmr_notify callback.
Link: https://lore.kernel.org/r/20200726153510.13077-7-bstroesser@ts.fujitsu.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-07-26 17:35:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-05 10:17:26 +02:00
|
|
|
|
scsi: target: tcmu: Fix and simplify timeout handling
During cmd timeout handling in check_timedout_devices(), due to a race, it
can happen that tcmu_set_next_deadline() does not start a timer as
expected:
1) Either tcmu_check_expired_ring_cmd() checks the inflight_queue or
tcmu_check_expired_queue_cmd() checks the qfull_queue while jiffies has
the value X
2) At the end of the check the queue contains one remaining command with
deadline X (time_after(X, X) is false and thus the command is not
handled as being timed out).
3) After tcmu_check_expired_xxxxx_cmd() a timer interrupt happens and
jiffies is incremented to X+1.
4) Now tcmu_set_next_deadline() is called, but it skips the command, since
time_after(X+1, X) is true. Therefore tcmu_set_next_deadline() finds no
new deadline and stops the timer, which it shouldn't.
Since commands that time out are removed from inflight_queue or
qfull_queue, we don't need the check with time_after() in
tcmu_set_next_deadline() but can use the deadline from the first cmd in
the queue.
Additionally, replace the remaining time_after() calls in
tcmu_check_expired_xxxxx_cmd() with time_after_eq(), because it is not
useful to set the timeout to deadline but then check for jiffies being
greater than deadline.
Simplify the end of tcmu_handle_completions() and change the check for no
more pending commands from
mb->cmd_tail == mb->cmd_head
to
idr_is_empty(&udev->commands)
because the old check doesn't work correctly if paddings or in the future
TMRs are in the ring.
Finally tcmu_set_next_deadline() was shifted in the source as
preparation for later implementation of tmr_notify callback.
Link: https://lore.kernel.org/r/20200726153510.13077-7-bstroesser@ts.fujitsu.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-07-26 17:35:08 +02:00
|
|
|
|
|
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-13 11:45:08 +09:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-26 17:35:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:
Single allocations: kmalloc(sizeof(TYPE), ...)
are replaced with: kmalloc_obj(TYPE, ...)
Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with: kmalloc_objs(TYPE, COUNT, ...)
Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...)
(where TYPE may also be *VAR)
The resulting allocations no longer return "void *", instead returning
"TYPE *".
Signed-off-by: Kees Cook <kees@kernel.org>
2026-02-20 23:49:23 -08:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-24 18:49:41 +02:00
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
2019-08-11 11:25:10 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-11 11:25:10 -07:00
|
|
|
|
|
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2019-08-11 11:25:10 -07:00
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-26 14:59:58 -08:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
|
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2015-04-14 17:30:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-03 16:03:44 -07:00
|
|
|
|
2018-05-24 18:49:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-11 11:25:10 -07:00
|
|
|
|
2018-05-24 18:49:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-31 15:52:40 -05:00
|
|
|
|
2018-05-24 18:49:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-26 14:59:57 -08:00
|
|
|
|
2018-05-24 18:49:41 +02:00
|
|
|
|
2015-04-23 21:30:09 +03:00
|
|
|
|
2018-05-24 18:49:41 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2015-04-23 21:30:05 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2018-05-24 18:49:41 +02:00
|
|
|
|
2021-01-13 11:45:08 +09:00
|
|
|
|
2018-05-24 18:49:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-23 17:01:23 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-16 07:03:58 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()
Please do not apply this to mainline directly, instead please re-run the
coccinelle script shown below and apply its output.
For several reasons, it is desirable to use {READ,WRITE}_ONCE() in
preference to ACCESS_ONCE(), and new code is expected to use one of the
former. So far, there's been no reason to change most existing uses of
ACCESS_ONCE(), as these aren't harmful, and changing them results in
churn.
However, for some features, the read/write distinction is critical to
correct operation. To distinguish these cases, separate read/write
accessors must be used. This patch migrates (most) remaining
ACCESS_ONCE() instances to {READ,WRITE}_ONCE(), using the following
coccinelle script:
----
// Convert trivial ACCESS_ONCE() uses to equivalent READ_ONCE() and
// WRITE_ONCE()
// $ make coccicheck COCCI=/home/mark/once.cocci SPFLAGS="--include-headers" MODE=patch
virtual patch
@ depends on patch @
expression E1, E2;
@@
- ACCESS_ONCE(E1) = E2
+ WRITE_ONCE(E1, E2)
@ depends on patch @
expression E;
@@
- ACCESS_ONCE(E)
+ READ_ONCE(E)
----
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: davem@davemloft.net
Cc: linux-arch@vger.kernel.org
Cc: mpe@ellerman.id.au
Cc: shuah@kernel.org
Cc: snitzer@redhat.com
Cc: thor.thayer@linux.intel.com
Cc: tj@kernel.org
Cc: viro@zeniv.linux.org.uk
Cc: will.deacon@arm.com
Link: http://lkml.kernel.org/r/1508792849-3115-19-git-send-email-paulmck@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-10-23 14:07:29 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-03-24 20:57:53 +01:00
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2020-06-29 11:37:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-14 17:30:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2015-04-14 17:30:04 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-12-19 04:03:56 -06:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-04-23 17:01:23 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2015-04-14 17:30:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
2021-02-24 19:53:34 +01:00
|
|
|
|
scsi: target: tcmu: Fix and simplify timeout handling
During cmd timeout handling in check_timedout_devices(), due to a race, it
can happen that tcmu_set_next_deadline() does not start a timer as
expected:
1) Either tcmu_check_expired_ring_cmd() checks the inflight_queue or
tcmu_check_expired_queue_cmd() checks the qfull_queue while jiffies has
the value X
2) At the end of the check the queue contains one remaining command with
deadline X (time_after(X, X) is false and thus the command is not
handled as being timed out).
3) After tcmu_check_expired_xxxxx_cmd() a timer interrupt happens and
jiffies is incremented to X+1.
4) Now tcmu_set_next_deadline() is called, but it skips the command, since
time_after(X+1, X) is true. Therefore tcmu_set_next_deadline() finds no
new deadline and stops the timer, which it shouldn't.
Since commands that time out are removed from inflight_queue or
qfull_queue, we don't need the check with time_after() in
tcmu_set_next_deadline() but can use the deadline from the first cmd in
the queue.
Additionally, replace the remaining time_after() calls in
tcmu_check_expired_xxxxx_cmd() with time_after_eq(), because it is not
useful to set the timeout to deadline but then check for jiffies being
greater than deadline.
Simplify the end of tcmu_handle_completions() and change the check for no
more pending commands from
mb->cmd_tail == mb->cmd_head
to
idr_is_empty(&udev->commands)
because the old check doesn't work correctly if paddings or in the future
TMRs are in the ring.
Finally tcmu_set_next_deadline() was shifted in the source as
preparation for later implementation of tmr_notify callback.
Link: https://lore.kernel.org/r/20200726153510.13077-7-bstroesser@ts.fujitsu.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-07-26 17:35:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
scsi: target: tcmu: Fix and simplify timeout handling
During cmd timeout handling in check_timedout_devices(), due to a race, it
can happen that tcmu_set_next_deadline() does not start a timer as
expected:
1) Either tcmu_check_expired_ring_cmd() checks the inflight_queue or
tcmu_check_expired_queue_cmd() checks the qfull_queue while jiffies has
the value X
2) At the end of the check the queue contains one remaining command with
deadline X (time_after(X, X) is false and thus the command is not
handled as being timed out).
3) After tcmu_check_expired_xxxxx_cmd() a timer interrupt happens and
jiffies is incremented to X+1.
4) Now tcmu_set_next_deadline() is called, but it skips the command, since
time_after(X+1, X) is true. Therefore tcmu_set_next_deadline() finds no
new deadline and stops the timer, which it shouldn't.
Since commands that time out are removed from inflight_queue or
qfull_queue, we don't need the check with time_after() in
tcmu_set_next_deadline() but can use the deadline from the first cmd in
the queue.
Additionally, replace the remaining time_after() calls in
tcmu_check_expired_xxxxx_cmd() with time_after_eq(), because it is not
useful to set the timeout to deadline but then check for jiffies being
greater than deadline.
Simplify the end of tcmu_handle_completions() and change the check for no
more pending commands from
mb->cmd_tail == mb->cmd_head
to
idr_is_empty(&udev->commands)
because the old check doesn't work correctly if paddings or in the future
TMRs are in the ring.
Finally tcmu_set_next_deadline() was shifted in the source as
preparation for later implementation of tmr_notify callback.
Link: https://lore.kernel.org/r/20200726153510.13077-7-bstroesser@ts.fujitsu.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-07-26 17:35:08 +02:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
scsi: target: tcmu: Fix and simplify timeout handling
During cmd timeout handling in check_timedout_devices(), due to a race, it
can happen that tcmu_set_next_deadline() does not start a timer as
expected:
1) Either tcmu_check_expired_ring_cmd() checks the inflight_queue or
tcmu_check_expired_queue_cmd() checks the qfull_queue while jiffies has
the value X
2) At the end of the check the queue contains one remaining command with
deadline X (time_after(X, X) is false and thus the command is not
handled as being timed out).
3) After tcmu_check_expired_xxxxx_cmd() a timer interrupt happens and
jiffies is incremented to X+1.
4) Now tcmu_set_next_deadline() is called, but it skips the command, since
time_after(X+1, X) is true. Therefore tcmu_set_next_deadline() finds no
new deadline and stops the timer, which it shouldn't.
Since commands that time out are removed from inflight_queue or
qfull_queue, we don't need the check with time_after() in
tcmu_set_next_deadline() but can use the deadline from the first cmd in
the queue.
Additionally, replace the remaining time_after() calls in
tcmu_check_expired_xxxxx_cmd() with time_after_eq(), because it is not
useful to set the timeout to deadline but then check for jiffies being
greater than deadline.
Simplify the end of tcmu_handle_completions() and change the check for no
more pending commands from
mb->cmd_tail == mb->cmd_head
to
idr_is_empty(&udev->commands)
because the old check doesn't work correctly if paddings or in the future
TMRs are in the ring.
Finally tcmu_set_next_deadline() was shifted in the source as
preparation for later implementation of tmr_notify callback.
Link: https://lore.kernel.org/r/20200726153510.13077-7-bstroesser@ts.fujitsu.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-07-26 17:35:08 +02:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
2018-01-15 14:37:59 -06:00
|
|
|
|
2020-07-26 17:35:05 +02:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
scsi: target: tcmu: Fix and simplify timeout handling
During cmd timeout handling in check_timedout_devices(), due to a race, it
can happen that tcmu_set_next_deadline() does not start a timer as
expected:
1) Either tcmu_check_expired_ring_cmd() checks the inflight_queue or
tcmu_check_expired_queue_cmd() checks the qfull_queue while jiffies has
the value X
2) At the end of the check the queue contains one remaining command with
deadline X (time_after(X, X) is false and thus the command is not
handled as being timed out).
3) After tcmu_check_expired_xxxxx_cmd() a timer interrupt happens and
jiffies is incremented to X+1.
4) Now tcmu_set_next_deadline() is called, but it skips the command, since
time_after(X+1, X) is true. Therefore tcmu_set_next_deadline() finds no
new deadline and stops the timer, which it shouldn't.
Since commands that time out are removed from inflight_queue or
qfull_queue, we don't need the check with time_after() in
tcmu_set_next_deadline() but can use the deadline from the first cmd in
the queue.
Additionally, replace the remaining time_after() calls in
tcmu_check_expired_xxxxx_cmd() with time_after_eq(), because it is not
useful to set the timeout to deadline but then check for jiffies being
greater than deadline.
Simplify the end of tcmu_handle_completions() and change the check for no
more pending commands from
mb->cmd_tail == mb->cmd_head
to
idr_is_empty(&udev->commands)
because the old check doesn't work correctly if paddings or in the future
TMRs are in the ring.
Finally tcmu_set_next_deadline() was shifted in the source as
preparation for later implementation of tmr_notify callback.
Link: https://lore.kernel.org/r/20200726153510.13077-7-bstroesser@ts.fujitsu.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-07-26 17:35:08 +02:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
2020-05-23 13:11:29 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-13 11:45:08 +09:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-11-28 12:40:31 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
|
|
|
|
|
2025-05-09 07:51:14 +02:00
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-09 07:51:14 +02:00
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-21 16:37:42 -08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-21 16:37:42 -08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-05-17 04:34:37 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-09 02:42:09 -06:00
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
|
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2018-07-23 14:07:44 -05:00
|
|
|
|
2017-11-28 12:40:31 -06:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2021-02-24 19:53:34 +01:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
2017-09-14 09:30:05 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-18 18:50:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
|
|
|
|
|
2021-02-18 18:50:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2021-02-24 19:53:35 +01:00
|
|
|
|
2021-02-18 18:50:38 +01:00
|
|
|
|
|
|
|
|
|
2022-05-17 21:29:13 +02:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2021-02-18 18:50:38 +01:00
|
|
|
|
2022-05-17 21:29:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scsi: target: tcmu: Fix possible data corruption
When tcmu_vma_fault() gets a page successfully, before the current context
completes page fault procedure, find_free_blocks() may run and call
unmap_mapping_range() to unmap the page. Assume that when
find_free_blocks() initially completes and the previous page fault
procedure starts to run again and completes, then one truncated page has
been mapped to userspace. But note that tcmu_vma_fault() has gotten a
refcount for the page so any other subsystem won't be able to use the page
unless the userspace address is unmapped later.
If another command subsequently runs and needs to extend dbi_thresh it may
reuse the corresponding slot for the previous page in data_bitmap. Then
though we'll allocate new page for this slot in data_area, no page fault
will happen because we have a valid map and the real request's data will be
lost.
Filesystem implementations will also run into this issue but they usually
lock the page when vm_operations_struct->fault gets a page and unlock the
page after finish_fault() completes. For truncate filesystems lock pages in
truncate_inode_pages() to protect against racing wrt. page faults.
To fix this possible data corruption scenario we can apply a method similar
to the filesystems. For pages that are to be freed, tcmu_blocks_release()
locks and unlocks. Make tcmu_vma_fault() also lock found page under
cmdr_lock. At the same time, since tcmu_vma_fault() gets an extra page
refcount, tcmu_blocks_release() won't free pages if pages are in page fault
procedure, which means it is safe to call tcmu_blocks_release() before
unmap_mapping_range().
With these changes tcmu_blocks_release() will wait for all page faults to
be completed before calling unmap_mapping_range(). And later, if
unmap_mapping_range() is called, it will ensure stale mappings are removed.
Link: https://lore.kernel.org/r/20220421023735.9018-1-xiaoguang.wang@linux.alibaba.com
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-04-21 10:37:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-24 19:53:35 +01:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2021-02-18 18:50:38 +01:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-18 18:50:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-24 19:53:34 +01:00
|
|
|
|
2021-02-18 18:50:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-24 19:53:34 +01:00
|
|
|
|
2021-02-18 18:50:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-24 19:53:34 +01:00
|
|
|
|
2021-02-18 18:50:38 +01:00
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2021-02-18 18:50:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scsi: target: tcmu: Fix memory leak caused by wrong uio usage
When user deletes a tcmu device via configFS, tcmu calls
uio_unregister_device(). During that call uio resets its pointer to struct
uio_info provided by tcmu. That means, after uio_unregister_device() uio
will no longer execute any of the callbacks tcmu had set in uio_info.
Especially, if userspace daemon still holds the corresponding uio device
open or mmap'ed while tcmu calls uio_unregister_device(), uio will not call
tcmu_release() when userspace finally closes and munmaps the uio device.
Since tcmu does refcounting for the tcmu device in tcmu_open() and
tcmu_release(), in the decribed case refcount does not drop to 0 and tcmu
does not free tcmu device's resources. In extreme cases this can cause
memory leaking of up to 1 GB for a single tcmu device.
After uio_unregister_device(), uio will reject every open, read, write,
mmap from userspace with -EOI. But userspace daemon can still access the
mmap'ed command ring and data area. Therefore tcmu should wait until
userspace munmaps the uio device before it frees the resources, as we don't
want to cause SIGSEGV or SIGBUS to user space.
That said, current refcounting during tcmu_open and tcmu_release does not
work correctly, and refcounting better should be done in the open and close
callouts of the vm_operations_struct, which tcmu assigns to each mmap of
the uio device (because it wants its own page fault handler).
This patch fixes the memory leak by removing refcounting from tcmu_open and
tcmu_close, and instead adding new tcmu_vma_open() and tcmu_vma_close()
handlers that only do refcounting.
Link: https://lore.kernel.org/r/20210218175039.7829-3-bostroesser@gmail.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-02-18 18:50:39 +01:00
|
|
|
|
|
|
|
|
|
2021-02-18 18:50:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-13 11:45:08 +09:00
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-13 11:45:08 +09:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:56 +01:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2022-03-11 21:22:05 +08:00
|
|
|
|
scsi: target: tcmu: Fix possible data corruption
When tcmu_vma_fault() gets a page successfully, before the current context
completes page fault procedure, find_free_blocks() may run and call
unmap_mapping_range() to unmap the page. Assume that when
find_free_blocks() initially completes and the previous page fault
procedure starts to run again and completes, then one truncated page has
been mapped to userspace. But note that tcmu_vma_fault() has gotten a
refcount for the page so any other subsystem won't be able to use the page
unless the userspace address is unmapped later.
If another command subsequently runs and needs to extend dbi_thresh it may
reuse the corresponding slot for the previous page in data_bitmap. Then
though we'll allocate new page for this slot in data_area, no page fault
will happen because we have a valid map and the real request's data will be
lost.
Filesystem implementations will also run into this issue but they usually
lock the page when vm_operations_struct->fault gets a page and unlock the
page after finish_fault() completes. For truncate filesystems lock pages in
truncate_inode_pages() to protect against racing wrt. page faults.
To fix this possible data corruption scenario we can apply a method similar
to the filesystems. For pages that are to be freed, tcmu_blocks_release()
locks and unlocks. Make tcmu_vma_fault() also lock found page under
cmdr_lock. At the same time, since tcmu_vma_fault() gets an extra page
refcount, tcmu_blocks_release() won't free pages if pages are in page fault
procedure, which means it is safe to call tcmu_blocks_release() before
unmap_mapping_range().
With these changes tcmu_blocks_release() will wait for all page faults to
be completed before calling unmap_mapping_range(). And later, if
unmap_mapping_range() is called, it will ensure stale mappings are removed.
Link: https://lore.kernel.org/r/20220421023735.9018-1-xiaoguang.wang@linux.alibaba.com
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-04-21 10:37:35 +08:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-19 04:03:54 -06:00
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
scsi: target: tcmu: Fix memory leak caused by wrong uio usage
When user deletes a tcmu device via configFS, tcmu calls
uio_unregister_device(). During that call uio resets its pointer to struct
uio_info provided by tcmu. That means, after uio_unregister_device() uio
will no longer execute any of the callbacks tcmu had set in uio_info.
Especially, if userspace daemon still holds the corresponding uio device
open or mmap'ed while tcmu calls uio_unregister_device(), uio will not call
tcmu_release() when userspace finally closes and munmaps the uio device.
Since tcmu does refcounting for the tcmu device in tcmu_open() and
tcmu_release(), in the decribed case refcount does not drop to 0 and tcmu
does not free tcmu device's resources. In extreme cases this can cause
memory leaking of up to 1 GB for a single tcmu device.
After uio_unregister_device(), uio will reject every open, read, write,
mmap from userspace with -EOI. But userspace daemon can still access the
mmap'ed command ring and data area. Therefore tcmu should wait until
userspace munmaps the uio device before it frees the resources, as we don't
want to cause SIGSEGV or SIGBUS to user space.
That said, current refcounting during tcmu_open and tcmu_release does not
work correctly, and refcounting better should be done in the open and close
callouts of the vm_operations_struct, which tcmu assigns to each mmap of
the uio device (because it wants its own page fault handler).
This patch fixes the memory leak by removing refcounting from tcmu_open and
tcmu_close, and instead adding new tcmu_vma_open() and tcmu_vma_close()
handlers that only do refcounting.
Link: https://lore.kernel.org/r/20210218175039.7829-3-bostroesser@gmail.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-02-18 18:50:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-15 00:25:57 +05:30
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-02-24 14:56:41 -08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scsi: target: tcmu: Fix possible data corruption
When tcmu_vma_fault() gets a page successfully, before the current context
completes page fault procedure, find_free_blocks() may run and call
unmap_mapping_range() to unmap the page. Assume that when
find_free_blocks() initially completes and the previous page fault
procedure starts to run again and completes, then one truncated page has
been mapped to userspace. But note that tcmu_vma_fault() has gotten a
refcount for the page so any other subsystem won't be able to use the page
unless the userspace address is unmapped later.
If another command subsequently runs and needs to extend dbi_thresh it may
reuse the corresponding slot for the previous page in data_bitmap. Then
though we'll allocate new page for this slot in data_area, no page fault
will happen because we have a valid map and the real request's data will be
lost.
Filesystem implementations will also run into this issue but they usually
lock the page when vm_operations_struct->fault gets a page and unlock the
page after finish_fault() completes. For truncate filesystems lock pages in
truncate_inode_pages() to protect against racing wrt. page faults.
To fix this possible data corruption scenario we can apply a method similar
to the filesystems. For pages that are to be freed, tcmu_blocks_release()
locks and unlocks. Make tcmu_vma_fault() also lock found page under
cmdr_lock. At the same time, since tcmu_vma_fault() gets an extra page
refcount, tcmu_blocks_release() won't free pages if pages are in page fault
procedure, which means it is safe to call tcmu_blocks_release() before
unmap_mapping_range().
With these changes tcmu_blocks_release() will wait for all page faults to
be completed before calling unmap_mapping_range(). And later, if
unmap_mapping_range() is called, it will ensure stale mappings are removed.
Link: https://lore.kernel.org/r/20220421023735.9018-1-xiaoguang.wang@linux.alibaba.com
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-04-21 10:37:35 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-02-24 14:56:41 -08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2022-03-11 21:22:05 +08:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2017-12-19 04:03:54 -06:00
|
|
|
|
scsi: target: tcmu: Fix possible data corruption
When tcmu_vma_fault() gets a page successfully, before the current context
completes page fault procedure, find_free_blocks() may run and call
unmap_mapping_range() to unmap the page. Assume that when
find_free_blocks() initially completes and the previous page fault
procedure starts to run again and completes, then one truncated page has
been mapped to userspace. But note that tcmu_vma_fault() has gotten a
refcount for the page so any other subsystem won't be able to use the page
unless the userspace address is unmapped later.
If another command subsequently runs and needs to extend dbi_thresh it may
reuse the corresponding slot for the previous page in data_bitmap. Then
though we'll allocate new page for this slot in data_area, no page fault
will happen because we have a valid map and the real request's data will be
lost.
Filesystem implementations will also run into this issue but they usually
lock the page when vm_operations_struct->fault gets a page and unlock the
page after finish_fault() completes. For truncate filesystems lock pages in
truncate_inode_pages() to protect against racing wrt. page faults.
To fix this possible data corruption scenario we can apply a method similar
to the filesystems. For pages that are to be freed, tcmu_blocks_release()
locks and unlocks. Make tcmu_vma_fault() also lock found page under
cmdr_lock. At the same time, since tcmu_vma_fault() gets an extra page
refcount, tcmu_blocks_release() won't free pages if pages are in page fault
procedure, which means it is safe to call tcmu_blocks_release() before
unmap_mapping_range().
With these changes tcmu_blocks_release() will wait for all page faults to
be completed before calling unmap_mapping_range(). And later, if
unmap_mapping_range() is called, it will ensure stale mappings are removed.
Link: https://lore.kernel.org/r/20220421023735.9018-1-xiaoguang.wang@linux.alibaba.com
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-04-21 10:37:35 +08:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
scsi: target: tcmu: Fix possible data corruption
When tcmu_vma_fault() gets a page successfully, before the current context
completes page fault procedure, find_free_blocks() may run and call
unmap_mapping_range() to unmap the page. Assume that when
find_free_blocks() initially completes and the previous page fault
procedure starts to run again and completes, then one truncated page has
been mapped to userspace. But note that tcmu_vma_fault() has gotten a
refcount for the page so any other subsystem won't be able to use the page
unless the userspace address is unmapped later.
If another command subsequently runs and needs to extend dbi_thresh it may
reuse the corresponding slot for the previous page in data_bitmap. Then
though we'll allocate new page for this slot in data_area, no page fault
will happen because we have a valid map and the real request's data will be
lost.
Filesystem implementations will also run into this issue but they usually
lock the page when vm_operations_struct->fault gets a page and unlock the
page after finish_fault() completes. For truncate filesystems lock pages in
truncate_inode_pages() to protect against racing wrt. page faults.
To fix this possible data corruption scenario we can apply a method similar
to the filesystems. For pages that are to be freed, tcmu_blocks_release()
locks and unlocks. Make tcmu_vma_fault() also lock found page under
cmdr_lock. At the same time, since tcmu_vma_fault() gets an extra page
refcount, tcmu_blocks_release() won't free pages if pages are in page fault
procedure, which means it is safe to call tcmu_blocks_release() before
unmap_mapping_range().
With these changes tcmu_blocks_release() will wait for all page faults to
be completed before calling unmap_mapping_range(). And later, if
unmap_mapping_range() is called, it will ensure stale mappings are removed.
Link: https://lore.kernel.org/r/20220421023735.9018-1-xiaoguang.wang@linux.alibaba.com
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-04-21 10:37:35 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scsi: target: tcmu: Fix memory leak caused by wrong uio usage
When user deletes a tcmu device via configFS, tcmu calls
uio_unregister_device(). During that call uio resets its pointer to struct
uio_info provided by tcmu. That means, after uio_unregister_device() uio
will no longer execute any of the callbacks tcmu had set in uio_info.
Especially, if userspace daemon still holds the corresponding uio device
open or mmap'ed while tcmu calls uio_unregister_device(), uio will not call
tcmu_release() when userspace finally closes and munmaps the uio device.
Since tcmu does refcounting for the tcmu device in tcmu_open() and
tcmu_release(), in the decribed case refcount does not drop to 0 and tcmu
does not free tcmu device's resources. In extreme cases this can cause
memory leaking of up to 1 GB for a single tcmu device.
After uio_unregister_device(), uio will reject every open, read, write,
mmap from userspace with -EOI. But userspace daemon can still access the
mmap'ed command ring and data area. Therefore tcmu should wait until
userspace munmaps the uio device before it frees the resources, as we don't
want to cause SIGSEGV or SIGBUS to user space.
That said, current refcounting during tcmu_open and tcmu_release does not
work correctly, and refcounting better should be done in the open and close
callouts of the vm_operations_struct, which tcmu assigns to each mmap of
the uio device (because it wants its own page fault handler).
This patch fixes the memory leak by removing refcounting from tcmu_open and
tcmu_close, and instead adding new tcmu_vma_open() and tcmu_vma_close()
handlers that only do refcounting.
Link: https://lore.kernel.org/r/20210218175039.7829-3-bostroesser@gmail.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-02-18 18:50:39 +01:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-01-26 11:37:49 -08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:53 +01:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
scsi: target: tcmu: Fix memory leak caused by wrong uio usage
When user deletes a tcmu device via configFS, tcmu calls
uio_unregister_device(). During that call uio resets its pointer to struct
uio_info provided by tcmu. That means, after uio_unregister_device() uio
will no longer execute any of the callbacks tcmu had set in uio_info.
Especially, if userspace daemon still holds the corresponding uio device
open or mmap'ed while tcmu calls uio_unregister_device(), uio will not call
tcmu_release() when userspace finally closes and munmaps the uio device.
Since tcmu does refcounting for the tcmu device in tcmu_open() and
tcmu_release(), in the decribed case refcount does not drop to 0 and tcmu
does not free tcmu device's resources. In extreme cases this can cause
memory leaking of up to 1 GB for a single tcmu device.
After uio_unregister_device(), uio will reject every open, read, write,
mmap from userspace with -EOI. But userspace daemon can still access the
mmap'ed command ring and data area. Therefore tcmu should wait until
userspace munmaps the uio device before it frees the resources, as we don't
want to cause SIGSEGV or SIGBUS to user space.
That said, current refcounting during tcmu_open and tcmu_release does not
work correctly, and refcounting better should be done in the open and close
callouts of the vm_operations_struct, which tcmu assigns to each mmap of
the uio device (because it wants its own page fault handler).
This patch fixes the memory leak by removing refcounting from tcmu_open and
tcmu_close, and instead adding new tcmu_vma_open() and tcmu_vma_close()
handlers that only do refcounting.
Link: https://lore.kernel.org/r/20210218175039.7829-3-bostroesser@gmail.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-02-18 18:50:39 +01:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scsi: target: tcmu: Fix memory leak caused by wrong uio usage
When user deletes a tcmu device via configFS, tcmu calls
uio_unregister_device(). During that call uio resets its pointer to struct
uio_info provided by tcmu. That means, after uio_unregister_device() uio
will no longer execute any of the callbacks tcmu had set in uio_info.
Especially, if userspace daemon still holds the corresponding uio device
open or mmap'ed while tcmu calls uio_unregister_device(), uio will not call
tcmu_release() when userspace finally closes and munmaps the uio device.
Since tcmu does refcounting for the tcmu device in tcmu_open() and
tcmu_release(), in the decribed case refcount does not drop to 0 and tcmu
does not free tcmu device's resources. In extreme cases this can cause
memory leaking of up to 1 GB for a single tcmu device.
After uio_unregister_device(), uio will reject every open, read, write,
mmap from userspace with -EOI. But userspace daemon can still access the
mmap'ed command ring and data area. Therefore tcmu should wait until
userspace munmaps the uio device before it frees the resources, as we don't
want to cause SIGSEGV or SIGBUS to user space.
That said, current refcounting during tcmu_open and tcmu_release does not
work correctly, and refcounting better should be done in the open and close
callouts of the vm_operations_struct, which tcmu assigns to each mmap of
the uio device (because it wants its own page fault handler).
This patch fixes the memory leak by removing refcounting from tcmu_open and
tcmu_close, and instead adding new tcmu_vma_open() and tcmu_vma_close()
handlers that only do refcounting.
Link: https://lore.kernel.org/r/20210218175039.7829-3-bostroesser@gmail.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-02-18 18:50:39 +01:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:20 -05:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:20 -05:00
|
|
|
|
2017-09-13 14:01:22 +09:00
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:20 -05:00
|
|
|
|
2017-09-13 14:01:22 +09:00
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
2018-06-22 16:40:22 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
2018-06-22 16:40:20 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:20 -05:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
2019-08-05 08:43:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-13 14:01:22 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:19 -05:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
2018-01-16 15:34:32 +00:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
2018-05-02 11:13:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 23:01:15 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 23:01:15 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2014-10-01 23:01:15 -07:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
2014-10-01 23:01:15 -07:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 23:01:15 -07:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2018-05-02 11:13:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
2018-05-02 11:13:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:21 -05:00
|
|
|
|
2018-05-02 11:13:39 +08:00
|
|
|
|
2018-06-22 16:40:21 -05:00
|
|
|
|
2017-06-06 09:28:52 -05:00
|
|
|
|
2015-01-16 22:09:00 +01:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2018-06-22 16:40:20 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:15 -05:00
|
|
|
|
2016-01-13 17:26:13 -08:00
|
|
|
|
2024-10-11 17:12:17 +00:00
|
|
|
|
2019-02-28 14:28:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-05 08:43:36 +08:00
|
|
|
|
|
|
|
|
|
2019-02-28 14:28:24 -05:00
|
|
|
|
2018-05-02 11:13:39 +08:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2018-05-02 11:13:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:21 -05:00
|
|
|
|
|
|
|
|
|
2018-05-02 11:13:40 +08:00
|
|
|
|
|
|
|
|
|
2018-05-02 11:13:41 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:21 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-07-07 14:20:00 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-06-16 09:02:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-14 08:11:04 -05:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-07-07 14:20:00 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2017-07-07 14:20:00 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:49 -05:00
|
|
|
|
2019-03-04 11:44:34 +02:00
|
|
|
|
2018-07-23 14:07:49 -05:00
|
|
|
|
2018-01-11 11:12:25 +00:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
2018-01-11 11:12:25 +00:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
2021-03-24 20:57:53 +01:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:53 +01:00
|
|
|
|
|
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2015-04-14 17:30:04 -07:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2015-09-04 01:39:56 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2016-02-01 17:29:45 +01:00
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
tcmu: Add dynamic growing data area feature support
Currently for the TCMU, the ring buffer size is fixed to 64K cmd
area + 1M data area, and this will be bottlenecks for high iops.
The struct tcmu_cmd_entry {} size is fixed about 112 bytes with
iovec[N] & N <= 4, and the size of struct iovec is about 16 bytes.
If N == 0, the ratio will be sizeof(cmd entry) : sizeof(datas) ==
112Bytes : (N * 4096)Bytes = 28 : 0, no data area is need.
If 0 < N <=4, the ratio will be sizeof(cmd entry) : sizeof(datas)
== 112Bytes : (N * 4096)Bytes = 28 : (N * 1024), so the max will
be 28 : 1024.
If N > 4, the sizeof(cmd entry) will be [(N - 4) *16 + 112] bytes,
and its corresponding data size will be [N * 4096], so the ratio
of sizeof(cmd entry) : sizeof(datas) == [(N - 4) * 16 + 112)Bytes
: (N * 4096)Bytes == 4/1024 - 12/(N * 1024), so the max is about
4 : 1024.
When N is bigger, the ratio will be smaller.
As the initial patch, we will set the cmd area size to 2M, and
the cmd area size to 32M. The TCMU will dynamically grows the data
area from 0 to max 32M size as needed.
The cmd area memory will be allocated through vmalloc(), and the
data area's blocks will be allocated individually later when needed.
The allocated data area block memory will be managed via radix tree.
For now the bitmap still be the most efficient way to search and
manage the block index, this could be update later.
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Jianfei Hu <hujianfei@cmss.chinamobile.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-05-02 11:38:05 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-12-28 11:57:39 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-03-01 23:14:39 -06:00
|
|
|
|
|
|
|
|
|
2017-06-06 09:28:48 -05:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-09-13 14:01:22 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-17 04:34:37 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-02 11:13:40 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-17 04:34:37 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-14 09:30:05 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2019-03-04 11:44:34 +02:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-05-17 04:34:37 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:12 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-05 10:17:26 +02:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-02 11:13:41 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-06-23 01:18:19 -05:00
|
|
|
|
2017-06-23 01:18:20 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-24 19:53:34 +01:00
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-24 19:53:34 +01:00
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
2021-02-24 19:53:34 +01:00
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
|
|
|
|
|
2019-08-11 11:25:10 -07:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2021-01-13 11:45:08 +09:00
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-09 12:10:26 +02:00
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
2025-04-05 10:17:26 +02:00
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-03-01 23:14:39 -06:00
|
|
|
|
2021-03-24 20:57:58 +01:00
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2024-11-11 14:10:56 +01:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2018-07-23 14:07:51 -05:00
|
|
|
|
2018-07-23 14:07:50 -05:00
|
|
|
|
|
|
|
|
|
2017-09-13 14:01:22 +09:00
|
|
|
|
2018-07-23 14:07:49 -05:00
|
|
|
|
2021-03-24 20:57:58 +01:00
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-01 23:14:39 -06:00
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:50 -05:00
|
|
|
|
2017-03-01 23:14:39 -06:00
|
|
|
|
2018-07-23 14:07:50 -05:00
|
|
|
|
2017-03-01 23:14:39 -06:00
|
|
|
|
2018-07-23 14:07:50 -05:00
|
|
|
|
|
|
|
|
|
2017-03-01 23:14:39 -06:00
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-01 23:14:39 -06:00
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:50 -05:00
|
|
|
|
2017-03-01 23:14:39 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:49 -05:00
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2018-07-23 14:07:49 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2018-07-23 14:07:49 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:49 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2018-07-23 14:07:49 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:51 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2018-07-23 14:07:49 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:51 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2018-07-23 14:07:51 -05:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2015-05-19 14:44:39 -07:00
|
|
|
|
2017-03-01 23:14:39 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-19 14:44:39 -07:00
|
|
|
|
2017-09-13 14:01:22 +09:00
|
|
|
|
2018-07-23 14:07:50 -05:00
|
|
|
|
2017-09-13 14:01:22 +09:00
|
|
|
|
2018-07-23 14:07:50 -05:00
|
|
|
|
|
|
|
|
|
2017-09-13 14:01:22 +09:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
2018-07-23 14:07:49 -05:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
2021-03-24 20:57:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-01 23:14:40 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:51 -05:00
|
|
|
|
2021-03-24 20:57:58 +01:00
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-06 10:07:07 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-03-18 15:04:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-15 14:44:55 +09:00
|
|
|
|
2017-03-18 15:04:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-10 19:12:18 +05:30
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
2017-06-06 09:28:51 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-02 11:13:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:21 -05:00
|
|
|
|
2018-05-02 11:13:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
|
|
|
|
|
2017-06-06 09:28:51 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
2017-06-06 09:28:51 -05:00
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
|
|
|
|
|
2017-06-06 09:28:51 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:46 -05:00
|
|
|
|
2018-05-02 11:13:42 +08:00
|
|
|
|
2017-06-06 09:28:51 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-21 03:00:33 +00:00
|
|
|
|
2017-07-07 14:20:00 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-06 09:28:51 -05:00
|
|
|
|
2023-06-21 03:00:33 +00:00
|
|
|
|
2017-06-06 09:28:51 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
2017-06-06 09:28:51 -05:00
|
|
|
|
2017-06-06 09:28:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:51 -05:00
|
|
|
|
2017-06-06 09:28:50 -05:00
|
|
|
|
|
|
|
|
|
2018-05-02 11:13:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:21 -05:00
|
|
|
|
2018-05-02 11:13:43 +08:00
|
|
|
|
|
|
|
|
|
2017-06-06 09:28:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
2017-06-06 09:28:50 -05:00
|
|
|
|
|
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
2017-06-06 09:28:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:46 -05:00
|
|
|
|
2018-05-02 11:13:43 +08:00
|
|
|
|
2017-06-06 09:28:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
2017-06-06 09:28:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-13 14:01:22 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-06 09:28:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-02 11:13:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-22 16:40:21 -05:00
|
|
|
|
2018-05-02 11:13:44 +08:00
|
|
|
|
|
|
|
|
|
2017-06-06 09:28:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-06 09:28:49 -05:00
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
2017-06-06 09:28:48 -05:00
|
|
|
|
|
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
2017-06-06 09:28:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-06 09:28:49 -05:00
|
|
|
|
2018-07-23 14:07:46 -05:00
|
|
|
|
2018-05-02 11:13:44 +08:00
|
|
|
|
2017-06-06 09:28:49 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
|
|
|
|
|
2017-06-06 09:28:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-26 17:35:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:47 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:47 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-13 14:29:09 +01:00
|
|
|
|
2017-06-06 09:28:50 -05:00
|
|
|
|
2017-11-28 12:40:40 -06:00
|
|
|
|
2017-11-28 12:40:41 -06:00
|
|
|
|
2021-03-24 20:57:58 +01:00
|
|
|
|
2022-02-16 10:21:49 +08:00
|
|
|
|
2017-06-12 01:34:28 -05:00
|
|
|
|
2017-06-06 09:28:50 -05:00
|
|
|
|
|
|
|
|
|
2020-07-26 17:35:10 +02:00
|
|
|
|
2017-09-13 14:01:22 +09:00
|
|
|
|
2017-06-06 09:28:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-18 15:04:13 -07:00
|
|
|
|
|
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-13 19:50:21 +02:00
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-18 15:04:13 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2020-04-27 17:08:22 +02:00
|
|
|
|
2020-04-27 17:08:23 +02:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 01:18:12 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2021-02-27 11:00:04 -06:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-19 04:03:58 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:29 -06:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
2017-11-28 12:40:29 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-23 14:07:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:29 -06:00
|
|
|
|
2020-07-26 17:35:09 +02:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:29 -06:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:29 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:29 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scsi: target: tcmu: Fix possible data corruption
When tcmu_vma_fault() gets a page successfully, before the current context
completes page fault procedure, find_free_blocks() may run and call
unmap_mapping_range() to unmap the page. Assume that when
find_free_blocks() initially completes and the previous page fault
procedure starts to run again and completes, then one truncated page has
been mapped to userspace. But note that tcmu_vma_fault() has gotten a
refcount for the page so any other subsystem won't be able to use the page
unless the userspace address is unmapped later.
If another command subsequently runs and needs to extend dbi_thresh it may
reuse the corresponding slot for the previous page in data_bitmap. Then
though we'll allocate new page for this slot in data_area, no page fault
will happen because we have a valid map and the real request's data will be
lost.
Filesystem implementations will also run into this issue but they usually
lock the page when vm_operations_struct->fault gets a page and unlock the
page after finish_fault() completes. For truncate filesystems lock pages in
truncate_inode_pages() to protect against racing wrt. page faults.
To fix this possible data corruption scenario we can apply a method similar
to the filesystems. For pages that are to be freed, tcmu_blocks_release()
locks and unlocks. Make tcmu_vma_fault() also lock found page under
cmdr_lock. At the same time, since tcmu_vma_fault() gets an extra page
refcount, tcmu_blocks_release() won't free pages if pages are in page fault
procedure, which means it is safe to call tcmu_blocks_release() before
unmap_mapping_range().
With these changes tcmu_blocks_release() will wait for all page faults to
be completed before calling unmap_mapping_range(). And later, if
unmap_mapping_range() is called, it will ensure stale mappings are removed.
Link: https://lore.kernel.org/r/20220421023735.9018-1-xiaoguang.wang@linux.alibaba.com
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-04-21 10:37:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:29 -06:00
|
|
|
|
2021-03-24 20:57:57 +01:00
|
|
|
|
2017-11-28 12:40:29 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2021-03-24 20:57:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:29 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-24 20:57:54 +01:00
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2017-11-28 12:40:29 -06:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:31 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
2017-11-28 12:40:31 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:32 -06:00
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
2020-05-18 18:48:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-23 09:15:30 +08:00
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:32 -06:00
|
|
|
|
2017-11-28 12:40:31 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:30 -06:00
|
|
|
|
2017-11-28 12:40:29 -06:00
|
|
|
|
2017-11-28 12:40:31 -06:00
|
|
|
|
2017-11-28 12:40:30 -06:00
|
|
|
|
2017-05-02 11:38:06 +08:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
2017-06-06 09:28:50 -05:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2017-11-28 12:40:30 -06:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-27 17:08:21 +02:00
|
|
|
|
2017-03-18 15:04:13 -07:00
|
|
|
|
2020-04-27 17:08:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-06 09:28:50 -05:00
|
|
|
|
|
|
|
|
|
2017-03-18 15:04:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-27 17:08:21 +02:00
|
|
|
|
2017-03-18 15:04:13 -07:00
|
|
|
|
2020-04-27 17:08:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-18 15:04:13 -07:00
|
|
|
|
|
|
|
|
|
2015-05-10 18:14:56 +02:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
2017-03-18 15:04:13 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-18 15:04:13 -07:00
|
|
|
|
|
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-28 12:40:39 -06:00
|
|
|
|
2015-05-10 18:14:56 +02:00
|
|
|
|
2017-03-18 15:04:13 -07:00
|
|
|
|
2014-10-01 16:07:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|