Re: usbcore and the BKL

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

 



On Fri, 31 Jul 2009, Alan Stern wrote:

> > > The BKL gets used in several places within usbcore.  As far as I can 
> > > tell, all but one of them are unnecessary -- the exception being 
> > > usb_device_poll() in devices.c.  And that should be replaced with a 
> > > private mutex, or perhaps we could use usbfs_mutex.
> > With respect to poll I agree.
> > With respect to open() I dimly remember that hiddev needs BKL. Maybe
> > jkosina remembers.
> Jiri, do you know the answer?  We're talking about usb_open() in 
> drivers/usb/core/file.c.  I don't see why that should need the BKL.

[ sorry for late reply, I have been offline for two weeks ]

Actually, I remember having discussed this with some of you guys some time 
ago, and I thought that the conclusion was that

a) disconnect() used to do lock_kernel()
b) nobody has actually done the hard work of checking all open() methods 
   for dependency on BKL

In hiddev we need BKL simply because we need a lock which usb_open() also 
takes in the right order, so that we avoid race between usb_register_dev() 
and open().

We can't use simple mutex to guard hiddev_table[], because usb_open() and 
usb_register_dev() lock minor_rwsem, and we would end up with ABBA 
deadlock.

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux