Re: [Xen-devel] [RESEND][PATCH V16 0/6] xen pvusb toolstack work

2016-03-08 Thread Chun Yan Liu


>>> On 3/8/2016 at 07:33 PM, in message <56deb899.7080...@citrix.com>, George
Dunlap  wrote: 
> On 08/03/16 01:37, Chunyan Liu wrote: 
> > This patch series is to add pvusb toolstack work, supporting hot add|remove 
> > USB device to|from guest and specify USB device in domain configuration  
> file. 
> >  
> > RESEND to remove a incorrect rc in 4/6: 
> > +out: 
> > +path = GCSPRINTF(USBBACK_INFO_PATH "/%s", usbdev_encode); 
> > +rc = libxl__xs_rm_checked(gc, XBT_NULL, path); 
> > 'rc' should be removed here. 
> > +return rc; 
> >  
> > Sorry for trouble you. 
>  
> Hey Chunyan, 
>  
> If you make any change at all to the patch series, you should increase 
> the revision number.  Otherwise, the person who ultimately commits it is 
> likely to think that the original version and the resend are the same, 
> and accidentally commit the original (incorrect) version.  (For 
> instance, they may already like me have downloaded the original patch 
> series and imported it into git.) 
>  
> The best thing to do in this situation would have been to reply to your 
> own patch, saying "And this 'rc' should be removed.  I'll spin another 
> version." 
>  
> I took a brief look at the diff between v14 and v15v1 yesterday, and it 
> looks good.  IanJ is away this week, and I'm sure he'll want to take a 
> look at it before Ack-ing it next week.  So would you mind sending a 
> v16, and I'll review it by the end of the week? 

Got it. Will post the RESEND series with a new version number.

>  
> Thanks, 
>  -George 
>  
> >  
> > Changes to V15: 
> > * address George's comments (patch 4/6) 
> >  
> > V15: 
> > http://lists.xen.org/archives/html/xen-devel/2016-03/msg00040.html 
> >  
> > V14: 
> > http://lists.xenproject.org/archives/html/xen-devel/2016-02/msg02745.html 
> >  
> > V13: 
> > http://lists.xenproject.org/archives/html/xen-devel/2016-01/msg02125.html 
> >  
> > V12: 
> > http://lists.xen.org/archives/html/xen-devel/2015-12/msg02697.html 
> >  
> > V11: 
> > http://lists.xen.org/archives/html/xen-devel/2015-12/msg01626.html 
> >  
> > V10: 
> > http://lists.xen.org/archives/html/xen-devel/2015-12/msg01172.html 
> >  
> > V9: 
> > http://lists.xen.org/archives/html/xen-devel/2015-11/msg02744.html 
> >  
> > V8: 
> > http://lists.xen.org/archives/html/xen-devel/2015-10/msg02178.html 
> >  
> > V7: 
> > http://lists.xen.org/archives/html/xen-devel/2015-09/msg03115.html 
> >  
> > V6: 
> > http://lists.xen.org/archives/html/xen-devel/2015-08/msg00750.html 
> >  
> > V5: 
> > http://lists.xen.org/archives/html/xen-devel/2015-06/msg04052.html 
> >  
> > V4: 
> > http://lists.xenproject.org/archives/html/xen-devel/2015-06/msg01327.html 
> >  
> > Related Discussion Threads: 
> > http://www.redhat.com/archives/libvir-list/2014-June/msg00038.html 
> > http://lists.xen.org/archives/html/xen-devel/2014-06/msg00086.html 
> >  
> >   <<< pvusb work introduction >>> 
> >  
> > 1. Overview 
> >  
> > There are two general methods for passing through individual host 
> > devices to a guest. The first is via an emulated USB device 
> > controller; the second is PVUSB. 
> >  
> > Additionally, there are two ways to add USB devices to a guest: via 
> > the config file at domain creation time, and via hot-plug while the VM 
> > is running. 
> >  
> > * Emulated USB 
> >  
> > In emulated USB, the device model (qemu) presents an emulated USB 
> > controller to the guest. The device model process then grabs control 
> > of the device from domain 0 and and passes the USB commands between 
> > the guest OS and the host USB device. 
> >  
> > This method is only available to HVM domains, and is not available for 
> > domains running with device model stubdomains. 
> >  
> > * PVUSB 
> >  
> > PVUSB uses a paravirtialized front-end/back-end interface, similar to 
> > the traditional Xen PV network and disk protocols. In order to use 
> > PVUSB, you need usbfront in your guest OS, and usbback in dom0 (or 
> > your USB driver domain). 
> >  
> > 2. Specifying a host USB device 
> >  
> > QEMU qmp commands allows USB devices to be specified either by their 
> > bus address (in the form bus.device) or their device tag (in the form 
> > vendorid:deviceid). 
> >  
> > Each way of specifying has its advantages: 
> >  
> > Specifying by device tag will always get the same device, 
> > regardless of where the device ends up in the USB bus topology. 
> > However, if there are two identical devices, it will not allow you to 
> > specify which one. 
> >  
> > Specifying by bus address will always allow you to choose a 
> > specific device, even if you have duplicates. However, the bus address 
> > may change depending on which port you plugged the device into, and 
> > possibly also after a reboot. 
> >  
> > To avoid duplication of vendorid:deviceid, we'll use bus address to 
> > specify host USB device in xl toolstack. 
> >  
> > You can use lsusb to list the USB devices on the system: 

Re: [Xen-devel] [RESEND][PATCH V16 0/6] xen pvusb toolstack work

2016-03-08 Thread George Dunlap
On 08/03/16 01:37, Chunyan Liu wrote:
> This patch series is to add pvusb toolstack work, supporting hot add|remove
> USB device to|from guest and specify USB device in domain configuration file.
> 
> RESEND to remove a incorrect rc in 4/6:
> +out:
> +path = GCSPRINTF(USBBACK_INFO_PATH "/%s", usbdev_encode);
> +rc = libxl__xs_rm_checked(gc, XBT_NULL, path);
> 'rc' should be removed here.
> +return rc;
> 
> Sorry for trouble you.

Hey Chunyan,

If you make any change at all to the patch series, you should increase
the revision number.  Otherwise, the person who ultimately commits it is
likely to think that the original version and the resend are the same,
and accidentally commit the original (incorrect) version.  (For
instance, they may already like me have downloaded the original patch
series and imported it into git.)

The best thing to do in this situation would have been to reply to your
own patch, saying "And this 'rc' should be removed.  I'll spin another
version."

I took a brief look at the diff between v14 and v15v1 yesterday, and it
looks good.  IanJ is away this week, and I'm sure he'll want to take a
look at it before Ack-ing it next week.  So would you mind sending a
v16, and I'll review it by the end of the week?

Thanks,
 -George

> 
> Changes to V15:
> * address George's comments (patch 4/6)
> 
> V15:
> http://lists.xen.org/archives/html/xen-devel/2016-03/msg00040.html
> 
> V14:
> http://lists.xenproject.org/archives/html/xen-devel/2016-02/msg02745.html
> 
> V13:
> http://lists.xenproject.org/archives/html/xen-devel/2016-01/msg02125.html
> 
> V12:
> http://lists.xen.org/archives/html/xen-devel/2015-12/msg02697.html
> 
> V11:
> http://lists.xen.org/archives/html/xen-devel/2015-12/msg01626.html
> 
> V10:
> http://lists.xen.org/archives/html/xen-devel/2015-12/msg01172.html
> 
> V9:
> http://lists.xen.org/archives/html/xen-devel/2015-11/msg02744.html
> 
> V8:
> http://lists.xen.org/archives/html/xen-devel/2015-10/msg02178.html
> 
> V7:
> http://lists.xen.org/archives/html/xen-devel/2015-09/msg03115.html
> 
> V6:
> http://lists.xen.org/archives/html/xen-devel/2015-08/msg00750.html
> 
> V5:
> http://lists.xen.org/archives/html/xen-devel/2015-06/msg04052.html
> 
> V4:
> http://lists.xenproject.org/archives/html/xen-devel/2015-06/msg01327.html
> 
> Related Discussion Threads:
> http://www.redhat.com/archives/libvir-list/2014-June/msg00038.html
> http://lists.xen.org/archives/html/xen-devel/2014-06/msg00086.html
> 
>   <<< pvusb work introduction >>>
> 
> 1. Overview
> 
> There are two general methods for passing through individual host
> devices to a guest. The first is via an emulated USB device
> controller; the second is PVUSB.
> 
> Additionally, there are two ways to add USB devices to a guest: via
> the config file at domain creation time, and via hot-plug while the VM
> is running.
> 
> * Emulated USB
> 
> In emulated USB, the device model (qemu) presents an emulated USB
> controller to the guest. The device model process then grabs control
> of the device from domain 0 and and passes the USB commands between
> the guest OS and the host USB device.
> 
> This method is only available to HVM domains, and is not available for
> domains running with device model stubdomains.
> 
> * PVUSB
> 
> PVUSB uses a paravirtialized front-end/back-end interface, similar to
> the traditional Xen PV network and disk protocols. In order to use
> PVUSB, you need usbfront in your guest OS, and usbback in dom0 (or
> your USB driver domain).
> 
> 2. Specifying a host USB device
> 
> QEMU qmp commands allows USB devices to be specified either by their
> bus address (in the form bus.device) or their device tag (in the form
> vendorid:deviceid).
> 
> Each way of specifying has its advantages:
> 
> Specifying by device tag will always get the same device,
> regardless of where the device ends up in the USB bus topology.
> However, if there are two identical devices, it will not allow you to
> specify which one.
> 
> Specifying by bus address will always allow you to choose a
> specific device, even if you have duplicates. However, the bus address
> may change depending on which port you plugged the device into, and
> possibly also after a reboot.
> 
> To avoid duplication of vendorid:deviceid, we'll use bus address to
> specify host USB device in xl toolstack.
> 
> You can use lsusb to list the USB devices on the system:
> 
> Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0
> Hub
> Bus 003 Device 002: ID f617:0905
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 001 Device 004: ID 0424:2640 Standard Microsystems Corp. USB 2.0
> Hub
> Bus 001 Device 005: ID 0424:4060 Standard Microsystems Corp. Ultra
> Fast Media Reader
> Bus 001 Device 006: ID 046d:c016 Logitech, Inc. Optical Wheel Mouse
> 
> To pass through the Logitec mouse, for instance, you could specify
> 1.6 (remove leading zeroes).
> 
> Note: USB hubs can not be assigned to guest.
> 
> 3. 

[Xen-devel] [RESEND][PATCH V16 0/6] xen pvusb toolstack work

2016-03-07 Thread Chunyan Liu
This patch series is to add pvusb toolstack work, supporting hot add|remove
USB device to|from guest and specify USB device in domain configuration file.

RESEND to remove a incorrect rc in 4/6:
+out:
+path = GCSPRINTF(USBBACK_INFO_PATH "/%s", usbdev_encode);
+rc = libxl__xs_rm_checked(gc, XBT_NULL, path);
'rc' should be removed here.
+return rc;

Sorry for trouble you.

Changes to V15:
* address George's comments (patch 4/6)

V15:
http://lists.xen.org/archives/html/xen-devel/2016-03/msg00040.html

V14:
http://lists.xenproject.org/archives/html/xen-devel/2016-02/msg02745.html

V13:
http://lists.xenproject.org/archives/html/xen-devel/2016-01/msg02125.html

V12:
http://lists.xen.org/archives/html/xen-devel/2015-12/msg02697.html

V11:
http://lists.xen.org/archives/html/xen-devel/2015-12/msg01626.html

