[PATCH 0/9] vhost: Support SIGKILL by flushing and exiting

2024-03-15 Thread Mike Christie
The following patches were made over Linus's tree and also apply over mst's vhost branch. The patches add the ability for vhost_tasks to handle SIGKILL by flushing queued works, stop new works from being queued, and prepare the task for an early exit. This removes the need for the signal/coredump

[PATCH 2/9] vhost-scsi: Handle vhost_vq_work_queue failures for cmds

2024-03-15 Thread Mike Christie
p the responses and free the command's resources. When all commands have completed then operations like flush will be woken up and we can complete device release and endpoint cleanup. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 13 - 1 file changed, 12 insertions(+),

[PATCH 4/9] vhost: Remove vhost_vq_flush

2024-03-15 Thread Mike Christie
vhost_vq_flush is no longer used so remove it. Signed-off-by: Mike Christie --- drivers/vhost/vhost.c | 12 drivers/vhost/vhost.h | 1 - 2 files changed, 13 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 045f666b4f12..cd79075da294 100644 --- a

[PATCH 3/9] vhost-scsi: Use system wq to flush dev for TMFs

2024-03-15 Thread Mike Christie
a concern. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 39 +++ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 6ec1abe7364f..04e0d3f1bd77 100644 --- a/drivers/vhost/scsi.c +++ b

[PATCH 1/9] vhost-scsi: Handle vhost_vq_work_queue failures for events

2024-03-15 Thread Mike Christie
or us when the vhost_task is killed and so userspace will not be able to handle events if we sent them. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 28

[PATCH 5/9] vhost_scsi: Handle vhost_vq_work_queue failures for TMFs

2024-03-15 Thread Mike Christie
nding commands/TMFs have sent their responses. In that case vhost_vq_work_queue can fail when we try to send a response. This has us just free the TMF's resources since at this time the guest won't be able to get a response even if we could send it. Signed-off-by: Mike Christie --- drivers/v

[PATCH 6/9] vhost: Use virtqueue mutex for swapping worker

2024-03-15 Thread Mike Christie
rkers instead of the vhost_dev one. Signed-off-by: Mike Christie --- drivers/vhost/vhost.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index cd79075da294..4252c3b827ca 100644 --- a/drivers/vhost/vhost.c

[PATCH 9/9] kernel: Remove signal hacks for vhost_tasks

2024-03-15 Thread Mike Christie
ce's close function was called. In the previous patches vhost_tasks and the vhost drivers were converted to support SIGKILL by cleaning themselves up and exiting. The hacks are no longer needed so this removes them. Signed-off-by: Mike Christie --- fs/coredump.c | 4 +--- kernel/exit.c |

[PATCH 7/9] vhost: Release worker mutex during flushes

2024-03-15 Thread Mike Christie
during a flush and the flush's work is still in the queue, the worker code that will handle the SIGKILL cleanup won't be able to take the mutex and perform it's cleanup. So this patch has us drop the worker mutex while waiting for the flush to complete. Signed-off-by: Mike Christi

[PATCH 8/9] vhost_task: Handle SIGKILL by flushing work and exiting

2024-03-15 Thread Mike Christie
. Signed-off-by: Mike Christie --- drivers/vhost/vhost.c| 54 +--- drivers/vhost/vhost.h| 2 ++ include/linux/sched/vhost_task.h | 3 +- kernel/vhost_task.c | 53 --- 4 files changed, 88 insertions(+), 24

Re: [PATCH 0/9] vhost: Support SIGKILL by flushing and exiting

2024-04-09 Thread Mike Christie
On 4/8/24 11:16 PM, Jason Wang wrote: >> It turns out only vhost-scsi had an issue where it would send a command >> to the block/LIO layer, wait for a response and then process in the vhost >> task. > Vhost-net TX zerocopy code did the same: > > It sends zerocopy packets to the under layer and wai

Re: [PATCH 0/9] vhost: Support SIGKILL by flushing and exiting

2024-04-11 Thread Mike Christie
On 4/11/24 3:39 AM, Jason Wang wrote: > On Sat, Mar 16, 2024 at 8:47 AM Mike Christie > wrote: >> >> The following patches were made over Linus's tree and also apply over >> mst's vhost branch. The patches add the ability for vhost_tasks to >> handle SI

Re: [PATCH 0/9] vhost: Support SIGKILL by flushing and exiting

2024-04-17 Thread Mike Christie
On 4/16/24 10:50 PM, Jason Wang wrote: > On Mon, Apr 15, 2024 at 4:52 PM Jason Wang wrote: >> >> On Sat, Apr 13, 2024 at 12:53 AM wrote: >>> >>> On 4/11/24 10:28 PM, Jason Wang wrote: >>>> On Fri, Apr 12, 2024 at 12:19 AM Mike Christie >>&g

[PATCH 7/8] vhost-scsi: Allocate iov_iter used for unaligned copies when needed

2024-10-08 Thread Mike Christie
along with the patches that removed the duplicated fields on the vhost_scsd_cmd allow us to reduce mem use by 1 MB in mid size setups where we have 16 virtqueues and are doing 1024 cmds per queue. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 26 +- 1 file c

[PATCH 5/8] vhost-scsi: Dynamically allocate scatterlists

2024-10-08 Thread Mike Christie
very fast (8 NVMe drives in a MD RAID0 config or a memory backed device). As a result this patch makes the dynamic allocation feature a modparam so userspace can decide how it wants to balance mem use and perf. Signed-off-by: Mike Christie --- drivers/vhost/Kconfig | 1 + drivers/vhost/scsi.c

[PATCH 6/8] vhost-scsi: Stop duplicating se_cmd fields

2024-10-08 Thread Mike Christie
this patch has stop duplicating the storing of SCSI values like lun, data dir, data len, cdb, etc on the vhost scsi command and just pass them to LIO which will store them on the se_cmd. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 95 +--- 1 file

[PATCH 1/8] vhost-scsi: Reduce mem use by moving upages to per queue

2024-10-08 Thread Mike Christie
K = 8 bytes per pointer * 2048 * 1 queue Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 24 ++-- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 006ffacf1c56..0cfa56d08450 100644 --- a/drivers/vhost/s

[PATCH 3/8] vhost-scsi: Add better resource allocation failure handling

2024-10-08 Thread Mike Christie
han we can handle. The initiator will then reduce how many commands it will send us and retry later. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/sc

[PATCH 2/8] vhost-scsi: Allocate T10 PI structs only when enabled

2024-10-08 Thread Mike Christie
: Mike Christie --- drivers/vhost/scsi.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 0cfa56d08450..776051577a5f 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -1648,12 +1648,14 @@ static int

[PATCH 4/8] vhost-scsi: Return queue full for page alloc failures during copy

2024-10-08 Thread Mike Christie
This has us return queue full if we can't allocate a page during the copy operation so the initiator can retry. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/s

[PATCH 8/8] vhost-scsi: Reduce response iov mem use

2024-10-08 Thread Mike Christie
t just be where they have the sense in a second iov but that doesn't seem likely as well. So to optimize for the common implementation, this has us only pre-allocate the single iovec. If we do hit the split up response case this has us allocate the needed iovec when needed. Signed-off-by: Mik

[PATCH v2 0/8] vhost-scsi: Memory reduction patches

2024-12-03 Thread Mike Christie
The following patches were made over Linus's tree and also apply over the mst vhost branch. They reduce the memory use for vhost-scsi. For a simple device with 1 queue and 128 cmds we use around 25 MB. These patches allow us to reduce that to 8.2 MB when supporting up to 128 8 MB IOs (the current

[PATCH v2 6/8] vhost-scsi: Stop duplicating se_cmd fields

2024-12-03 Thread Mike Christie
this patch has stop duplicating the storing of SCSI values like lun, data dir, data len, cdb, etc on the vhost scsi command and just pass them to LIO which will store them on the se_cmd. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 95 +--- 1 file

[PATCH v2 8/8] vhost-scsi: Reduce response iov mem use

2024-12-03 Thread Mike Christie
t just be where they have the sense in a second iov but that doesn't seem likely as well. So to optimize for the common implementation, this has us only pre-allocate the single iovec. If we do hit the split up response case this has us allocate the needed iovec when needed. Signed-off-by: Mik

[PATCH v2 2/8] vhost-scsi: Allocate T10 PI structs only when enabled

2024-12-03 Thread Mike Christie
: Mike Christie --- drivers/vhost/scsi.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index adb3cd47b4e3..99e008219e6c 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -1651,12 +1651,14 @@ static int

[PATCH v2 1/8] vhost-scsi: Reduce mem use by moving upages to per queue

2024-12-03 Thread Mike Christie
K = 8 bytes per pointer * 2048 * 1 queue Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 24 ++-- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 718fa4e0b31e..adb3cd47b4e3 100644 --- a/drivers/vhost/s

[PATCH v2 5/8] vhost-scsi: Dynamically allocate scatterlists

2024-12-03 Thread Mike Christie
very fast (8 NVMe drives in a MD RAID0 config or a memory backed device). As a result this patch makes the dynamic allocation feature a modparam so userspace can decide how it wants to balance mem use and perf. Signed-off-by: Mike Christie --- drivers/vhost/Kconfig | 1 + drivers/vhost/scsi.c

[PATCH v2 3/8] vhost-scsi: Add better resource allocation failure handling

2024-12-03 Thread Mike Christie
han we can handle. The initiator will then reduce how many commands it will send us and retry later. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/sc

[PATCH v2 7/8] vhost-scsi: Allocate iov_iter used for unaligned copies when needed

2024-12-03 Thread Mike Christie
along with the patches that removed the duplicated fields on the vhost_scsd_cmd allow us to reduce mem use by 1 MB in mid size setups where we have 16 virtqueues and are doing 1024 cmds per queue. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 26 +- 1 file c

[PATCH v2 4/8] vhost-scsi: Return queue full for page alloc failures during copy

2024-12-03 Thread Mike Christie
This has us return queue full if we can't allocate a page during the copy operation so the initiator can retry. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/s

[PATCH 1/1] vhost-scsi: Fix handling of multiple calls to vhost_scsi_set_endpoint

2025-01-21 Thread Mike Christie
quot;) Reported-by: Haoran Zhang Closes: https://lore.kernel.org/virtualization/e418a5ee-45ca-4d18-9b5d-6f8b6b1ad...@oracle.com/T/#me6c0041ce376677419b9b2563494172a01487ecb Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 20 +++- 1 file changed, 11 insertions(+

[PATCH v2 1/1] vhost-scsi: Fix handling of multiple calls to vhost_scsi_set_endpoint

2025-01-29 Thread Mike Christie
quot;) Reported-by: Haoran Zhang Closes: https://lore.kernel.org/virtualization/e418a5ee-45ca-4d18-9b5d-6f8b6b1ad...@oracle.com/T/#me6c0041ce376677419b9b2563494172a01487ecb Signed-off-by: Mike Christie Reviewed-by: Stefan Hajnoczi --- v2 - Drop kfree that's no longer needed. - Update comment

Re: [PATCH 1/1] vhost-scsi: Fix handling of multiple calls to vhost_scsi_set_endpoint

2025-01-29 Thread Mike Christie
On 1/29/25 10:36 AM, Stefano Garzarella wrote: >> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c >> index 9a4cbdc607fa..6bb64f3be7db 100644 >> --- a/drivers/vhost/scsi.c >> +++ b/drivers/vhost/scsi.c >> @@ -1828,14 +1828,19 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, >>     } >>

[PATCH] vhost-scsi: Fix log flooding with target does not exist errors

2025-06-07 Thread Mike Christie
thor forgot to enable the vq_err call (vq_err is implemented by pr_debug which defaults to off). So this patch removes the call since it's expected to hit this path during device discovery. Fixes: 09d7583294aa ("vhost/scsi: Use common handling code in request queue handler") Signed-o

Re: [PATCH] vhost-scsi: Fix log flooding with target does not exist errors

2025-06-11 Thread Mike Christie
On 6/11/25 2:50 AM, Stefano Garzarella wrote: > On Tue, Jun 10, 2025 at 11:30:58AM -0500, michael.chris...@oracle.com wrote: >> On 6/10/25 9:18 AM, Stefano Garzarella wrote: >>> On Sat, Jun 07, 2025 at 12:18:15PM -0500, Mike Christie wrote: >>>> As part of the norm

[PATCH 1/1] vhost-scsi: Fix log flooding with target does not exist errors

2025-06-11 Thread Mike Christie
all and I'm guessing the patch author forgot to enable the vq_err call (vq_err is implemented by pr_debug which defaults to off). So this patch removes the call since it's expected to hit this path during device discovery. Fixes: 09d7583294aa ("vhost/scsi: Use common handling code in