From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: Re: [PATCH V4 3/7] libxl: add pvusb API Date: Thu, 11 Jun 2015 17:00:46 +0200 Message-ID: <5579A29E.5090007@suse.com> References: <1433906441-3280-1-git-send-email-cyliu@suse.com> <1433906441-3280-4-git-send-email-cyliu@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1433906441-3280-4-git-send-email-cyliu@suse.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Chunyan Liu , xen-devel@lists.xen.org Cc: george.dunlap@eu.citrix.com, Ian.Jackson@eu.citrix.com, Simon Cao , wei.liu2@citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org On 06/10/2015 05:20 AM, Chunyan Liu wrote: > Add pvusb APIs, including: > - attach/detach (create/destroy) virtual usb controller. > - attach/detach usb device > - list usb controller and usb devices > - some other helper functions > > Signed-off-by: Chunyan Liu > Signed-off-by: Simon Cao I've tested the patches with an old SUSE pvusb backend and my new one. While all cases I tried worked with xm, the xl variant had some problems with both backends, the new one being worse. I suspect especially this patch to be faulty, as it has IMHO a potential structural problem: when trying to attach a USB device without having created a usb-controller for the domain, an asynchronous libxl-operation will itself call another async operation. The second async operation is being called with ao_how being NULL, but I'm not sure whether this is allowed (libxl_internal.h comments are not clear for me regarding such a scenario). libxl_device_usb_add() AO_CREATE(ctx, domid, ao_how) libxl__device_usb_add() libxl__device_usb_setdefault() libxl_device_usbctrl_add_common() AO_CREATE(ctx, domid, NULL) Tests with the new backend: What I'm seeing is an error message that the controller couldn't be assigned and the device would fail, too. The real result, however, is an assigned controller, but no device. Manual assignment of the device succeeds afterwards. doing "xl usb-ctrl-attach" and then "xl usb-attach" is working, too. Assigning a device via config file fails always (binding of device to backend failed). Tests with the old backend: All tests but assigning a device via config file worked (again the same binding error). As I'm currently trying to write a new pvusb backend in qemu, I don't want to investigate the xl problems with the new kernel backend. I suspect some timing differences between old and new kernel drivers leading to the different results. As the qemu variant wouldn't need any driver rebinding in libxl (qemu is handling this by itself) I wouldn't be worried too much about the config file problem. If, however, the nested usage of AO_CREATE is forbidden, this has to be changed, of course. Juergen