From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [RFC] vhost-blk implementation Date: Mon, 5 Apr 2010 15:23:06 -0400 Message-ID: <20100405192306.GA15343@infradead.org> References: <1269306023.7931.72.camel@badari-desktop> <20100324200402.GA22272@infradead.org> <4BAA748D.40509@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoph Hellwig , kvm@vger.kernel.org To: Badari Pulavarty Return-path: Received: from bombadil.infradead.org ([18.85.46.34]:34608 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752103Ab0DETXH (ORCPT ); Mon, 5 Apr 2010 15:23:07 -0400 Content-Disposition: inline In-Reply-To: <4BAA748D.40509@us.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: 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. While we're at it here is a patch fixing the remaining sparse warnings in vhost-blk: 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();