Patchwork [2/3] vhost-scsi: new device supporting the tcm_vhost Linux kernel module

login
register
mail settings
Submitter Nicholas A. Bellinger
Date March 27, 2013, 11:05 p.m.
Message ID <1364425547.17698.35.camel@haakon2.linux-iscsi.org>
Download mbox | patch
Permalink /patch/231857/
State New
Headers show

Comments

Nicholas A. Bellinger - March 27, 2013, 11:05 p.m.
On Thu, 2013-03-28 at 00:50 +0200, Michael S. Tsirkin wrote:
> On Wed, Mar 27, 2013 at 03:45:42PM -0700, Nicholas A. Bellinger wrote:
> > On Thu, 2013-03-28 at 00:28 +0200, Michael S. Tsirkin wrote:
> > > On Wed, Mar 27, 2013 at 09:59:45PM +0000, Nicholas A. Bellinger wrote:
> > > > From: Paolo Bonzini <pbonzini@redhat.com>
> > > > 
> > > > The WWPN specified in configfs is passed to "-device vhost-scsi-pci".
> > > > The tgpt field of the SET_ENDPOINT ioctl is obsolete now, so it is not
> > > > available from the QEMU command-line.  Instead, I hardcode it to zero.
> > > > 
> > > > Changes in V4:
> > > >    - Set event_idx=off by default (nab, thanks asias)
> > > 
> > > Why? What's going on here?
> > > 
> > 
> > Not disabling event_idx by default, or disabling from the command line
> > ends up resulting in ->handle_kick() not getting called for subsequent
> > commands..
> > 
> > I spent some time trying to track this down recently with no luck, and
> > AFAICT it's always been required in order for vhost-scsi to function.
> 
> Hmm this is a bug in kernel then. A better work-around is
> to disable EVENT_IDX in kernel. Let's do it for 3.9?
> Then when we fix it, things just work for userspace.
> 

Mmmm, the following patch yields the same results with the event_idx=on
default for DEFINE_VHOST_SCSI_PROPERTIES.

Is there another method you had in mind to disable EVENT_IDX..?

Patch

diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
index 0524267..757cbda 100644
--- a/drivers/vhost/tcm_vhost.c
+++ b/drivers/vhost/tcm_vhost.c
@@ -981,7 +981,7 @@  static void vhost_scsi_flush(struct vhost_scsi *vs)
 
 static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features)
 {
-       if (features & ~VHOST_FEATURES)
+       if (features & ~VHOST_TCM_FEATURES)
                return -EOPNOTSUPP;
 
        mutex_lock(&vs->dev.mutex);
@@ -1027,7 +1027,7 @@  static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl,
                        return -EFAULT;
                return 0;
        case VHOST_GET_FEATURES:
-               features = VHOST_FEATURES;
+               features = VHOST_TCM_FEATURES;
                if (copy_to_user(featurep, &features, sizeof features))
                        return -EFAULT;
                return 0;
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 17261e2..588536e 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -204,6 +204,9 @@  enum {
        VHOST_NET_FEATURES = VHOST_FEATURES |
                         (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) |
                         (1ULL << VIRTIO_NET_F_MRG_RXBUF),
+       VHOST_TCM_FEATURES = (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) |
+                            (1ULL << VIRTIO_RING_F_INDIRECT_DESC) |
+                            (1ULL << VHOST_F_LOG_ALL)
 };
 
 static inline int vhost_has_feature(struct vhost_dev *dev, int bit)