Re: [patch] vhost/scsi: potential memory corruption

2015-02-06 Thread Nicholas A. Bellinger
On Thu, 2015-02-05 at 10:37 +0300, Dan Carpenter wrote: This code in vhost_scsi_make_tpg() is confusing because we limit tpgt to UINT_MAX but the data type of tpg-tport_tpgt and that is a u16. I looked at the context and it turns out that in vhost_scsi_set_endpoint(), tpg-tport_tpgt is used

[PATCH-v4 8/8] vhost/scsi: Global tcm_vhost - vhost_scsi rename

2015-02-05 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org There is a large amount of code that still references the original 'tcm_vhost' naming conventions, instead of modern 'vhost_scsi'. Go ahead and do a global rename to make the usage consistent. Cc: Michael S. Tsirkin m...@redhat.com Acked-by: Michael

[PATCH-v4 1/8] vhost/scsi: Convert completion path to use copy_to_iter

2015-02-05 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Required for ANY_LAYOUT support when the incoming virtio-scsi response header + fixed size sense buffer payload may span more than a single iovec entry. This changes existing code to save cmd-tvc_resp_iov instead of the first single iovec base

[PATCH-v4 7/8] vhost/scsi: Drop left-over scsi_tcq.h include

2015-02-05 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org With the recent removal of MSG_*_TAG defines in commit 68d81f40, vhost-scsi is now using TCM_*_TAG and doesn't depend upon host side scsi_tcq.h definitions anymore. Cc: Michael S. Tsirkin m...@redhat.com Acked-by: Michael S. Tsirkin m...@redhat.com

[PATCH-v4 6/8] vhost/scsi: Set VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits

2015-02-05 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Signal support of VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits required for virtio-scsi 1.0 spec layout requirements. Cc: Michael S. Tsirkin m...@redhat.com Acked-by: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com

[PATCH-v4 2/8] vhost/scsi: Fix incorrect early vhost_scsi_handle_vq failures

2015-02-05 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch fixes vhost_scsi_handle_vq() failure cases that result in BUG_ON() getting triggered when vhost_scsi_free_cmd() is called, and -tvc_se_cmd has not been initialized by target_submit_cmd_map_sgls(). It changes tcm_vhost_release_cmd() to use

[PATCH-v4 5/8] vhost/scsi: Add ANY_LAYOUT support in vhost_scsi_handle_vq

2015-02-05 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds ANY_LAYOUT compatible support within the existing vhost_scsi_handle_vq() -handle_kick() callback. It calculates data_direction + exp_data_len for the new tcm_vhost_cmd descriptor by walking both outgoing + incoming iovecs using

[PATCH-v4 3/8] vhost/scsi: Change vhost_scsi_map_to_sgl to accept iov ptr + len

2015-02-05 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch changes vhost_scsi_map_to_sgl() parameters to accept virtio iovec ptr + len when determing pages_nr. This is currently done with iov_num_pages() - PAGE_ALIGN, so allow the same parameters as well. Cc: Michael S. Tsirkin m...@redhat.com Cc

[PATCH-v4 0/8] vhost/scsi: Add ANY_LAYOUT + VERSION_1 support

2015-02-05 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Hi MST, Paolo, Al Co, Here is v4 patch series for vhost/scsi ANY_LAYOUT + VERSION_1 support. It updates vhost_virtqueue-handle_kick() - vhost_scsi_handle_vq() callback code to determine the start of protection + data payloads iovecs past

[PATCH-v4 4/8] vhost/scsi: Add ANY_LAYOUT iov - sgl mapping prerequisites

2015-02-05 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds ANY_LAYOUT prerequisites logic for accepting a set of protection + data payloads via iov_iter. Also includes helpers for calcuating SGLs + invoking vhost_scsi_map_to_sgl() with a known number of iovecs. Required by ANY_LAYOUT

Re: [PATCH-v3 7/9] vhost/scsi: Drop legacy pre virtio v1.0 !ANY_LAYOUT logic

2015-02-04 Thread Nicholas A. Bellinger
On Tue, 2015-02-03 at 11:37 +0200, Michael S. Tsirkin wrote: On Tue, Feb 03, 2015 at 06:30:01AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org With the new ANY_LAYOUT logic in place for vhost_scsi_handle_vqal(), there is no longer a reason to keep

Re: [PATCH-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-04 Thread Nicholas A. Bellinger
On Tue, 2015-02-03 at 12:14 +0200, Michael S. Tsirkin wrote: On Tue, Feb 03, 2015 at 06:29:59AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org This patch adds ANY_LAYOUT support with a new vqs[].vq.handle_kick() callback in vhost_scsi_handle_vqal

Re: [PATCH-v3 1/9] vhost/scsi: Convert completion path to use copy_to_iser

2015-02-04 Thread Nicholas A. Bellinger
On Tue, 2015-02-03 at 11:24 +0200, Michael S. Tsirkin wrote: On Tue, Feb 03, 2015 at 06:29:55AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org Required for ANY_LAYOUT support when the incoming virtio-scsi response header + fixed size sense buffer

Re: [PATCH-v3 4/9] vhost/scsi: Add ANY_LAYOUT iov - sgl mapping prerequisites

2015-02-04 Thread Nicholas A. Bellinger
On Tue, 2015-02-03 at 11:32 +0200, Michael S. Tsirkin wrote: On Tue, Feb 03, 2015 at 06:29:58AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org This patch adds ANY_LAYOUT prerequisites logic for accepting a set of protection + data payloads via iov_iter

Re: [PATCH-v3 0/9] vhost/scsi: Add ANY_LAYOUT + VERSION_1 support

2015-02-04 Thread Nicholas A. Bellinger
On Tue, 2015-02-03 at 11:35 +0200, Michael S. Tsirkin wrote: On Tue, Feb 03, 2015 at 06:29:54AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org Hi MST, Paolo, Al Co, Here is -v3 for adding vhost/scsi ANY_LAYOUT + VERSION_1 host feature bit support

Re: [PATCH-v3 6/9] vhost/scsi: Set VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits

2015-02-04 Thread Nicholas A. Bellinger
On Tue, 2015-02-03 at 11:40 +0200, Michael S. Tsirkin wrote: On Tue, Feb 03, 2015 at 06:30:00AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org Signal support of VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits required for virtio-scsi 1.0 spec

Re: [PATCH-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-04 Thread Nicholas A. Bellinger
On Tue, 2015-02-03 at 23:56 +, Al Viro wrote: On Tue, Feb 03, 2015 at 06:29:59AM +, Nicholas A. Bellinger wrote: +* Copy over the virtio-scsi request header, which when +* ANY_LAYOUT is enabled may span multiple iovecs, or a +* single iovec may

Re: [PATCH-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-04 Thread Nicholas A. Bellinger
On Wed, 2015-02-04 at 11:20 +0100, Michael S. Tsirkin wrote: On Wed, Feb 04, 2015 at 02:11:20AM -0800, Nicholas A. Bellinger wrote: On Tue, 2015-02-03 at 23:56 +, Al Viro wrote: On Tue, Feb 03, 2015 at 06:29:59AM +, Nicholas A. Bellinger wrote: +* Copy over

Re: [PATCH-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-04 Thread Nicholas A. Bellinger
On Wed, 2015-02-04 at 10:42 +0100, Michael S. Tsirkin wrote: On Wed, Feb 04, 2015 at 01:40:25AM -0800, Nicholas A. Bellinger wrote: + /* +* Any associated T10_PI bytes for the outgoing / incoming +* payloads are included

Re: [PATCH-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-04 Thread Nicholas A. Bellinger
On Wed, 2015-02-04 at 02:41 -0800, Nicholas A. Bellinger wrote: On Wed, 2015-02-04 at 10:42 +0100, Michael S. Tsirkin wrote: On Wed, Feb 04, 2015 at 01:40:25AM -0800, Nicholas A. Bellinger wrote: + /* + * Any associated T10_PI bytes for the outgoing

Re: [PATCH v2 18/18] vhost: vhost_scsi_handle_vq() should just use copy_from_user()

2015-02-02 Thread Nicholas A. Bellinger
...@redhat.com Cc: Nicholas A. Bellinger n...@linux-iscsi.org Cc: kvm@vger.kernel.org Signed-off-by: Al Viro v...@zeniv.linux.org.uk --- drivers/vhost/scsi.c | 2 +- include/linux/uio.h | 2 -- lib/Makefile | 2 +- lib/iovec.c | 36 4 files

Re: [PATCH 0/8] vhost/scsi: Add ANY_LAYOUT support

2015-02-02 Thread Nicholas A. Bellinger
On Mon, 2015-02-02 at 00:15 -0800, Christoph Hellwig wrote: Hi Nic, Al has been rewriting the vhost code to use iov_iter primitives, can you please rebase it on top of that istead of using the obsolete infrastructure? Yep, already done with the copy_[from,to]_iter() conversion in

Re: [target:for-next 16/21] drivers/vhost/scsi.c:1081:5: sparse: symbol 'vhost_skip_iovec_bytes' was not declared. Should it be static?

2015-02-02 Thread Nicholas A. Bellinger
On Mon, 2015-02-02 at 14:25 +0800, kbuild test robot wrote: tree: git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git for-next head: 2936f1d4f3e8247bd519feba7892371d5e4c6603 commit: 105acf608f25d5e0d9fef669299a5438b7b114ee [16/21] vhost/scsi: Add ANY_LAYOUT

[PATCH-v3 9/9] vhost/scsi: Global tcm_vhost - vhost_scsi rename

2015-02-02 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org There is a large amount of code that still references the original 'tcm_vhost' naming conventions, instead of modern 'vhost_scsi'. Go ahead and do a global rename to make the usage consistent. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini

[PATCH-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-02 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds ANY_LAYOUT support with a new vqs[].vq.handle_kick() callback in vhost_scsi_handle_vqal(). It calculates data_direction + exp_data_len for the new tcm_vhost_cmd descriptor by walking both outgoing + incoming iovecs using iov_iter

[PATCH-v3 3/9] vhost/scsi: Change vhost_scsi_map_to_sgl to accept iov ptr + len

2015-02-02 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch changes vhost_scsi_map_to_sgl() parameters to accept virtio iovec ptr + len when determing pages_nr. This is currently done with iov_num_pages() - PAGE_ALIGN, so allow the same parameters as well. Cc: Michael S. Tsirkin m...@redhat.com Cc

[PATCH-v3 2/9] vhost/scsi: Fix incorrect early vhost_scsi_handle_vq failures

2015-02-02 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch fixes vhost_scsi_handle_vq() failure cases that result in BUG_ON() getting triggered when vhost_scsi_free_cmd() is called, and -tvc_se_cmd has not been initialized by target_submit_cmd_map_sgls(). It changes tcm_vhost_release_cmd() to use

[PATCH-v3 1/9] vhost/scsi: Convert completion path to use copy_to_iser

2015-02-02 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Required for ANY_LAYOUT support when the incoming virtio-scsi response header + fixed size sense buffer payload may span more than a single iovec entry. This changes existing code to save cmd-tvc_resp_iov instead of the first single iovec base

[PATCH-v3 4/9] vhost/scsi: Add ANY_LAYOUT iov - sgl mapping prerequisites

2015-02-02 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds ANY_LAYOUT prerequisites logic for accepting a set of protection + data payloads via iov_iter. Also includes helpers for calcuating SGLs + invoking vhost_scsi_map_to_sgl() with a known number of iovecs. Required by ANY_LAYOUT

[PATCH-v3 8/9] vhost/scsi: Drop left-over scsi_tcq.h include

2015-02-02 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org With the recent removal of MSG_*_TAG defines in commit 68d81f40, vhost-scsi is now using TCM_*_TAG and doesn't depend upon host side scsi_tcq.h definitions anymore. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Signed

[PATCH-v3 0/9] vhost/scsi: Add ANY_LAYOUT + VERSION_1 support

2015-02-02 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Hi MST, Paolo, Al Co, Here is -v3 for adding vhost/scsi ANY_LAYOUT + VERSION_1 host feature bit support. It adds a new vhost_virtqueue -handle_kick() callback to determine the start of protection and data payloads iovecs past starting virtio-scsi

[PATCH-v2 06/11] vhost/scsi: Add ANY_LAYOUT vhost_skip_iovec_bytes helper

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a vhost_skip_iovec_bytes() helper for skipping ahead a number of bytes into the passed *iov_in + off_in, saving the current **iov_out + off_out so it may be used by the caller. This is useful for virtio-scsi READs when needing to skip

[PATCH-v2 11/11] vhost/scsi: Global tcm_vhost - vhost_scsi rename

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org There is a large amount of code that still references the original 'tcm_vhost' naming conventions, instead of modern 'vhost_scsi'. Go ahead and do a global rename to make the usage consistent. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini

[PATCH-v2 08/11] vhost/scsi: Set VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Signal support of VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits required for virtio-scsi 1.0 spec layout requirements. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Nicholas Bellinger n...@linux

[PATCH-v2 07/11] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds ANY_LAYOUT support with a new vqs[].vq.handle_kick() callback in vhost_scsi_handle_vqal(). It calculates data_direction + exp_data_len for the new tcm_vhost_cmd descriptor by walking both outgoing + incoming iovecs, assuming

[PATCH-v2 04/11] vhost/scsi: Change vhost_scsi_map_to_sgl to accept iov ptr + len

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch changes vhost_scsi_map_to_sgl() parameters to accept virtio iovec ptr + len when determing pages_nr. This is currently done with iov_num_pages() - PAGE_ALIGN, so allow the same parameters as well. Cc: Michael S. Tsirkin m...@redhat.com Cc

[PATCH-v2 03/11] vhost/scsi: Fix incorrect early vhost_scsi_handle_vq failures

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch fixes vhost_scsi_handle_vq() failure cases that result in BUG_ON() getting triggered when vhost_scsi_free_cmd() is called, and -tvc_se_cmd has not been initialized by target_submit_cmd_map_sgls(). It changes tcm_vhost_release_cmd() to use

[PATCH-v2 00/11] vhost/scsi: Add ANY_LAYOUT + VERSION_1 support

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Hi MST, Paolo, Co, This -v2 series adds vhost/scsi ANY_LAYOUT + VERSION_1 host feature bit support. It adds a new vhost_virtqueue -handle_kick() callback to determine the start of protection and data payloads iovecs past starting virtio-scsi

[PATCH-v2 01/11] lib/iovec: Add memcpy_fromiovec_out library function

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a new memcpy_fromiovec_out() library function which modifies the passed *iov following memcpy_fromiovec(), but also returns the next current iovec pointer via **iov_out. This is useful for vhost ANY_LAYOUT support when guests

[PATCH-v2 10/11] vhost/scsi: Drop left-over scsi_tcq.h include

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org With the recent removal of MSG_*_TAG defines in commit 68d81f40, vhost-scsi is now using TCM_*_TAG and doesn't depend upon host side scsi_tcq.h definitions anymore. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Signed

[PATCH-v2 05/11] vhost/scsi: Add ANY_LAYOUT iov - sgl mapping prerequisites

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds ANY_LAYOUT prerequisites logic for accepting a set of protection + data payloads via iovec + offset. Also includes helpers for calcuating SGLs + invoking vhost_scsi_map_to_sgl() with a known number of iovecs. Required by ANY_LAYOUT

[PATCH-v2 02/11] vhost/scsi: Convert completion path to use memcpy_toiovecend

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Required for ANY_LAYOUT support when the incoming virtio-scsi response header + fixed size sense buffer payload may span more than a single iovec entry. This changes existing code to save cmd-tvc_resp_iod instead of the first single iovec base

[PATCH-v2 09/11] vhost/scsi: Drop legacy pre virtio v1.0 !ANY_LAYOUT logic

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org With the new ANY_LAYOUT logic in place for vhost_scsi_handle_vqal(), there is no longer a reason to keep around the legacy code with !ANY_LAYOUT assumptions. Go ahead and drop the pre virtio 1.0 logic in vhost_scsi_handle_vq() and associated helpers

Re: [PATCH 1/8] lib/iovec: Add memcpy_fromiovec_out library function

2015-01-31 Thread Nicholas A. Bellinger
On Fri, 2015-01-30 at 10:33 +0100, Paolo Bonzini wrote: On 30/01/2015 09:12, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a new memcpy_fromiovec_out() library function which modifies the passed *iov following memcpy_fromiovec(), but also

Re: [PATCH 4/8] vhost/scsi: Change vhost_scsi_map_to_sgl to accept iov ptr + len

2015-01-31 Thread Nicholas A. Bellinger
On Fri, 2015-01-30 at 12:51 +0200, Michael S. Tsirkin wrote: On Fri, Jan 30, 2015 at 08:12:28AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org This patch changes vhost_scsi_map_to_sgl() parameters to accept virtio iovec ptr + len when determing pages_nr

[PATCH 2/3] vhost/scsi: Add VIRTIO_SCSI_F_T10_PI host_feature bit

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org --- hw/scsi/vhost-scsi.c| 1 + hw/scsi/virtio-scsi.c | 3 +++ hw/virtio/virtio-pci.c | 2 ++ include/hw/i386/pc.h| 13 - include/hw

[PATCH 0/3] vhost/scsi: Enable virtio 1.0 host_feature bits

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Hi MST Paolo, Here are the associated QEMU vhost/scsi changes to enable KVM host for expose F_HOTPLUG, F_T10_PI, and ANY_LAYOUT feature bits into virtio 1.0 compatible guests. Note this does not include VIRTIO_SCSI_F_CHANGE, which is currently

[PATCH 3/3] vhost/scsi: Add VIRTIO_F_ANY_LAYOUT host_feature bit

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org --- hw/scsi/vhost-scsi.c | 1 + hw/virtio/virtio-pci.c | 2 ++ include/hw/i386/pc.h | 5 + 3 files changed, 8 insertions(+) diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index

[PATCH 1/3] vhost/scsi: Add VIRTIO_SCSI_F_HOTPLUG host_feature bit

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org --- hw/virtio/virtio-pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio

[PATCH 7/8] vhost/scsi: Add ANY_LAYOUT support

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds initial ANY_LAYOUT support with a new vhost_virtqueue callback in vhost_scsi_handle_vqal(). It calculates data_direction + exp_data_len for the new tcm_vhost_cmd descriptor by walking both outgoing + incoming iovecs, assuming

[PATCH 3/8] vhost/scsi: Fix incorrect early vhost_scsi_handle_vq failures

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch fixes vhost_scsi_handle_vq() failure cases that result in BUG_ON() getting triggered when vhost_scsi_free_cmd() is called, and -tvc_se_cmd has not been initialized by target_submit_cmd_map_sgls(). It changes tcm_vhost_release_cmd() to use

[PATCH 5/8] vhost/scsi: Add common vhost_scsi_queue_desc code

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Move logic for typical vhost_scsi_handle_vq() - tcm_vhost_workqueue - tcm_vhost_submission_work() dispatch into vhost_scsi_queue_desc(). Can be shared by vhost_scsi_handle_vqal() code. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz

[PATCH 6/8] vhost/scsi: Add ANY_LAYOUT prerequisites

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds ANY_LAYOUT prerequisites logic for accepting a set of protection + data payloads via iovec + offset. Also includes helpers for calcuating SGLs + invoking vhost_scsi_map_to_sgl() with a known number of iovecs. Required by ANY_LAYOUT

[PATCH 0/8] vhost/scsi: Add ANY_LAYOUT support

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Hi MST Paolo, The series adds initial vhost/scsi ANY_LAYOUT layout support. It assumes request/CDB and response/sense_buffer headers may span more than a single iovec using lib/iovec.c logic, along with a new addition of memcpy_fromiovec_out

[PATCH 1/8] lib/iovec: Add memcpy_fromiovec_out library function

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a new memcpy_fromiovec_out() library function which modifies the passed *iov following memcpy_fromiovec(), but also returns the next current iovec pointer via **iov_out. This is useful for vhost ANY_LAYOUT support when guests

[PATCH 4/8] vhost/scsi: Change vhost_scsi_map_to_sgl to accept iov ptr + len

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch changes vhost_scsi_map_to_sgl() parameters to accept virtio iovec ptr + len when determing pages_nr. This is currently done with iov_num_pages() - PAGE_ALIGN, so allow the same parameters as well. Cc: Michael S. Tsirkin m...@redhat.com Cc

[PATCH 8/8] vhost/scsi: Set VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Signal support of VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits required for virtio-scsi 1.0 spec layout requirements. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Nicholas Bellinger n...@linux

[PATCH 2/8] vhost/scsi: Convert completion path to use memcpy_toiovecend

2015-01-30 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Required for ANY_LAYOUT support when the incoming virtio-scsi response header + fixed size sense buffer payload may span more than a single iovec entry. This changes existing code to save cmd-tvc_resp_iod instead of the first single iovec base

vhost-scsi support for ANY_LAYOUT

2015-01-26 Thread Nicholas A. Bellinger
Hi MST Paolo, So I'm currently working on vhost-scsi support for ANY_LAYOUT, and wanted to verify some assumptions based upon your earlier emails.. *) When ANY_LAYOUT is negotiated by vhost-scsi, it's expected that virtio-scsi request + response headers will (always..?) be within a single

Re: [PATCH] vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT

2014-10-21 Thread Nicholas A. Bellinger
Hey Paolo, On Thu, 2014-10-09 at 12:49 +0200, Paolo Bonzini wrote: Il 09/10/2014 10:49, Paolo Bonzini ha scritto: It does not happen if you close QEMU with SIGTERM, ctrl-c, or with the quit command, because no attempt is done to bring down the VM data structures (or free memory, or

[PATCH] vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT

2014-10-08 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch addresses a bug where individual vhost-scsi configfs endpoint groups can be removed from below while active exports to QEMU userspace still exist, resulting in an OOPs. It adds a configfs_depend_item() in vhost_scsi_set_endpoint

Re: [PATCH] vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT

2014-10-08 Thread Nicholas A. Bellinger
Hi MST Co, Quick question below wrt to this patch.. On Thu, 2014-10-09 at 03:34 +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org This patch addresses a bug where individual vhost-scsi configfs endpoint groups can be removed from below while active exports

Re: [PATCH] vhost-scsi: don't open-code kvfree

2014-06-12 Thread Nicholas A. Bellinger
On Thu, 2014-06-12 at 19:02 +0300, Michael S. Tsirkin wrote: Now that we have kvfree, use it in vhost-scsi instead of the open-coded version. Cc: Nicholas Bellinger n...@linux-iscsi.org Signed-off-by: Michael S. Tsirkin m...@redhat.com --- I have this queued for -rc2. Nicholas could you

[RFCv2 1/7] virtio-scsi.h: Add virtio_scsi_cmd_req_pi header definition

2014-03-17 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a virtio_scsi_cmd_req_pi header as recommened by Paolo that contains do_pi_niov + di_pi_niov elements used for signaling when protection information buffers are expected to preceed the data buffers. Cc: Paolo Bonzini pbonz

[RFCv2 0/7] vhost/scsi: Add T10 PI SGL passthrough support

2014-03-17 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Hi MST, MKP, Paolo Co, This is an updated -v2 series for adding T1O protection information (PI) SGL passthrough support between virtio-scsi LLD + vhost-scsi fabric endpoints. The patch series is available at: git://git.kernel.org/pub/scm/linux

Re: [RFCv2 5/7] vhost/scsi: Enable T10 PI IOV - SGL memory mapping

2014-03-17 Thread Nicholas A. Bellinger
On Mon, 2014-03-17 at 12:02 +0100, Paolo Bonzini wrote: Il 17/03/2014 06:32, Nicholas A. Bellinger ha scritto: + if (vq-iov[0].iov_len == sizeof(v_req_pi)) { + req = (unsigned char *)v_req_pi; + target = v_req_pi.lun[1

[RFCv2 6/7] vhost/scsi: Add new VIRTIO_SCSI_F_T10_PI feature bit

2014-03-16 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a VIRTIO_SCSI_F_T10_PI feature bit for signaling host support of accepting T10 protection information SGLs from virtio-scsi guest. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Martin K. Petersen

[RFCv2 2/7] vhost/scsi: Move sanity check into vhost_scsi_map_iov_to_sgl

2014-03-16 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Move the overflow check for sgl_count TCM_VHOST_PREALLOC_SGLS into vhost_scsi_map_iov_to_sgl() so that it's based on the total number of SGLs for all IOVs, instead of single IOVs. Also, rename TCM_VHOST_PREALLOC_PAGES - TCM_VHOST_PREALLOC_UPAGES

[RFCv2 7/7] virtio-scsi: Enable DIF/DIX modes in SCSI host LLD

2014-03-16 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch updates virtscsi_probe() to setup necessary Scsi_Host level protection resources. (currently hardcoded to 1) It changes virtscsi_add_cmd() to attach outgoing / incoming protection SGLs preceeding the data payload, and is using the new

[RFCv2 3/7] vhost/scsi: Add preallocation of protection SGLs

2014-03-16 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch updates tcm_vhost_make_nexus() to pre-allocate per descriptor tcm_vhost_cmd-tvc_prot_sgl[] used to expose protection SGLs from within virtio-scsi guest memory to vhost-scsi. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz

[RFCv2 5/7] vhost/scsi: Enable T10 PI IOV - SGL memory mapping

2014-03-16 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch updates vhost_scsi_handle_vq() to check for the existance of virtio_scsi_cmd_req_pi comparing vq-iov[0].iov_len in order to calculate seperate data + protection SGLs from data_num. Also update tcm_vhost_submission_work() to pass the pre

[RFCv2 4/7] vhost/scsi: Add T10 PI IOV - SGL memory mapping logic

2014-03-16 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds vhost_scsi_map_iov_to_prot() to perform the mapping of T10 data integrity memory between virtio iov + struct scatterlist using get_user_pages_fast() following existing code. As with vhost_scsi_map_iov_to_sgl(), this does sanity checks

Re: [RFC 0/6] vhost/scsi: Add T10 PI SGL passthrough support

2014-02-24 Thread Nicholas A. Bellinger
On Mon, 2014-02-24 at 11:23 +0100, Paolo Bonzini wrote: Il 24/02/2014 06:32, Nicholas A. Bellinger ha scritto: AFAICT up until this point the -prio field has been unused, but I'm certainly open to better ways of signaling (to vhost) that some number of metadata iovs are to be expected

[RFC 4/6] vhost/scsi: Enable T10 PI IOV - SGL memory mapping

2014-02-23 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch updates vhost_scsi_handle_vq() to calculate a data_niov + prot_niov currently based upon virtio_scsi_cmd_req-prio for figuring out many of seperate data + protection SGLs to expect from data_num. Also update tcm_vhost_submission_work

[RFC 5/6] vhost/scsi: Add new VIRTIO_SCSI_F_T10_PI feature bit

2014-02-23 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a VIRTIO_SCSI_F_T10_PI feature bit for signaling host support of accepting T10 protection information SGLs from virtio-scsi guest. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Martin K. Petersen

[RFC 3/6] vhost/scsi: Add T10 PI IOV - SGL memory mapping logic

2014-02-23 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds vhost_scsi_map_iov_to_prot() to perform the mapping of T10 data integrity memory between virtio iov + struct scatterlist using get_user_pages_fast() following existing code. As with vhost_scsi_map_iov_to_sgl(), this does sanity checks

[RFC 0/6] vhost/scsi: Add T10 PI SGL passthrough support

2014-02-23 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Hi MST, MKP, Paolo Co, The following is an initial RFC series for allowing vhost/scsi to accept T10 protection information (PI) as seperate SGLs along side existing data payload SGLs from within virtio-scsi guest memory. In it's current form, both

[RFC 2/6] vhost/scsi: Add preallocation of protection SGLs

2014-02-23 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch updates tcm_vhost_make_nexus() to pre-allocate per descriptor tcm_vhost_cmd-tvc_prot_sgl[] used to expose protection SGLs from within virtio-scsi guest memory to vhost-scsi. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz

[RFC 6/6] virtio-scsi: Enable DIF/DIX modes in SCSI host LLD

2014-02-23 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch updates virtscsi_probe() to setup all necessary Scsi_Host level protection resources necessary to enable DIF on virtio-scsi - vhost-scsi LUNs. Currently hardcoded to 1. It changes virtscsi_add_cmd() so that outgoing / incoming protection

[RFC 1/6] vhost/scsi: Move sanity check into vhost_scsi_map_iov_to_sgl

2014-02-23 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Move the overflow check for sgl_count TCM_VHOST_PREALLOC_SGLS into vhost_scsi_map_iov_to_sgl() so that it's based on the total number of SGLs for all IOVs, instead of single IOVs. Also, rename TCM_VHOST_PREALLOC_PAGES - TCM_VHOST_PREALLOC_UPAGES

Re: MSI interrupt support with vioscsi.c miniport driver

2014-02-19 Thread Nicholas A. Bellinger
On Wed, 2014-02-19 at 19:03 +1100, Vadim Rozenfeld wrote: On Tue, 2014-02-18 at 13:00 -0800, Nicholas A. Bellinger wrote: On Mon, 2014-02-10 at 11:05 -0800, Nicholas A. Bellinger wrote: SNIP Hi Yan, So recently I've been doing some KVM guest performance comparisons

Re: MSI interrupt support with vioscsi.c miniport driver

2014-02-18 Thread Nicholas A. Bellinger
On Mon, 2014-02-10 at 11:05 -0800, Nicholas A. Bellinger wrote: SNIP Hi Yan, So recently I've been doing some KVM guest performance comparisons between the scsi-mq prototype using virtio-scsi + vhost-scsi, and Windows Server 2012 with vioscsi.sys (virtio-win-0.1-74.iso

Re: MSI interrupt support with vioscsi.c miniport driver

2014-02-18 Thread Nicholas A. Bellinger
On Tue, 2014-02-18 at 13:00 -0800, Nicholas A. Bellinger wrote: On Mon, 2014-02-10 at 11:05 -0800, Nicholas A. Bellinger wrote: SNIP Hi Yan, So recently I've been doing some KVM guest performance comparisons between the scsi-mq prototype using virtio-scsi + vhost-scsi

Re: MSI interrupt support with vioscsi.c miniport driver

2014-02-10 Thread Nicholas A. Bellinger
Hi Vadim Yan, On Sun, 2014-02-09 at 22:35 +1100, Vadim Rozenfeld wrote: On Sun, 2014-02-09 at 11:24 +0200, Yan Vugenfirer wrote: Hi Nicholas, Adding Vadim Rozenfeld who wrote the virtio-scsi driver. Best regards, Yan. On Feb 7, 2014, at 10:14 PM, Nicholas A. Bellinger n

MSI interrupt support with vioscsi.c miniport driver

2014-02-07 Thread Nicholas A. Bellinger
Hi Yan, So recently I've been doing some KVM guest performance comparisons between the scsi-mq prototype using virtio-scsi + vhost-scsi, and Windows Server 2012 with vioscsi.sys (virtio-win-0.1-74.iso) + vhost-scsi using PCIe flash backend devices. I've noticed that small block random

[PATCH] vhost/scsi: Fix incorrect usage of get_user_pages_fast write parameter

2013-10-25 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch addresses a long-standing bug where the get_user_pages_fast() write parameter used for setting the underlying page table entry permission bits was incorrectly set to write=1 for data_direction=DMA_TO_DEVICE, and passed

Re: [PATCH] percpu ida: Switch to cpumask_t, add some comments

2013-08-30 Thread Nicholas A. Bellinger
On Wed, 2013-08-28 at 14:36 -0700, Andrew Morton wrote: On Wed, 28 Aug 2013 14:23:58 -0700 Kent Overstreet k...@daterainc.com wrote: I found things to be quite the opposite - it took 5 minutes of staring, head-scratching, double-checking and penny-dropping before I was confident that

Re: updated: kvm PCI todo wiki

2013-08-22 Thread Nicholas A. Bellinger
On Wed, 2013-08-21 at 14:45 +0200, Hannes Reinecke wrote: On 08/21/2013 12:48 PM, Michael S. Tsirkin wrote: Hey guys, I've put up a wiki page with a kvm PCI todo list, mainly to avoid effort duplication, but also in the hope to draw attention to what I think we should try addressing in

Re: Oracle RAC in libvirt+KVM environment

2013-08-21 Thread Nicholas A. Bellinger
On Wed, 2013-08-21 at 11:09 +0200, Paolo Bonzini wrote: Il 21/08/2013 04:11, Timon Wang ha scritto: From the fedora 19 host: [root@fedora ~]# sg_inq /dev/sdc standard INQUIRY: PQual=0 Device_type=0 RMB=0 version=0x05 [SPC-3] [AERC=0] [TrmTsk=0] NormACA=0 HiSUP=0

[PATCH-v3 0/4] target/vhost-scsi: Add per-cpu ida tag pre-allocation for v3.12

2013-08-16 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Hi folks, This is an updated series for adding tag pre-allocation support of target fabric descriptor memory, utilizing Kent's latest per-cpu ida bits here, along with Christoph Lameter's latest comments: [PATCH 04/10] idr: Percpu ida http

[PATCH-v3 1/4] idr: Percpu ida

2013-08-16 Thread Nicholas A. Bellinger
a...@firstfloor.org Cc: Jens Axboe ax...@kernel.dk Cc: Nicholas A. Bellinger n...@linux-iscsi.org Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org --- include/linux/idr.h | 53 + lib/idr.c | 316 +-- 2 files changed, 361 insertions(+), 8

[PATCH-v3 3/4] vhost/scsi: Convert to per-cpu ida_alloc + ida_free command map

2013-08-16 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch changes vhost/scsi to use transport_init_session_tags() pre-allocation logic for per-cpu session tag pooling with internal ida_alloc() + ida_free() calls based upon the saved se_cmd-map_tag id. FIXME: Make transport_init_session_tags

[PATCH-v3 2/4] target: Add transport_init_session_tags using per-cpu ida

2013-08-16 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds lib/idr.c based transport_init_session_tags() logic that allows fabric drivers to setup a per-cpu se_sess-sess_tag_pool and associated se_sess-sess_cmd_map for basic tagged pre-allocation of fabric descriptor sized memory. v3: Update

[PATCH-v3 4/4] vhost/scsi: Add pre-allocation for tv_cmd SGL + upages memory

2013-08-16 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds support for pre-allocation of per tv_cmd descriptor scatterlist + user-space page pointer memory using se_sess-sess_cmd_map within tcm_vhost_make_nexus() code. This includes sanity checks within vhost_scsi_map_to_sgl() to reject I/O

Re: [PATCH] vhost-scsi: Depend on NET for memcpy_fromiovec

2013-05-15 Thread Nicholas A. Bellinger
On Wed, 2013-05-15 at 14:47 +0930, Rusty Russell wrote: Asias He as...@redhat.com writes: scsi.c includes vhost.c which uses memcpy_fromiovec. This patch fixes this build failure. From Randy Dunlap: ''' on x86_64: ERROR: memcpy_fromiovec [drivers/vhost/vhost_scsi.ko]

Re: [PATCH] vhost-scsi: Depend on NET for memcpy_fromiovec

2013-05-14 Thread Nicholas A. Bellinger
On Wed, 2013-05-15 at 08:59 +0800, Asias He wrote: scsi.c includes vhost.c which uses memcpy_fromiovec. This patch fixes this build failure. From Randy Dunlap: ''' on x86_64: ERROR: memcpy_fromiovec [drivers/vhost/vhost_scsi.ko] undefined! It needs to depend on NET

Re: [PULL] vhost: cleanups and fixes

2013-05-02 Thread Nicholas A. Bellinger
On Thu, 2013-05-02 at 13:53 +0300, Michael S. Tsirkin wrote: The following changes since commit c39904a0ac22cf05f5f44226457f6da0fe65457e: Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next (2013-04-26 23:33:41 -0400) are available in the git

Re: [PULL] vhost: cleanups and fixes for 3.10

2013-05-01 Thread Nicholas A. Bellinger
On Wed, 2013-05-01 at 18:01 +0300, Michael S. Tsirkin wrote: Please pull the following vhost core updates for 3.10 - they affect both vhost-net and vhost-scsi devices. They also *depend* on both net-next and target-pending. Since Linus merged target-pending but not net-next at this point,

Re: [PATCH] tcm_vhost: Add vhost_scsi as an alias for tcm_vhost

2013-05-01 Thread Nicholas A. Bellinger
On Wed, 2013-05-01 at 09:42 +0300, Michael S. Tsirkin wrote: On Sat, Apr 27, 2013 at 11:42:09AM +0800, Asias He wrote: Signed-off-by: Asias He as...@redhat.com Nicholas, thoughts? How about we move tcm_vhost.c to scsi.c call module vhost_scsi and add tcm_vhost as an alias? If not - want

Re: [PATCH 0/3] vhost-scsi: file renames

2013-05-01 Thread Nicholas A. Bellinger
Acked-by: Nicholas Bellinger n...@linux-iscsi.org Thanks MST! Michael S. Tsirkin (3): vhost: src file renames tcm_vhost: header split up vhost_scsi: module rename drivers/vhost/Kconfig | 10 ++- drivers/vhost/Kconfig.tcm | 6 -- drivers/vhost/Makefile

  1   2   3   4   >