V10:
http://lists.xen.org/archives/html/xen-devel/2015-12/msg01172.html

V9:
http://lists.xen.org/archives/html/xen-devel/2015-11/msg02744.html

V8:
http://lists.xen.org/archives/html/xen-devel/2015-10/msg02178.html

V7:
http://lists.xen.org/archives/html/xen-devel/2015-09/msg03115.html

V6:
http://lists.xen.org/archives/html/xen-devel/2015-08/msg00750.html

V5:
http://lists.xen.org/archives/html/xen-devel/2015-06/msg04052.html

V4:
http://lists.xenproject.org/archives/html/xen-devel/2015-06/msg01327.html

Related Discussion Threads:
http://www.redhat.com/archives/libvir-list/2014-June/msg00038.html
http://lists.xen.org/archives/html/xen-devel/2014-06/msg00086.html

  <<< pvusb work introduction >>>

1. Overview

There are two general methods for passing through individual host
devices to a guest. The first is via an emulated USB device
controller; the second is PVUSB.

Additionally, there are two ways to add USB devices to a guest: via
the config file at domain creation time, and via hot-plug while the VM
is running.

* Emulated USB

In emulated USB, the device model (qemu) presents an emulated USB
controller to the guest. The device model process then grabs control
of the device from domain 0 and and passes the USB commands between
the guest OS and the host USB device.

This method is only available to HVM domains, and is not available for
domains running with device model stubdomains.

* PVUSB

PVUSB uses a paravirtialized front-end/back-end interface, similar to
the traditional Xen PV network and disk protocols. In order to use
PVUSB, you need usbfront in your guest OS, and usbback in dom0 (or
your USB driver domain).

2. Specifying a host USB device

QEMU qmp commands allows USB devices to be specified either by their
bus address (in the form bus.device) or their device tag (in the form
vendorid:deviceid).

Each way of specifying has its advantages:

Specifying by device tag will always get the same device,
regardless of where the device ends up in the USB bus topology.
However, if there are two identical devices, it will not allow you to
specify which one.

Specifying by bus address will always allow you to choose a
specific device, even if you have duplicates. However, the bus address
may change depending on which port you plugged the device into, and
possibly also after a reboot.

To avoid duplication of vendorid:deviceid, we'll use bus address to
specify host USB device in xl toolstack.

You can use lsusb to list the USB devices on the system:

Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0
Hub
Bus 003 Device 002: ID f617:0905
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 0424:2640 Standard Microsystems Corp. USB 2.0
Hub
Bus 001 Device 005: ID 0424:4060 Standard Microsystems Corp. Ultra
Fast Media Reader
Bus 001 Device 006: ID 046d:c016 Logitech, Inc. Optical Wheel Mouse

To pass through the Logitec mouse, for instance, you could specify
1.6 (remove leading zeroes).

Note: USB hubs can not be assigned to guest.

3. PVUSB toolstack

* Specify USB device in xl config file

You can just specify usb devices, like:
usbdev=['hostbus=1, hostaddr=6']

Then it will create a USB controller automatically and attach the USB
device to the first available USB controller:port.

or, you can explicitly specify usb controllers and usb devices, like:
usbctrl=['verison=1, ports=4', 'version=2, ports=8', ]
usbdev=['hostbus=1, hostaddr=6, controller=0, port=1']

Then it will create two USB controllers as you specified.
And if controller and port are specified in usb config, then it will
attach the USB device to that controller:port. About the controller
and port value:
Each USB controller has a index (or called devid) based on 0. The 1st
controller has index 0, the 2nd controller has index 1, ...
Under controller, each port has a port number based on 1. In above
configuration, the 1st controller will have port 1,2,3,4.

* Hot-Plug USB device

To attach a USB device, you should first create a USB controller.
e.g.
xl usbctrl-attach domain [version=1|2] [ports=value]
By default, it will create a USB2.0 controller with 8 ports.

Then