Re: vhost-net patches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 22, 2009 at 11:00:20AM -0700, Sridhar Samudrala wrote:
> On Thu, 2009-10-22 at 19:43 +0200, Michael S. Tsirkin wrote:
> 
> > 
> > Possibly we'll have to debug this in vhost in host kernel.
> > I would debug this directly, it's just that my setup is somehow
> > different and I do not see this issue, otherwise I would not
> > waste your time.
> > 
> > Can we add some printks?
> > handle_tx has this at the top:
> > 
> >         if (!sock || !sock_writeable(sock->sk))
> >                 return;
> 
> I added some debug printks in handle_rx and handle_tx
> get_user() calls are failing with EFAULT.

Sridhar, Shirley,
Could you please test the following patch?
It should fix a bug on 32 bit hosts - is this what you have?


diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 5b57697..9d856e9 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -286,11 +286,11 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
 			r = -EOPNOTSUPP;
 			break;
 		}
-		if ((u64)(long)a.user_addr != a.user_addr) {
+		if ((u64)(unsigned long)a.user_addr != a.user_addr) {
 			r = -EFAULT;
 			break;
 		}
-		vq->desc = (void __user *)(long)a.user_addr;
+		vq->desc = (void __user *)(unsigned long)a.user_addr;
 		break;
 	case VHOST_SET_VRING_AVAIL:
 		r = copy_from_user(&a, argp, sizeof a);
@@ -300,11 +300,11 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
 			r = -EOPNOTSUPP;
 			break;
 		}
-		if ((u64)(long)a.user_addr != a.user_addr) {
+		if ((u64)(unsigned long)a.user_addr != a.user_addr) {
 			r = -EFAULT;
 			break;
 		}
-		vq->avail = (void __user *)(long)a.user_addr;
+		vq->avail = (void __user *)(unsigned long)a.user_addr;
 		/* Forget the cached index value. */
 		vq->avail_idx = vq->last_avail_idx;
 		break;
@@ -316,11 +316,11 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
 			r = -EOPNOTSUPP;
 			break;
 		}
-		if ((u64)(long)a.user_addr != a.user_addr) {
+		if ((u64)(unsigned long)a.user_addr != a.user_addr) {
 			r = -EFAULT;
 			break;
 		}
-		vq->used = (void __user *)(long)a.user_addr;
+		vq->used = (void __user *)(unsigned long)a.user_addr;
 		r = init_used(vq);
 		if (r)
 			break;
@@ -389,7 +389,7 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
 
 	if (pollstop && vq->handle_kick)
 		vhost_poll_flush(&vq->poll);
-	return 0;
+	return r;
 }
 
 long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, unsigned long arg)
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux