Re: [PATCH v2] linux/types.h: Restore the ability to disable sparse endianness checks

2017-10-16 Thread Michael S. Tsirkin
rt.vanass...@wdc.com> > Cc: linux-scsi@vger.kernel.org > Cc: linux-r...@vger.kernel.org > Cc: linux-ker...@vger.kernel.org > Cc: Michael S. Tsirkin <m...@redhat.com> > Cc: Christoph Hellwig <h...@infradead.org> > Cc: Leon Romanovsky <l...@kernel.org> > Cc: Andrew Mort

Re: [PATCH] linux/types.h: Restore the ability to disable sparse endianness checks

2017-10-16 Thread Michael S. Tsirkin
On Mon, Oct 16, 2017 at 03:36:50PM +, Bart Van Assche wrote: > On Mon, 2017-10-16 at 18:27 +0300, Michael S. Tsirkin wrote: > > On Mon, Oct 16, 2017 at 01:57:35PM +, Bart Van Assche wrote: > > > On Mon, 2017-10-16 at 16:34 +0300, Michael S. Tsirkin wrote: > > > &

Re: [PATCH] linux/types.h: Restore the ability to disable sparse endianness checks

2017-10-16 Thread Michael S. Tsirkin
On Mon, Oct 16, 2017 at 01:57:35PM +, Bart Van Assche wrote: > On Mon, 2017-10-16 at 16:34 +0300, Michael S. Tsirkin wrote: > > I don't see how it'll help make things better. OTOH if the specific > > drivers are tagged in the makefile, they can be gradually moved out

Re: [RFC] apparently broken error recovery in vhost_scsi_iov_to_sgl()

2017-09-25 Thread Michael S. Tsirkin
On Sun, Sep 24, 2017 at 11:36:33PM +0100, Al Viro wrote: > Suppose vhost_scsi_iov_to_sgl() got a two-iovec array, mapped > e.g. 20 pages from the first one just fine and failed on the > second. > > static int > vhost_scsi_iov_to_sgl(struct vhost_scsi_cmd *cmd, bool write, >

Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN.

2017-08-11 Thread Michael S. Tsirkin
On Fri, Aug 11, 2017 at 04:09:26PM +0200, Paolo Bonzini wrote: > On 10/08/2017 23:41, Michael S. Tsirkin wrote: > >>> Then we probably should fail probe if vq size is too small. > >> What does this mean? > > > > We must prevent driver from submitting s/g

Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN.

2017-08-10 Thread Michael S. Tsirkin
On Thu, Aug 10, 2017 at 10:35:11PM +0100, Richard W.M. Jones wrote: > On Fri, Aug 11, 2017 at 12:31:44AM +0300, Michael S. Tsirkin wrote: > > Then we probably should fail probe if vq size is too small. > > What does this mean? > > Rich. We must prevent driver from submittin

Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN.

2017-08-10 Thread Michael S. Tsirkin
On Thu, Aug 10, 2017 at 10:30:38PM +0100, Richard W.M. Jones wrote: > On Fri, Aug 11, 2017 at 12:21:16AM +0300, Michael S. Tsirkin wrote: > > On Thu, Aug 10, 2017 at 05:40:34PM +0100, Richard W.M. Jones wrote: > > > If using indirect descriptors, you can make the total_sg as

Re: [PATCH 1/2] virtio: Reduce BUG if total_sg > virtqueue size to WARN.

2017-08-10 Thread Michael S. Tsirkin
On Thu, Aug 10, 2017 at 05:40:34PM +0100, Richard W.M. Jones wrote: > If using indirect descriptors, you can make the total_sg as large as > you want. That would be a spec violation though, even if it happens to work on current QEMU. The spec says: A driver MUST NOT create a descriptor

Re: [PATCH 1/6] virtio: wrap find_vqs

2017-03-31 Thread Michael S. Tsirkin
On Fri, Mar 31, 2017 at 12:04:55PM +0800, Jason Wang wrote: > > > On 2017年03月30日 22:32, Michael S. Tsirkin wrote: > > On Thu, Mar 30, 2017 at 02:00:08PM +0800, Jason Wang wrote: > > > > > > On 2017年03月30日 04:48, Michael S. Tsirkin wrote: > > > > We

Re: [PATCH 1/6] virtio: wrap find_vqs

2017-03-30 Thread Michael S. Tsirkin
On Thu, Mar 30, 2017 at 02:00:08PM +0800, Jason Wang wrote: > > > On 2017年03月30日 04:48, Michael S. Tsirkin wrote: > > We are going to add more parameters to find_vqs, let's wrap the call so > > we don't need to tweak all drivers every time. > > > > Si

[PATCH 1/6] virtio: wrap find_vqs

2017-03-29 Thread Michael S. Tsirkin
We are going to add more parameters to find_vqs, let's wrap the call so we don't need to tweak all drivers every time. Signed-off-by: Michael S. Tsirkin <m...@redhat.com> --- drivers/block/virtio_blk.c | 3 +-- drivers/char/virtio_console.c | 6 +++--- drivers/

Re: [PATCH v2 2/2] virtio_scsi: Implement fc_host

2017-01-26 Thread Michael S. Tsirkin
On Thu, Jan 26, 2017 at 11:41:09AM +0800, Fam Zheng wrote: > This implements the VIRTIO_SCSI_F_FC_HOST feature by reading the config > fields and presenting them as sysfs fc_host attributes. The config > change handler is added here because primary_active will toggle during > migration. Looks

Re: [PATCH v2 1/2] virtio_scsi: Add fc_host definitions

2017-01-26 Thread Michael S. Tsirkin
On Thu, Jan 26, 2017 at 11:41:08AM +0800, Fam Zheng wrote: > Signed-off-by: Fam Zheng > --- I pefer combining this with implementation, hard to reason about interface alone. > include/uapi/linux/virtio_scsi.h | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git

Re: [PATCH 2/2] virtio_scsi: Implement fc_host

2017-01-17 Thread Michael S. Tsirkin
On Tue, Jan 17, 2017 at 10:05:00PM +0800, Fam Zheng wrote: > On Tue, 01/17 14:17, Paolo Bonzini wrote: > > > > > > On 16/01/2017 18:26, Fam Zheng wrote: > > >> Is the endianness correct for big-endian host here? > > > > > > I think so. The fc_host sysfs uses u64 to represent port_name and > > >

[PATCH 0/8] enable endian checks for all sparse builds

2016-12-14 Thread Michael S. Tsirkin
This is just a reposting of the patch that enables endian checks, with addition of trivial patches that drop __bitwise__ and __CHECK_ENDIAN__ everywhere. I plan to include this in my pull request unless I hear otherwise. Michael S. Tsirkin (8): linux/types.h: enable endian checks for all

[PATCH 5/8] linux: drop __bitwise__ everywhere

2016-12-14 Thread Michael S. Tsirkin
__bitwise__ used to mean "yes, please enable sparse checks unconditionally", but now that we dropped __CHECK_ENDIAN__ __bitwise is exactly the same. There aren't many users, replace it by __bitwise everywhere. Signed-off-by: Michael S. Tsirkin <m...@redhat.com> --- arch/arm/plat

Re: [PATCH] scsi/qla2xxx: label endian-ness for many fields

2016-12-10 Thread Michael S. Tsirkin
On Fri, Dec 09, 2016 at 09:49:28PM -0800, Joe Perches wrote: > On Fri, 2016-12-09 at 22:45 +0200, Michael S. Tsirkin wrote: > > This adds endian-ness labels for lots of qla structs. > > Doing this cuts down number of sparse warnings from ~1700 to ~1400. > > Will help find and

Re: [PATCH] linux/types.h: enable endian checks for all sparse builds

2016-12-09 Thread Michael S. Tsirkin
On Fri, Dec 09, 2016 at 03:18:02PM +, Bart Van Assche wrote: > On 12/08/16 22:40, Madhani, Himanshu wrote: > > We’ll take a look and send patches to resolve these warnings. > > Thanks! > > Bart. > Sounds good. I posted what I have so far so that you can start from that. -- MST -- To

[PATCH] scsi/qla2xxx: label endian-ness for many fields

2016-12-09 Thread Michael S. Tsirkin
This adds endian-ness labels for lots of qla structs. Doing this cuts down number of sparse warnings from ~1700 to ~1400. Will help find and resolve some of real issues down the road. Signed-off-by: Michael S. Tsirkin <m...@redhat.com> --- Compile-tested only. diff --git a/drivers/scsi/q

Re: [PATCH] linux/types.h: enable endian checks for all sparse builds

2016-12-08 Thread Michael S. Tsirkin
On Thu, Dec 08, 2016 at 06:38:11AM +, Bart Van Assche wrote: > On 12/07/16 21:54, Michael S. Tsirkin wrote: > > On Thu, Dec 08, 2016 at 05:21:47AM +, Bart Van Assche wrote: > >> Additionally, there are notable exceptions to the rule that most drivers > >> are

Re: [PATCH] linux/types.h: enable endian checks for all sparse builds

2016-12-07 Thread Michael S. Tsirkin
On Thu, Dec 08, 2016 at 05:21:47AM +, Bart Van Assche wrote: > On 12/07/16 18:29, Michael S. Tsirkin wrote: > > By now, linux is mostly endian-clean. Enabling endian-ness > > checks for everyone produces about 200 new sparse warnings for me - > > less than 10% over the

[PATCH] linux/types.h: enable endian checks for all sparse builds

2016-12-07 Thread Michael S. Tsirkin
__CHECK_ENDIAN__. Follow-up patches can drop distinction between __bitwise and __bitwise__. Cc: Linus Torvalds <torva...@linux-foundation.org> Suggested-by: Christoph Hellwig <h...@infradead.org> Signed-off-by: Michael S. Tsirkin <m...@redhat.com> --- Linus, could you ack this for ups

Re: [PATCH 10/10] virtio: enable endian checks for sparse builds

2016-12-07 Thread Michael S. Tsirkin
On Wed, Dec 07, 2016 at 07:25:51AM +0100, Johannes Berg wrote: > On Tue, 2016-12-06 at 17:41 +0200, Michael S. Tsirkin wrote: > > > It seems that there should be a better way to do it, > > but this works too. > > In some cases there might be: > > > --- a/drive

[PATCH 10/10] virtio: enable endian checks for sparse builds

2016-12-06 Thread Michael S. Tsirkin
__CHECK_ENDIAN__ isn't on by default presumably because it triggers too many sparse warnings for correct code. But virtio is now clean of these warnings, and we want to keep it this way - enable this for sparse builds. Signed-off-by: Michael S. Tsirkin <m...@redhat.com> --- It

[PATCH 00/10] virtio: sparse fixes

2016-12-06 Thread Michael S. Tsirkin
for sparse builds. Michael S. Tsirkin (10): virtio_console: drop unused config fields drm/virtio: fix endianness in primary_plane_update drm/virtio: fix lock context imbalance drm/virtio: annotate virtio_gpu_queue_ctrl_buffer_locked vhost: make interval tree static inline vhost: add missing

Re: DEFINE_IDA causing memory leaks? (was Re: [PATCH 1/2] virtio: fix memory leak of virtio ida cache layers)

2015-09-17 Thread Michael S. Tsirkin
On Thu, Sep 17, 2015 at 07:15:44AM -0700, James Bottomley wrote: > On Thu, 2015-09-17 at 08:33 +0300, Michael S. Tsirkin wrote: > > On Wed, Sep 16, 2015 at 07:29:17PM -0500, Suman Anna wrote: > > > The virtio core uses a static ida named virtio_index_ida for > > > assign

DEFINE_IDA causing memory leaks? (was Re: [PATCH 1/2] virtio: fix memory leak of virtio ida cache layers)

2015-09-16 Thread Michael S. Tsirkin
ng ida_destroy() in the virtio core module > exit. > > Cc: "Michael S. Tsirkin" <m...@redhat.com> > Signed-off-by: Suman Anna <s-a...@ti.com> Interesting. Will the same apply to e.g. sd_index_ida in drivers/scsi/sd.c or iscsi_sess_ida in drivers/scsi/scsi_t

Re: [PATCH 61/86] scsi/qla1280: use uapi/linux/pci_ids.h directly

2015-03-29 Thread Michael S. Tsirkin
On Sun, Mar 29, 2015 at 05:03:36PM +0300, James Bottomley wrote: On Sun, 2015-03-29 at 15:42 +0200, Michael S. Tsirkin wrote: Header moved from linux/pci_ids.h to uapi/linux/pci_ids.h, use the new header directly so we can drop the wrapper in include/linux/pci_ids.h. Signed-off

[PATCH 61/86] scsi/qla1280: use uapi/linux/pci_ids.h directly

2015-03-29 Thread Michael S. Tsirkin
Header moved from linux/pci_ids.h to uapi/linux/pci_ids.h, use the new header directly so we can drop the wrapper in include/linux/pci_ids.h. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/scsi/qla1280.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers

[PATCH 60/86] scsi/arcmsr: use uapi/linux/pci_ids.h directly

2015-03-29 Thread Michael S. Tsirkin
Header moved from linux/pci_ids.h to uapi/linux/pci_ids.h, use the new header directly so we can drop the wrapper in include/linux/pci_ids.h. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/scsi/arcmsr/arcmsr_hba.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

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

2015-02-04 Thread Michael S. Tsirkin
On Wed, Feb 04, 2015 at 01:13:58AM -0800, Nicholas A. Bellinger wrote: 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

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

2015-02-04 Thread Michael S. Tsirkin
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 in calculation of exp_data_len here. + */ + if (out_size req_size) { +

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

2015-02-04 Thread Michael S. Tsirkin
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 the virtio-scsi request header, which when + * ANY_LAYOUT is

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

2015-02-04 Thread Michael S. Tsirkin
On Wed, Feb 04, 2015 at 02:41:07AM -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-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-04 Thread Michael S. Tsirkin
On Wed, Feb 04, 2015 at 02:55:12AM -0800, Nicholas A. Bellinger wrote: 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

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

2015-02-04 Thread Michael S. Tsirkin
On Wed, Feb 04, 2015 at 02:41:07AM -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-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-03 Thread Michael S. Tsirkin
On Tue, Feb 03, 2015 at 11:56:16PM +, 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

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

2015-02-03 Thread Michael S. Tsirkin
+ * copy_from_iter() is modifying the iovecs as copies over + * req_size bytes into req, so the returned out_iter.iov[0] + * will contain the correct start + offset of the outgoing + * WRITE payload, if DMA_TO_DEVICE is set. +

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

2015-02-03 Thread Michael S. Tsirkin
existing code to save cmd-tvc_resp_iov instead of the first single iovec base pointer from vq-iov[out]. Typo in subject: should be copy_to_iter. v3 changes: - Convert memcpy_toiovecend - copy_to_iser usage This belongs after --- Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz

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

2015-02-03 Thread Michael S. Tsirkin
: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org Acked-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/scsi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c

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

2015-02-03 Thread Michael S. Tsirkin
the usage consistent. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org Yes, I've been wondering about that. Acked-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/scsi.c | 662

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

2015-02-03 Thread Michael S. Tsirkin
- Drop vhost_skip_iovec_bytes in favour of iov_iter Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org --- drivers/vhost/scsi.c | 260 +++ 1 file changed

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

2015-02-03 Thread Michael S. Tsirkin
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. It adds a new vhost_virtqueue -handle_kick() callback to

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

2015-02-03 Thread Michael S. Tsirkin
not to assume this, and put changelog after ---. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org --- drivers/vhost/scsi.c | 93 1 file changed, 93

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

2015-02-03 Thread Michael S. Tsirkin
and drop the pre virtio 1.0 logic in vhost_scsi_handle_vq() and associated helpers. Will probably be easier to review if you smash this with patch 5, this way we see both old and new code side by side. Also, let's rename _vqal to _vq in this patch? Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo

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

2015-02-03 Thread Michael S. Tsirkin
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 layout requirements. Cc: Michael S. Tsirkin m...@redhat.com Cc

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

2015-01-30 Thread Michael S. Tsirkin
allow the same parameters as well. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org --- drivers/vhost/scsi.c | 37 +++-- 1 file changed, 15 insertions(+), 22 deletions

[PATCH v3 06/16] virtio/scsi: verify device has config space

2015-01-14 Thread Michael S. Tsirkin
Some devices might not implement config space access (e.g. remoteproc used not to - before 3.9). virtio/scsi needs config space access so make it fail gracefully if not there. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/scsi/virtio_scsi.c | 6 ++ 1 file changed, 6

[PATCH 5/6] virtio/scsi: verify device has config space

2015-01-13 Thread Michael S. Tsirkin
Some devices might not implement config space access (e.g. remoteproc used not to - before 3.9). virtio/scsi needs config space access so make it fail gracefully if not there. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/scsi/virtio_scsi.c | 6 ++ 1 file changed, 6

Re: [PATCH v2] virtio-scsi: Fix the race condition in virtscsi_handle_event

2015-01-06 Thread Michael S. Tsirkin
On Tue, Jan 06, 2015 at 03:33:36PM +0800, Fam Zheng wrote: There is a race condition in virtscsi_handle_event, when many device hotplug/unplug events flush in quickly. The scsi_remove_device in virtscsi_handle_transport_reset may trigger the BUG_ON in scsi_target_reap, because the state is

Re: [PATCH v3] virtio-scsi: Fix the race condition in virtscsi_handle_event

2015-01-06 Thread Michael S. Tsirkin
On Tue, Jan 06, 2015 at 09:25:05PM +0800, Fam Zheng wrote: There is a race condition in virtscsi_handle_event, when many device hotplug/unplug events flush in quickly. The scsi_remove_device in virtscsi_handle_transport_reset may trigger the BUG_ON in scsi_target_reap, because the state is

Re: [PATCH] vhost-scsi: Add missing virtio-scsi - TCM attribute conversion

2015-01-06 Thread Michael S. Tsirkin
incorrectly being passed directly into target_submit_cmd_map_sgls(). This patch adds the missing virtio-scsi to TCM/SAM task attribute conversion. Cc: Christoph Hellwig h...@lst.de Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Nicholas

Re: [PATCH] virtio-scsi: Fix the race condition in virtscsi_handle_event

2015-01-05 Thread Michael S. Tsirkin
On Tue, Jan 06, 2015 at 12:10:59AM +0200, Michael S. Tsirkin wrote: On Mon, Jan 05, 2015 at 11:48:47AM -0800, Venkatesh Srinivas wrote: On Sun, Jan 4, 2015 at 10:04 PM, Fam Zheng f...@redhat.com wrote: There is a race condition in virtscsi_handle_event, when many device hotplug

Re: [PATCH] virtio-scsi: Fix the race condition in virtscsi_handle_event

2015-01-05 Thread Michael S. Tsirkin
On Mon, Jan 05, 2015 at 11:48:47AM -0800, Venkatesh Srinivas wrote: On Sun, Jan 4, 2015 at 10:04 PM, Fam Zheng f...@redhat.com wrote: There is a race condition in virtscsi_handle_event, when many device hotplug/unplug events flush in quickly. The scsi_remove_device in

Re: [PATCH v7 42/46] virtio_scsi: v1.0 support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 01:50:01PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:12:47 +0200 Michael S. Tsirkin m...@redhat.com wrote: Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Michael

Re: [PATCH v7 42/46] virtio_scsi: v1.0 support

2014-12-01 Thread Michael S. Tsirkin
On Mon, Dec 01, 2014 at 02:53:05PM +0200, Michael S. Tsirkin wrote: On Mon, Dec 01, 2014 at 01:50:01PM +0100, Cornelia Huck wrote: On Sun, 30 Nov 2014 17:12:47 +0200 Michael S. Tsirkin m...@redhat.com wrote: Note: for consistency, and to avoid sparse errors, convert all fields

[PATCH v8 50/50] virtio: drop VIRTIO_F_VERSION_1 from drivers

2014-12-01 Thread Michael S. Tsirkin
Core activates this bit automatically now, drop it from drivers that set it explicitly. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/block/virtio_blk.c| 1 - drivers/char/virtio_console.c | 1 - drivers/net/virtio_net.c | 1 - drivers/scsi/virtio_scsi.c| 1 - 4

[PATCH v8 42/50] virtio_scsi: v1.0 support

2014-12-01 Thread Michael S. Tsirkin
Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Michael S. Tsirkin m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- include/linux/virtio_scsi.h | 32 +++- drivers/scsi

[PATCH v7 42/46] virtio_scsi: v1.0 support

2014-11-30 Thread Michael S. Tsirkin
Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Michael S. Tsirkin m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- include/linux/virtio_scsi.h | 32 +++- drivers/scsi

[PATCH v5 41/45] virtio_scsi: v1.0 support

2014-11-27 Thread Michael S. Tsirkin
Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Michael S. Tsirkin m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- include/linux/virtio_scsi.h | 32 +++- drivers/scsi

[PATCH v6 42/46] virtio_scsi: v1.0 support

2014-11-27 Thread Michael S. Tsirkin
Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Michael S. Tsirkin m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- include/linux/virtio_scsi.h | 32 +++- drivers/scsi

Re: [PATCH v4 38/42] virtio_scsi: v1.0 support

2014-11-26 Thread Michael S. Tsirkin
On Wed, Nov 26, 2014 at 03:51:03PM +0100, Cornelia Huck wrote: On Tue, 25 Nov 2014 18:44:08 +0200 Michael S. Tsirkin m...@redhat.com wrote: Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Michael

[PATCH v4 38/42] virtio_scsi: v1.0 support

2014-11-25 Thread Michael S. Tsirkin
Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- include/linux/virtio_scsi.h | 32 +++- drivers/scsi/virtio_scsi.c | 51

[PATCH v3 37/41] virtio_scsi: v1.0 support

2014-11-24 Thread Michael S. Tsirkin
Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- include/linux/virtio_scsi.h | 32 +++- drivers/scsi/virtio_scsi.c | 51

Re: [PATCH v4 10/25] virtio: add API to enable VQs early

2014-11-10 Thread Michael S. Tsirkin
On Mon, Nov 10, 2014 at 04:45:09PM -0800, Andy Grover wrote: On 10/13/2014 12:50 AM, Michael S. Tsirkin wrote: virtio spec 0.9.X requires DRIVER_OK to be set before VQs are used, but some drivers use VQs before probe function returns. Since DRIVER_OK is set after probe, this violates the spec

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

2014-10-21 Thread Michael S. Tsirkin
On Tue, Oct 21, 2014 at 12:05:31PM -0700, Nicholas A. Bellinger wrote: 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

Re: [PATCH v4 13/25] virtio_console: enable VQs early

2014-10-20 Thread Michael S. Tsirkin
On Mon, Oct 20, 2014 at 01:07:50PM +0100, Thomas Graf wrote: On 10/13/14 at 10:50am, Michael S. Tsirkin wrote: virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after probe returns, virtio console violated this rule by adding inbufs, which causes

Re: [PATCH v4 13/25] virtio_console: enable VQs early

2014-10-20 Thread Michael S. Tsirkin
On Mon, Oct 20, 2014 at 04:10:16PM +0300, Michael S. Tsirkin wrote: On Mon, Oct 20, 2014 at 01:07:50PM +0100, Thomas Graf wrote: On 10/13/14 at 10:50am, Michael S. Tsirkin wrote: virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after probe returns

Re: [PATCH v4 13/25] virtio_console: enable VQs early

2014-10-20 Thread Michael S. Tsirkin
On Mon, Oct 20, 2014 at 02:42:23PM +0200, Cornelia Huck wrote: On Mon, 20 Oct 2014 13:07:50 +0100 Thomas Graf tg...@suug.ch wrote: On 10/13/14 at 10:50am, Michael S. Tsirkin wrote: virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after probe

Re: [PATCH v4 13/25] virtio_console: enable VQs early

2014-10-20 Thread Michael S. Tsirkin
On Mon, Oct 20, 2014 at 04:35:55PM +0300, Michael S. Tsirkin wrote: On Mon, Oct 20, 2014 at 02:42:23PM +0200, Cornelia Huck wrote: On Mon, 20 Oct 2014 13:07:50 +0100 Thomas Graf tg...@suug.ch wrote: On 10/13/14 at 10:50am, Michael S. Tsirkin wrote: virtio spec requires drivers

Re: [PATCH v4 04/25] virtio: defer config changed notifications

2014-10-14 Thread Michael S. Tsirkin
On Tue, Oct 14, 2014 at 11:01:12AM +1030, Rusty Russell wrote: Michael S. Tsirkin m...@redhat.com writes: Defer config changed notifications that arrive during probe/scan/freeze/restore. This will allow drivers to set DRIVER_OK earlier, without worrying about racing with config change

Re: [PATCH v3 10/25] virtio: add API to enable VQs early

2014-10-13 Thread Michael S. Tsirkin
On Mon, Oct 13, 2014 at 05:22:39PM +1030, Rusty Russell wrote: Michael S. Tsirkin m...@redhat.com writes: virtio spec 0.9.X requires DRIVER_OK to be set before VQs are used, but some drivers use VQs before probe function returns. Since DRIVER_OK is set after probe, this violates the spec

[PATCH v4 00/25] virtio: fix spec compliance issues

2014-10-13 Thread Michael S. Tsirkin
it trivially and then drop scan callback from core, but I'm rather inclined to look at ways to make some rng core changes so that we don't need to have so many variables tracking device state. So this is deferred for now. Michael S. Tsirkin (24): virtio_pci: fix virtio spec compliance on restore

[PATCH v4 02/25] virtio: unify config_changed handling

2014-10-13 Thread Michael S. Tsirkin
not look like a big deal. See also commit 3fff0179e33cd7d0a688dab65700c46ad089e934 virtio-pci: do not oops on config change if driver not loaded. for the original motivation behind the driver check. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h

[PATCH v4 01/25] virtio_pci: fix virtio spec compliance on restore

2014-10-13 Thread Michael S. Tsirkin
This behaviour will break with hypervisors that assume spec compliant behaviour. It seems like a good idea to have this patch applied to stable branches to reduce the support butden for the hypervisors. Cc: sta...@vger.kernel.org Cc: Amit Shah amit.s...@redhat.com Signed-off-by: Michael S. Tsirkin m

[PATCH v4 03/25] virtio-pci: move freeze/restore to virtio core

2014-10-13 Thread Michael S. Tsirkin
This is in preparation to extending config changed event handling in core. Wrapping these in an API also seems to make for a cleaner code. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- include/linux/virtio.h | 6 + drivers

[PATCH v4 05/25] virtio_blk: drop config_enable

2014-10-13 Thread Michael S. Tsirkin
notifications. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/block/virtio_blk.c | 23 --- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index

[PATCH v4 24/25] virtio_scsi: drop scan callback

2014-10-13 Thread Michael S. Tsirkin
Enable VQs early like we do for restore. This makes it possible to drop the scan callback, moving scanning into the probe function, and making code simpler. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/scsi/virtio_scsi.c | 23 +++ 1 file changed, 7 insertions

[PATCH v4 25/25] virtio-rng: refactor probe error handling

2014-10-13 Thread Michael S. Tsirkin
Code like vi-vq = NULL; kfree(vi) does not make sense. Clean it up, use goto error labels for cleanup. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/char/hw_random/virtio-rng.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git

[PATCH v4 22/25] virtio_scsi: fix race on device removal

2014-10-13 Thread Michael S. Tsirkin
We cancel event work on device removal, but an interrupt could trigger immediately after this, and queue it again. To fix, set a flag. Loosely based on patch by Paolo Bonzini Signed-off-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/scsi

[PATCH v4 21/25] virito_scsi: use freezable WQ for events

2014-10-13 Thread Michael S. Tsirkin
From: Paolo Bonzini pbonz...@redhat.com Michael S. Tsirkin noticed a race condition: we reset device on freeze, but system WQ is still running so it might try adding bufs to a VQ meanwhile. To fix, switch to handling events from the freezable WQ. Reported-by: Michael S. Tsirkin m...@redhat.com

[PATCH v4 23/25] virtio_balloon: enable VQs early on restore

2014-10-13 Thread Michael S. Tsirkin
virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after resume returns, virtio balloon violated this rule by adding bufs, which causes the VQ to be used directly within restore. To fix, call virtio_device_ready before using VQ. Signed-off-by: Michael S

[PATCH v4 14/25] 9p/trans_virtio: enable VQs early

2014-10-13 Thread Michael S. Tsirkin
-by: Michael S. Tsirkin m...@redhat.com --- net/9p/trans_virtio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 6940d8f..766ba48 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -575,6 +575,8 @@ static int p9_virtio_probe(struct

[PATCH v4 20/25] virtio_net: enable VQs early on restore

2014-10-13 Thread Michael S. Tsirkin
virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after restore returns, virtio net violated this rule by using receive VQs within restore. To fix, call virtio_device_ready before using VQs. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed

[PATCH v4 18/25] virtio_scsi: enable VQs early on restore

2014-10-13 Thread Michael S. Tsirkin
virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after restore returns, virtio scsi violated this rule on restore by kicking event vq within restore. To fix, call virtio_device_ready before using event queue. Signed-off-by: Michael S. Tsirkin m

[PATCH v4 16/25] virtio_scsi: move kick event out from virtscsi_init

2014-10-13 Thread Michael S. Tsirkin
We currently kick event within virtscsi_init, before host is fully initialized. This can in theory confuse guest if device consumes the buffers immediately. To fix, move virtscsi_kick_event_all out to scan/restore. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/scsi

[PATCH v4 17/25] virtio_blk: enable VQs early on restore

2014-10-13 Thread Michael S. Tsirkin
starting queues. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/block/virtio_blk.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 46b04bf..1c95af5 100644 --- a/drivers/block/virtio_blk.c +++ b

[PATCH v4 19/25] virtio_console: enable VQs early on restore

2014-10-13 Thread Michael S. Tsirkin
virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after resume returns, virtio console violated this rule by adding inbufs, which causes the VQ to be used directly within restore. To fix, call virtio_device_ready before using VQs. Signed-off-by: Michael S

[PATCH v4 13/25] virtio_console: enable VQs early

2014-10-13 Thread Michael S. Tsirkin
virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after probe returns, virtio console violated this rule by adding inbufs, which causes the VQ to be used directly within probe. To fix, call virtio_device_ready before using VQs. Signed-off-by: Michael S

[PATCH v4 12/25] virtio_blk: enable VQs early

2014-10-13 Thread Michael S. Tsirkin
virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after probe returns, virtio block violated this rule by calling add_disk, which causes the VQ to be used directly within probe. To fix, call virtio_device_ready before using VQs. Signed-off-by: Michael S

[PATCH v4 09/25] virtio_net: minor cleanup

2014-10-13 Thread Michael S. Tsirkin
goto done; done: return; is ugly, it was put there to make diff review easier. replace by open-coded return. Signed-off-by: Michael S. Tsirkin m...@redhat.com Acked-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/net/virtio_net.c | 6 ++ 1 file changed, 2 insertions

[PATCH v4 08/25] virtio-net: drop config_mutex

2014-10-13 Thread Michael S. Tsirkin
gone. Get rid of the unnecessary lock. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/net/virtio_net.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c

[PATCH v4 11/25] virtio_net: enable VQs early

2014-10-13 Thread Michael S. Tsirkin
virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after probe returns, virtio net violated this rule by using receive VQs within probe. To fix, call virtio_device_ready before using VQs. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed

[PATCH v4 06/25] virtio-blk: drop config_mutex

2014-10-13 Thread Michael S. Tsirkin
gone. Get rid of the unnecessary lock. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/block/virtio_blk.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index

[PATCH v3 24/25] virtio_scsi: drop scan callback

2014-10-12 Thread Michael S. Tsirkin
Enable VQs early like we do for restore. This makes it possible to drop the scan callback, moving scanning into the probe function, and making code simpler. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/scsi/virtio_scsi.c | 23 +++ 1 file changed, 7 insertions

[PATCH v3 25/25] virtio-rng: refactor probe error handling

2014-10-12 Thread Michael S. Tsirkin
Code like vi-vq = NULL; kfree(vi) does not make sense. Clean it up, use goto error labels for cleanup. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/char/hw_random/virtio-rng.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git

[PATCH v3 20/25] virtio_net: enable VQs early on restore

2014-10-12 Thread Michael S. Tsirkin
virtio spec requires drivers to set DRIVER_OK before using VQs. This is set automatically after restore returns, virtio net violated this rule by using receive VQs within restore. To fix, call virtio_enable_vqs_early before using VQs. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed

[PATCH v3 22/25] virtio_scsi: fix race on device removal

2014-10-12 Thread Michael S. Tsirkin
We cancel event work on device removal, but an interrupt could trigger immediately after this, and queue it again. To fix, set a flag. Loosely based on patch by Paolo Bonzini Signed-off-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/scsi

[PATCH v3 21/25] virito_scsi: use freezable WQ for events

2014-10-12 Thread Michael S. Tsirkin
From: Paolo Bonzini pbonz...@redhat.com Michael S. Tsirkin noticed a race condition: we reset device on freeze, but system WQ is still running so it might try adding bufs to a VQ meanwhile. To fix, switch to handling events from the freezable WQ. Reported-by: Michael S. Tsirkin m...@redhat.com

[PATCH v3 15/25] virtio_net: fix use after free on allocation failure

2014-10-12 Thread Michael S. Tsirkin
In the extremely unlikely event that driver initialization fails after RX buffers are added, virtio net frees RX buffers while VQs are still active, potentially causing device to use a freed buffer. To fix, reset device first - same as we do on device removal. Signed-off-by: Michael S. Tsirkin m

  1   2   >