From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Kroah-Hartman Subject: Re: [PATCH] tcm_vhost: Expose ABI version via VHOST_SCSI_GET_ABI_VERSION Date: Mon, 23 Jul 2012 18:56:34 -0700 Message-ID: <20120724015634.GD4093@kroah.com> References: <1343093180-5598-1-git-send-email-nab@linux-iscsi.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1343093180-5598-1-git-send-email-nab@linux-iscsi.org> Sender: target-devel-owner@vger.kernel.org To: "Nicholas A. Bellinger" Cc: target-devel , linux-scsi , lf-virt , kvm-devel , qemu-devel , Stefan Hajnoczi , Zhi Yong Wu , Anthony Liguori , Paolo Bonzini , "Michael S. Tsirkin" , Christoph Hellwig , Jens Axboe , Hannes Reinecke , Zhi Yong Wu List-Id: linux-scsi@vger.kernel.org On Tue, Jul 24, 2012 at 01:26:20AM +0000, Nicholas A. Bellinger wrote: > From: Nicholas Bellinger > > As requested by Anthony, here is a patch against target-pending/for-next-merge > to expose an ABI version to userspace via a new VHOST_SCSI_GET_ABI_VERSION > ioctl operation. > > As mentioned in the comment, ABI Rev 0 is for pre 2012 out-of-tree code, and > ABI Rev 1 (the current rev) is for current WIP v3.6 kernel merge candiate code. > > I think this is what you had in mind, and hopefully it will make MST happy too. > The incremental vhost-scsi patches against Zhi's QEMU are going out shortly ahead > of cutting a new vhost-scsi RFC over the next days. > > Please have a look and let me know if you have any concerns here. > > Thanks! > > Reported-by: Anthony Liguori > Cc: Stefan Hajnoczi > Cc: Michael S. Tsirkin > Cc: Paolo Bonzini > Cc: Zhi Yong Wu > Signed-off-by: Nicholas Bellinger > --- > drivers/vhost/tcm_vhost.c | 9 +++++++++ > drivers/vhost/tcm_vhost.h | 11 +++++++++++ > 2 files changed, 20 insertions(+), 0 deletions(-) > > diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c > index dc7e024..3f04169 100644 > --- a/drivers/vhost/tcm_vhost.c > +++ b/drivers/vhost/tcm_vhost.c > @@ -977,6 +977,15 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl, > return -EFAULT; > > return vhost_scsi_clear_endpoint(vs, &backend); > + case VHOST_SCSI_GET_ABI_VERSION: > + if (copy_from_user(&backend, argp, sizeof backend)) > + return -EFAULT; > + > + backend.abi_version = VHOST_SCSI_ABI_VERSION; > + > + if (copy_to_user(argp, &backend, sizeof backend)) > + return -EFAULT; > + return 0; > case VHOST_GET_FEATURES: > features = VHOST_FEATURES; > if (copy_to_user(featurep, &features, sizeof features)) > diff --git a/drivers/vhost/tcm_vhost.h b/drivers/vhost/tcm_vhost.h > index e942df9..3d5378f 100644 > --- a/drivers/vhost/tcm_vhost.h > +++ b/drivers/vhost/tcm_vhost.h > @@ -80,7 +80,17 @@ struct tcm_vhost_tport { > > #include > > +/* > + * Used by QEMU userspace to ensure a consistent vhost-scsi ABI. > + * > + * ABI Rev 0: All pre 2012 revisions used by prototype out-of-tree code > + * ABI Rev 1: 2012 version for v3.6 kernel merge candiate > + */ > + > +#define VHOST_SCSI_ABI_VERSION 1 > + > struct vhost_scsi_target { > + int abi_version; > unsigned char vhost_wwpn[TRANSPORT_IQN_LEN]; > unsigned short vhost_tpgt; > }; > @@ -88,3 +98,4 @@ struct vhost_scsi_target { > /* VHOST_SCSI specific defines */ > #define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target) > #define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target) > +#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, struct vhost_scsi_target) No, you just broke the ABI for version "0" here, that's not how you do this at all. greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stfl8-00041D-Gm for qemu-devel@nongnu.org; Tue, 24 Jul 2012 10:06:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Stfky-0002jh-T7 for qemu-devel@nongnu.org; Tue, 24 Jul 2012 10:06:46 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:51973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stfky-0002jS-NA for qemu-devel@nongnu.org; Tue, 24 Jul 2012 10:06:36 -0400 Received: by pbbro12 with SMTP id ro12so12545973pbb.4 for ; Tue, 24 Jul 2012 07:06:35 -0700 (PDT) Date: Mon, 23 Jul 2012 18:56:34 -0700 From: Greg Kroah-Hartman Message-ID: <20120724015634.GD4093@kroah.com> References: <1343093180-5598-1-git-send-email-nab@linux-iscsi.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1343093180-5598-1-git-send-email-nab@linux-iscsi.org> Subject: Re: [Qemu-devel] [PATCH] tcm_vhost: Expose ABI version via VHOST_SCSI_GET_ABI_VERSION List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Nicholas A. Bellinger" Cc: Jens Axboe , Stefan Hajnoczi , kvm-devel , "Michael S. Tsirkin" , Zhi Yong Wu , qemu-devel , lf-virt , Anthony Liguori , target-devel , Hannes Reinecke , linux-scsi , Paolo Bonzini , Zhi Yong Wu , Christoph Hellwig On Tue, Jul 24, 2012 at 01:26:20AM +0000, Nicholas A. Bellinger wrote: > From: Nicholas Bellinger > > As requested by Anthony, here is a patch against target-pending/for-next-merge > to expose an ABI version to userspace via a new VHOST_SCSI_GET_ABI_VERSION > ioctl operation. > > As mentioned in the comment, ABI Rev 0 is for pre 2012 out-of-tree code, and > ABI Rev 1 (the current rev) is for current WIP v3.6 kernel merge candiate code. > > I think this is what you had in mind, and hopefully it will make MST happy too. > The incremental vhost-scsi patches against Zhi's QEMU are going out shortly ahead > of cutting a new vhost-scsi RFC over the next days. > > Please have a look and let me know if you have any concerns here. > > Thanks! > > Reported-by: Anthony Liguori > Cc: Stefan Hajnoczi > Cc: Michael S. Tsirkin > Cc: Paolo Bonzini > Cc: Zhi Yong Wu > Signed-off-by: Nicholas Bellinger > --- > drivers/vhost/tcm_vhost.c | 9 +++++++++ > drivers/vhost/tcm_vhost.h | 11 +++++++++++ > 2 files changed, 20 insertions(+), 0 deletions(-) > > diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c > index dc7e024..3f04169 100644 > --- a/drivers/vhost/tcm_vhost.c > +++ b/drivers/vhost/tcm_vhost.c > @@ -977,6 +977,15 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl, > return -EFAULT; > > return vhost_scsi_clear_endpoint(vs, &backend); > + case VHOST_SCSI_GET_ABI_VERSION: > + if (copy_from_user(&backend, argp, sizeof backend)) > + return -EFAULT; > + > + backend.abi_version = VHOST_SCSI_ABI_VERSION; > + > + if (copy_to_user(argp, &backend, sizeof backend)) > + return -EFAULT; > + return 0; > case VHOST_GET_FEATURES: > features = VHOST_FEATURES; > if (copy_to_user(featurep, &features, sizeof features)) > diff --git a/drivers/vhost/tcm_vhost.h b/drivers/vhost/tcm_vhost.h > index e942df9..3d5378f 100644 > --- a/drivers/vhost/tcm_vhost.h > +++ b/drivers/vhost/tcm_vhost.h > @@ -80,7 +80,17 @@ struct tcm_vhost_tport { > > #include > > +/* > + * Used by QEMU userspace to ensure a consistent vhost-scsi ABI. > + * > + * ABI Rev 0: All pre 2012 revisions used by prototype out-of-tree code > + * ABI Rev 1: 2012 version for v3.6 kernel merge candiate > + */ > + > +#define VHOST_SCSI_ABI_VERSION 1 > + > struct vhost_scsi_target { > + int abi_version; > unsigned char vhost_wwpn[TRANSPORT_IQN_LEN]; > unsigned short vhost_tpgt; > }; > @@ -88,3 +98,4 @@ struct vhost_scsi_target { > /* VHOST_SCSI specific defines */ > #define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target) > #define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target) > +#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, struct vhost_scsi_target) No, you just broke the ABI for version "0" here, that's not how you do this at all. greg k-h