From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Chun Yan Liu" Subject: Re: [PATCH V6 3/7] libxl: add pvusb API Date: Thu, 17 Sep 2015 02:24:30 -0600 Message-ID: <55FB055E0200006600050E86@relay2.provo.novell.com> References: <1439202928-24813-1-git-send-email-cyliu@suse.com> <1439202928-24813-4-git-send-email-cyliu@suse.com> <1441721852.24450.120.camel@citrix.com> <55F2F64F02000066000508CA@relay2.provo.novell.com> <1441978018.3549.33.camel@citrix.com> <55F2DD66.1040507@suse.com> <1441980590.3549.46.camel@citrix.com> <55F2E29D.10805@suse.com> <1441982504.3549.69.camel@citrix.com> <55F6438A.7090403@suse.com> <55F6A729.3080301@suse.com> <22006.43915.2549.265495@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap , Ian Jackson Cc: Juergen Gross , Wei Liu , Ian Campbell , "xen-devel@lists.xen.org" , Jim Fehlig , Simon Cao List-Id: xen-devel@lists.xenproject.org >>> On 9/14/2015 at 10:03 PM, in message , George Dunlap wrote: > On Mon, Sep 14, 2015 at 12:12 PM, Ian Jackson > wrote: > > Juergen Gross writes ("Re: [Xen-devel] [PATCH V6 3/7] libxl: add pvusb > API"): > >> On 09/14/2015 12:36 PM, George Dunlap wrote: > >> > Anyone want to look into the Linux source code to find out how big it > >> > will allow busnum / devnum to grow? > >> > >> drivers/usb/core/hcd.c is using a bitmap to find the next bus number > >> currently not in use. It's size is USB_MAXBUS which in turn has the > >> value 64. > >> > >> choose_devnum() in drivers/usb/core/hub.c is doing a similar job for > >> device numbers. Here the highest number supported is 127. > > > > We are defining an API, which shouldn't involve this kind of > > implementation-grobbling. > > > > At an API level, it seems that this Linux busnum is not documented to > > have any particular number or behaviour or range or anything. We > > should use the biggest type we can use conveniently > > > > Do we need to worry that some bus might have 2^24 unplugs/plugs > > (perhaps in some kind of software emulation) and that we need to use a > > type which can hold a uint32_t or maybe even a uint64_t ? > > libusb is already a published API that supports uint8, or up to 255. > Following their lead seems like a reasonable thing to do. If ever > that number goes above 255, basically every Linux program that touches > a USB device will need to be recompiled with a new version of libusb. > > Is there any reason for Linux to go above 255? Things I can think of: > > 1. Users have more than 255 devices plugged into the same bus. > > 2. A security / confusion issue due to devnum reuse when users plug > and unplug devices hundreds of times. > > Both of these seem pretty unlikely. > > I would personally go with uint8, but int16 or int32 certainly won't hurt. So can we agree to use uint8 for hostbus and hostaddr as libusb does? > > -George > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel > >