Re: [PATCH] target/user: Add daynmic growing data area featuresupport

2017-02-23 Thread Xiubo Li
When N is bigger, the ratio will be smaller. If N >= 1, the ratio will be [15/1024, 4/1024), for this the ratio 15 : 1024 will be enough. But maybe some iscsi cmds has no datas, N == 0. So the ratio should be bigger. For now we will increase the data area size to 1G, and the cmd area size to

Re: [PATCH RFC] target/user: Add double ring buffers support.

2017-02-13 Thread Xiubo Li
On 2017年02月14日 01:42, Andy Grover wrote: On 02/12/2017 05:38 PM, Xiubo Li wrote: On 2017年02月11日 02:02, Andy Grover wrote: 1. increase the region mmap()ed by userspace, TCMU_RING_SIZE, from 1MB to 1GB or larger 2. Don't vmalloc() the whole thing, instead vmalloc for the cmd ring portion

Re: [PATCH RFC] target/user: Add double ring buffers support.

2017-02-13 Thread Xiubo Li
Yes I think it's now clear we need more buffer space to avoid bottlenecks for high iops. The initial design kept it simple with the 1MB vmalloc'd space but anticipated greater would be needed. It should not be necessary to change userspace or the TCMU ABI to handle growing the buffer for fast

Re: [PATCH RFC] target/user: Add double ring buffers support.

2017-02-14 Thread Xiubo Li
The struct tcmu_cmd_entry {} size is fixed 44 bytes without iovec[], and the size of struct iovec[N] is about 16 bytes * N. The cmd entry size will be [44B, N *16 + 44B], and the data size will be [0, N * 4096], so the ratio of sizeof(cmd entry): sizeof(entry datas) == (N * 16 + 44)Bytes : (N *

Re: [PATCH RFC] target/user: Add double ring buffers support.

2017-02-13 Thread Xiubo Li
Hi Andy, There is one new scheme in my mind: Yes I think it's now clear we need more buffer space to avoid bottlenecks for high iops. The initial design kept it simple with the 1MB vmalloc'd space but anticipated greater would be needed. It should not be necessary to change userspace or

Re: [PATCH] target/user: Add daynmic growing data area featuresupport

2017-02-27 Thread Xiubo Li
Hi Mike Thanks verrry much for your work and test cases. From: Xiubo Li <lixi...@cmss.chinamobile.com> 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. Hi Xiubo, thanks for your work. daynmic -> dyna

Re: [PATCH] target/user: Add daynmic growing data area featuresupport

2017-02-28 Thread Xiubo Li
On 02/17/2017 01:24 AM, lixi...@cmss.chinamobile.com wrote: From: Xiubo Li <lixi...@cmss.chinamobile.com> 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. Hi Xiubo, thanks for your work. daynmic -> dyna

Re: [PATCH] target/user: Add daynmic growing data area featuresupport

2017-02-28 Thread Xiubo Li
Write throughput is pretty low at around 150 MB/s. What's the original write throughput without this patch? Is it also around 80 MB/s ? It is around 20-30 MB/s. Same fio args except using --rw=write. Got it. Thanks. BRs Xiubo

Re: [PATCH] target/user: Add daynmic growing data area featuresupport

2017-03-01 Thread Xiubo Li
For now we will increase the data area size to 1G, and the cmd area size to 128M. The tcmu-runner should mmap() about (128M + 1G) when running and the TCMU will dynamically grows the data area from 0 to max 1G size. Cool. This is a good approach for an initial patch but this raises concerns

Re: [PATCH] target/user: Add daynmic growing data area featuresupport

2017-02-26 Thread Xiubo Li
Cool. This is a good approach for an initial patch but this raises concerns about efficiently managing kernel memory usage -- the data area grows but never shrinks, and total possible usage increases per backstore. (What if there are 1000?) Any ideas how we could also improve these aspects of

Re: [PATCH] target/user: Fix use-after-free cmd->se_cmd if the cmd isexpired

2017-01-04 Thread Xiubo Li
best resolution is to move tcmu_handle_completion() between spin_lock(>commands_lock) and spin_unlock(>commands_lock)? Thanks. BRs Xiubo Li -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo

Re: [PATCHv5 0/2] tcmu: For bugs fix only

2017-03-30 Thread Xiubo Li
On 2017年03月30日 16:48, Nicholas A. Bellinger wrote: Hi Xiubo & Co, On Mon, 2017-03-27 at 17:07 +0800, lixi...@cmss.chinamobile.com wrote: From: Xiubo Li <lixi...@cmss.chinamobile.com> Changed for V5: - This only includes #1 and #2. And for old #3, #4 are still reviewing. - #1, since

Re: [PATCHv3 0/5] Dynamic growing data area support

2017-03-20 Thread Xiubo Li
On 2017年03月21日 13:24, Nicholas A. Bellinger wrote: Hi Xiubo ! On Mon, 2017-03-20 at 17:09 +0800, lixi...@cmss.chinamobile.com wrote: From: Xiubo Li <lixi...@cmss.chinamobile.com> Changed for V3: - [PATCHv2 2/5] fix double usage of blocks and possible page fault call trace. - [PATCH

Re: [PATCHv2 4/5] target/user: Fix wrongly calculating of the base_command_size

2017-03-16 Thread Xiubo Li
On 2017年03月08日 16:45, lixi...@cmss.chinamobile.com wrote: From: Xiubo Li <lixi...@cmss.chinamobile.com> The t_data_nents and t_bidi_data_nents are all the numbers of the segments, and we couldn't be sure the size of the data area block will equal to size of the segment. Use the actually

Re: how to unmap pages in an anonymous mmap?

2017-03-09 Thread Xiubo Li
On 2017年02月28日 03:32, Andy Grover wrote: On 02/26/2017 09:59 PM, Xiubo Li wrote: But, We likely don't want to release memory from the data area anyways while active, in any case. How about if we set a timer when active commands go to zero, and then reduce data area to some minimum if no new

Re: [PATCH] target/user: Fix possible overwrite of t_data_sg's lastiov[]

2017-03-05 Thread Xiubo Li
On 02/27/2017 09:47 PM, lixi...@cmss.chinamobile.com wrote: From: Xiubo Li <lixi...@cmss.chinamobile.com> If there has BIDI data, its first iov[] will overwrite the last iov[] for se_cmd->t_data_sg. (+CCing orig BIDI and data block code authors) Yeah. It looks lik

Re: [PATCH] tcmu: Oops in unmap_thread_fn()

2017-08-01 Thread Xiubo Li
On 2017年08月02日 04:09, Dan Carpenter wrote: Calling list_del() on the iterator pointer in list_for_each_entry() will cause an oops. We need to user the _safe() version for that. Fixes: c73d02f63c16 ("tcmu: Add fifo type waiter list support to avoid starvation") Signed-off-by: Dan Carpenter

Re: [PATCH] tcmu: Fix possible overflow for memcpy address in iovec

2017-07-11 Thread Xiubo Li
On 2017年07月11日 17:17, Damien Le Moal wrote: Xiubo, On Tue, 2017-07-11 at 17:04 +0800, Xiubo Li wrote: diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 930800c..86a845a 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target

Re: [PATCH] tcmu: Fix possbile memory leak when recalculating the cmdbase size

2017-07-11 Thread Xiubo Li
. Otherwise, please feel free to add my "tested-by" On Tue, 2017-07-11 at 17:06 +0800, Xiubo Li wrote: On 2017年07月11日 16:05, lixi...@cmss.chinamobile.com wrote: From: Xiubo Li <lixi...@cmss.chinamobile.com> For all the entries allocated from the ring cmd area, the memory is somethin

Re: [PATCH] tcmu: Fix possbile memory leak when recalculating thecmd base size

2017-07-11 Thread Xiubo Li
On 2017年07月11日 17:34, Nicholas A. Bellinger wrote: On Tue, 2017-07-11 at 09:24 +, Damien Le Moal wrote: Xiubo, Well done ! This fixed my problem. The ZBC test suite now passes all tests on my target without crashing the kernel. Please see some comments/nitpicks below. Otherwise, please

Re: [PATCH] tcmu: Fix possible overflow for memcpy address in iovec

2017-07-11 Thread Xiubo Li
On 2017年07月11日 16:41, Nicholas A. Bellinger wrote: Hey Xiubo, On Tue, 2017-07-11 at 16:04 +0800, Xiubo Li wrote: Hi All Please ignore about this patch. Just my mistake. Sorry. Damien (CC'ed) has been observing something similar atop the latest target-pending/for-next with his user-space

Re: [PATCH] tcmu: Fix possible overflow for memcpy address in iovec

2017-07-11 Thread Xiubo Li
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 930800c..86a845a 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -437,7 +437,7 @@ static int scatter_data_area(struct tcmu_dev *udev,

Re: [PATCH] tcmu: Fix possbile memory leak when recalculating the cmd base size

2017-07-11 Thread Xiubo Li
To Damien, Please test this, I think this maybe helpful. Thanks, BRs On 2017年07月11日 16:05, lixi...@cmss.chinamobile.com wrote: From: Xiubo Li <lixi...@cmss.chinamobile.com> For all the entries allocated from the ring cmd area, the memory is something like the stack, which will r

Re: [PATCH] tcmu: Fix possible overflow for memcpy address in iovec

2017-07-11 Thread Xiubo Li
Hi All Please ignore about this patch. Just my mistake. Sorry. Brs Xiubo On 2017年07月11日 15:40, lixi...@cmss.chinamobile.com wrote: From: Xiubo Li <lixi...@cmss.chinamobile.com> Before the data area dynamic grow patches, though the overflow bug was already exist, since the dat

Re: [PATCH v6 2/2] tcmu: Add global data block pool support

2017-04-30 Thread Xiubo Li
[...] + +static bool tcmu_get_empty_blocks(struct tcmu_dev *udev, + struct tcmu_cmd *tcmu_cmd, + uint32_t blocks_needed) Can drop blocks_needed. Will fix it. [...] -static void *tcmu_get_block_addr(struct tcmu_dev *udev,

Re: [PATCH v6 1/2] tcmu: Add dynamic growing data area featuresupport

2017-04-30 Thread Xiubo Li
de and the kunmap is at the end of aasda(). This as the initial patch, the memory is from slab cache now. But since the second patch followed will covert to use memory page from the buddy directly. Thanks, BRs Xiubo Li

Re: [PATCH] tcmu: Add fifo type waiter list support to avoidstarvation

2017-06-19 Thread Xiubo Li
Hi Nic & Mike I will update this just after the issue reported by Bryant on his environment been fixed later. Thanks, BRs Xiubo On 2017年06月04日 12:11, Mike Christie wrote: On 05/04/2017 09:51 PM, lixi...@cmss.chinamobile.com wrote: From: Xiubo Li <lixi...@cmss.chinamobile.com>

Re: [PATCH] tcmu: remove useless code and clean up the code style.

2018-06-07 Thread Xiubo Li
On 2018/6/8 9:35, Martin K. Petersen wrote: Xiubo, Since the TCMU_RING_SIZE macro is not using here will discard it and at the same time clean up the code style. Applied to 4.19/scsi-queue. Thanks! Thanks very much. BRs

Re: tcmu: fix hung netlink requests and nl related cleanup V2

2018-06-24 Thread Xiubo Li
are mainly for adding and removing cases. Tested-by: Xiubo Li BRs Xiubo -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCHv4 3/3] tcmu: add module wide action/reset_netlink support

2018-05-02 Thread Xiubo Li
On 2018/5/3 3:53, Mike Christie wrote: On 04/19/2018 02:46 AM, xiu...@redhat.com wrote: @@ -1572,13 +1579,16 @@ static int tcmu_wait_genl_cmd_reply(struct tcmu_dev *udev) if (udev->nl_reply_supported <= 0) return 0; + spin_lock(>nl_cmd_lock); +

Re: [PATCHv4 1/3] target/configfs: add module wide action support

2018-05-02 Thread Xiubo Li
On 2018/5/3 2:27, Mike Christie wrote: On 04/19/2018 02:46 AM, xiu...@redhat.com wrote: From: Xiubo Li <xiu...@redhat.com> For some case we need some module wide configfs to contol some attributes of the whole transport module. When I suggested to move it module wide I just meant

Re: [PATCHv4 1/3] target/configfs: add module wide action support

2018-05-02 Thread Xiubo Li
On 2018/5/3 2:27, Mike Christie wrote: On 04/19/2018 02:46 AM, xiu...@redhat.com wrote: From: Xiubo Li <xiu...@redhat.com> For some case we need some module wide configfs to contol some attributes of the whole transport module. When I suggested to move it module wide I just meant

Re: [PATCH 0/9] tcmu: configuration fixes and cleanups

2018-07-25 Thread Xiubo Li
On 2018/7/24 3:07, Mike Christie wrote: The following patches were made over Martin's for-next branch. The first patch fixes a locking bug in the command setup path. The rest of the patches fix several bugs and cleanup the setup and configuration code paths. It looks good to me. This is also

Re: [PATCH] tcmu: fix crash for dereferencing the released udev->mb_addr memory

2018-07-20 Thread Xiubo Li
On 2018/7/20 23:13, Mike Christie wrote: On 07/19/2018 07:34 PM, Xiubo Li wrote: On 2018/7/19 23:49, Mike Christie wrote: On 07/19/2018 09:30 AM, xiu...@redhat.com wrote: From: Xiubo Li The logs are: BUG: unable to handle kernel NULL pointer dereference at 0040 IP

Re: [PATCH] tcmu: allow userspace to reset netlink

2018-04-04 Thread Xiubo Li
On 2018/4/5 8:47, Mike Christie wrote: On 04/02/2018 06:42 AM, xiu...@redhat.com wrote: From: Xiubo Li <xiu...@redhat.com> This patch adds 1 tcmu attr to reset and complete all the blocked netlink waiting threads. It's used when the userspace daemon like tcmu-runner has crashed or

Re: [PATCH] tcmu: fix error resetting qfull_time_out to default

2018-04-10 Thread Xiubo Li
On 2018/4/9 19:44, Prasanna Kumar Kalever wrote: Problem: --- $ cat /sys/kernel/config/target/core/user_0/block/attrib/qfull_time_out -1 $ echo "-1" > /sys/kernel/config/target/core/user_0/block/attrib/qfull_time_out -bash: echo: write error: Invalid argument Fix: --- This patch will help

Re: [PATCHv2] tcmu: allow userspace to reset netlink

2018-04-13 Thread Xiubo Li
On 2018/4/14 1:21, Mike Christie wrote: On 04/12/2018 10:08 PM, Xiubo Li wrote: + +if (val != 1) { +pr_err("Invalid block value %d\n", val); I think you wanted "Invalid reset value %d\n" Yeah, just copied it from other place. +return -EINVAL; +

Re: [PATCHv2] tcmu: allow userspace to reset netlink

2018-04-12 Thread Xiubo Li
+ + if (val != 1) { + pr_err("Invalid block value %d\n", val); I think you wanted "Invalid reset value %d\n" Yeah, just copied it from other place. + return -EINVAL; + } + + spin_unlock(>nl_cmd_lock); Need spin_lock() instead of unlock. I

Re: [PATCHv3] tcmu: allow userspace to reset netlink

2018-04-17 Thread Xiubo Li
On 2018/4/18 0:40, Mike Christie wrote: Nick, Ignore this v3 too. It will not work for deletion. Yeah, for deletion the vfs will lock the file, so there is no any new access could in, will redesign and make it module wide. On 04/16/2018 07:43 AM, xiu...@redhat.com wrote: From: Xiubo Li

Re: [PATCH v3] scsi: tcmu: avoid cmd/qfull timers updated whenever a new cmd comes

2018-11-20 Thread Xiubo Li
On 2018/11/21 11:19, Mike Christie wrote: On 10/17/2018 02:54 AM, xiu...@redhat.com wrote: From: Xiubo Li [...] diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 9cd404a..00ed7bb 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target

Re: [PATCH v3] scsi: tcmu: avoid cmd/qfull timers updated whenever a new cmd comes

2018-11-21 Thread Xiubo Li
On 2018/11/22 0:37, Mike Christie wrote: On 11/20/2018 11:37 PM, Xiubo Li wrote: [...] -is_running = list_empty(>cmdr_queue_entry); +is_running = test_bit(TCMU_CMD_BIT_INFLIGHT, >flags); se_cmd = cmd->se_cmd; if (is_running) { @@ -1289,7 +1319,6 @@ s

Re: [PATCH] scsi: tcmu: setup one timeout timer for each cmd

2018-09-18 Thread Xiubo Li
On 2018/9/19 0:42, Mike Christie wrote: On 09/18/2018 05:32 AM, xiu...@redhat.com wrote: From: Xiubo Li Currently there has one cmd timeout timer for each udev, and whenever there has any new coming cmd it will update the timer. And for some corner case the timer is always working only