From mboxrd@z Thu Jan 1 00:00:00 1970 From: Badari Pulavarty Subject: Re: [RFC] vhost-blk implementation Date: Mon, 05 Apr 2010 16:17:45 -0700 Message-ID: <1270509465.28348.12.camel@badari-desktop> References: <1269306023.7931.72.camel@badari-desktop> <20100324200402.GA22272@infradead.org> <4BAA748D.40509@us.ibm.com> <20100405192306.GA15343@infradead.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Christoph Hellwig Return-path: Received: from e7.ny.us.ibm.com ([32.97.182.137]:42255 "EHLO e7.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756368Ab0DEXRf (ORCPT ); Mon, 5 Apr 2010 19:17:35 -0400 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by e7.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id o35N8VlO024928 for ; Mon, 5 Apr 2010 19:08:31 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o35NHYrQ142528 for ; Mon, 5 Apr 2010 19:17:34 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o35NHXHH004919 for ; Mon, 5 Apr 2010 19:17:34 -0400 In-Reply-To: <20100405192306.GA15343@infradead.org> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, 2010-04-05 at 15:23 -0400, Christoph Hellwig wrote: > On Wed, Mar 24, 2010 at 01:22:37PM -0700, Badari Pulavarty wrote: > > iovecs and buffers are user-space pointers (from the host kernel point > > of view). They are > > guest address. So, I don't need to do any set_fs tricks. > > From verifying the code and using the sparse annotations it appears > that the actual buffers are userspace pointers, but the iovecs in > the virtqueue are kernel level pointers, so you would need some > annotations. Yes. Thats correct. I will add appropriate annotations. > > While we're at it here is a patch fixing the remaining sparse > warnings in vhost-blk: Applied. Thanks, Badari > > Signed-off-by: Christoph Hellwig > > Index: linux-2.6/drivers/vhost/blk.c > =================================================================== > --- linux-2.6.orig/drivers/vhost/blk.c 2010-04-05 21:15:11.638004250 +0200 > +++ linux-2.6/drivers/vhost/blk.c 2010-04-05 21:16:13.238004599 +0200 > @@ -86,7 +86,7 @@ static void handle_blk(struct vhost_blk > nvecs++; > BUG_ON(vq->iov[nvecs].iov_len != 1); > > - if (copy_to_user(vq->iov[nvecs].iov_base, &status, sizeof status) < 0) { > + if (copy_to_user(vq->iov[nvecs].iov_base, &status, sizeof status)) { > printk("copy to user failed\n"); > vhost_discard_vq_desc(vq); > break; > @@ -199,7 +199,7 @@ static struct miscdevice vhost_blk_misc > &vhost_blk_fops, > }; > > -int vhost_blk_init(void) > +static int vhost_blk_init(void) > { > int r = vhost_init(); > if (r) > @@ -216,7 +216,7 @@ err_init: > } > module_init(vhost_blk_init); > > -void vhost_blk_exit(void) > +static void vhost_blk_exit(void) > { > misc_deregister(&vhost_blk_misc); > vhost_cleanup();