All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Chun Yan Liu <cyliu@suse.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Juergen Gross <JGross@suse.com>, Wei Liu <wei.liu2@citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	Jim Fehlig <JFEHLIG@suse.com>, Simon Cao <caobosimon@gmail.com>
Subject: Re: [PATCH V13 3/5] libxl: add pvusb API
Date: Wed, 3 Feb 2016 14:38:50 +0000	[thread overview]
Message-ID: <56B210FA.7040803@citrix.com> (raw)
In-Reply-To: <56B21DFF02000066000A59F3@relay2.provo.novell.com>

On 03/02/16 07:34, Chun Yan Liu wrote:
> 
> 
>>>> On 2/3/2016 at 02:11 AM, in message
> <22192.61775.427189.268007@mariner.uk.xensource.com>, Ian Jackson
> <Ian.Jackson@eu.citrix.com> wrote: 
>> George Dunlap writes ("Re: [Xen-devel] [PATCH V13 3/5] libxl: add pvusb API"): 
>>> There are effectively four states a device can be in, from the 
>>> 'assignment' point of view: 
>>>  
>>> 1. Assigned to the normal Linux device driver(s) for the USB device 
>>>  
>>> 2. Assigned to no driver 
>>>  
>>> 3. Assigned to usbback, but not yet assigned to any guest 
>>>  
>>> 4. Assigned to a guest 
>>  
>> Thanks for your clear explanation (of which I will snip much). 
>>  
>>> Additionally, each USB "device" has one or more "interfaces".  To 
>>> assign a "device" to usbback in the sysfs case means assigning all of 
>>> the "interfaces".  The code seems to assume that different interfaces 
>>> from the same device can be assigned to different drivers. 
>>  
>> It is indeed the case that in principle a single USB device with 
>> multiple interfaces can be assigned to multiple different drivers. 
>>  
>>> Regarding Ian's comments: 
>>>  
>>> Since "assigned to the guest" and "listed under the pvusb xenstore 
>>> node" are the same thing, is it even *possible* to (safely) unassign 
>>> the device from usbback before removing the xenstore nodes? 
>>  
>> It might be possible to remove some of the xenstore nodes but leave 
>> others present, so that usbback detaches, but enough information 
>> remains for libxl to know that Xen still `owns' the device. 
> 
> Indeed "unassign from usbback, but listed under pvusb xenstore" is
> a confusing state. usb-list can list it but guest can not see it. 
> What user can do under that state is: reattempt usbdev_remove, if it 
> succeeds, everything is cleaned up, that's the best result; but 
> possibly it still fails (for example, in my testing, always cannot 
> rebind to original driver), in this case, the confusing state will 
> be lasting, and the device could not be removed, this is worse.

As I said in my other mail, I think removing the pvusb nodes should be
done once it's successfully un-bound from usbback, *even if* the re-bind
to the original driver fails.  (That is, once it reaches state 2,
usb-list should no longer list it.)

>>> Perhaps the best approach code-wise is to change the "goto out" on 
>>> failure of unbind_usbintf() into a "continue".  That way: 
>>>  
>>> 1. All interfaces which can be re-assigned are re-assigned (and work 
>>> as much as possible) 
>>>  
>>> 2. All interfaces which can be unbound but not re-assigned are at 
>>> least unbound (so that reloading the original driver might pick them 
>>> up) 
>>  
>> I certainly don't mind the software trying to do as much of its task 
>> as possible.
> 
> Could I understand that this way is acceptable? That means: removing 
> xenstore, and as much as we could (on failure of "unbind from usbback"
> or "bind to original driver", don't "goto out", just "continue").

I think part of it depends on what is *possible*.  If it's possible to
safely unbind the device from usbback while retaining its place in the
pvusb-related xenstore nodes, then I think we should (so that the user
can re-try removing it).  If it's not possible, then of course we have
to remove the pvusb xenstore nodes first, and then we'll just have to
deal as gracefully as possible with failure unbinding from usbback.

 -George

  reply	other threads:[~2016-02-03 14:38 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19  8:39 [PATCH V13 0/5] xen pvusb toolstack work Chunyan Liu
2016-01-19  8:39 ` [PATCH V13 1/5] libxl: export some functions for pvusb use Chunyan Liu
2016-01-19  8:39 ` [PATCH V13 2/5] libxl_utils: add internal function to read sysfs file contents Chunyan Liu
2016-01-19  8:39 ` [PATCH V13 3/5] libxl: add pvusb API Chunyan Liu
2016-01-19 15:48   ` Ian Jackson
2016-02-02 16:26     ` George Dunlap
2016-02-02 18:11       ` Ian Jackson
2016-02-03  7:34         ` Chun Yan Liu
2016-02-03 14:38           ` George Dunlap [this message]
2016-02-04  1:44             ` Chun Yan Liu
2016-02-03 14:33         ` George Dunlap
2016-02-04  1:53           ` Chun Yan Liu
     [not found]           ` <56B31FAB02000066000A6596@suse.com>
2016-02-04 14:39             ` Juergen Gross
2016-02-08 14:07               ` George Dunlap
2016-02-08 14:32                 ` Ian Jackson
2016-02-02 16:48     ` George Dunlap
2016-02-03  8:25       ` Chun Yan Liu
2016-01-26 16:12   ` Olaf Hering
2016-01-27  2:29     ` Chun Yan Liu
2016-01-19  8:39 ` [PATCH V13 4/5] domcreate: support pvusb in configuration file Chunyan Liu
2016-01-19 18:08   ` Ian Jackson
2016-01-19  8:39 ` [PATCH V13 5/5] xl: add pvusb commands Chunyan Liu
2016-01-19 18:11   ` Ian Jackson
2016-01-20  3:10     ` Jim Fehlig
2016-01-21 12:12       ` Wei Liu
2016-01-21 12:21         ` Ian Campbell
2016-01-21 12:29           ` Wei Liu
2016-01-21 17:37             ` Ian Jackson
2016-02-16 17:53       ` Ian Jackson
2016-02-17 11:43         ` Wei Liu
2016-02-17 12:17           ` Ian Jackson
2016-02-16 16:56   ` Olaf Hering
2016-02-17  6:14     ` Chun Yan Liu
2016-02-19 10:43     ` Chun Yan Liu
2016-02-19 10:52       ` Olaf Hering
2016-02-19 12:07         ` Olaf Hering
2016-02-24 12:03           ` Wei Liu
2016-02-24 12:52             ` Olaf Hering
     [not found] <569F8391020000660009E667@relay2.provo.novell.com>
2016-01-20  4:56 ` [PATCH V13 3/5] libxl: add pvusb API Chun Yan Liu
2016-01-26  7:43   ` Chun Yan Liu
2016-01-26 16:21     ` George Dunlap
     [not found] <56B0843302000066000A4C90@relay2.provo.novell.com>
2016-02-02  2:36 ` Chun Yan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56B210FA.7040803@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JFEHLIG@suse.com \
    --cc=JGross@suse.com \
    --cc=caobosimon@gmail.com \
    --cc=cyliu@suse.com \
    --cc=ian.campbell@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.