Am Donnerstag, 27. Juni 2002 20:24 schrieb David Brownell:
> >>>Hotpluggings are rare events ...  Besides they take BKL and thus
> >>>couldn't run in concurrency.
> >>
> >>What was the reason they have BKL?  In principle it shouldn't
> >>be needed, since all the relevant USB data structures are locked
> >>correctly, and there's no comment in the code explaining why
> >>the hub driver touches the BKL ...
> >
> > Module unloading.
>
> ... worth documenting that in the source code, I'll include
> an appropriate comment in my next usbcore patch.

Actually looking at it. We can at least reduce BKL usage.
Here it is, completely untested of course ;-)

        Regards
                Oliver

PS: Is it true that the IBM guys have a keyboard they make
a notch into whenever they reduce BKL usage ?

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[EMAIL PROTECTED], 2002-06-27 21:16:56+02:00, [EMAIL PROTECTED]
  - reduce BKL usage




diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c    Thu Jun 27 21:18:14 2002
+++ b/drivers/usb/core/hub.c    Thu Jun 27 21:18:14 2002
@@ -1050,8 +1050,6 @@
 
 static int usb_hub_thread(void *__hub)
 {
-       lock_kernel();
-
        /*
         * This thread doesn't need any user-level access,
         * so get rid of all our resources
@@ -1072,7 +1070,6 @@
 
        dbg("usb_hub_thread exiting");
 
-       unlock_kernel();
        complete_and_exit(&khubd_exited, 0);
 }
 
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c    Thu Jun 27 21:18:14 2002
+++ b/drivers/usb/core/usb.c    Thu Jun 27 21:18:14 2002
@@ -1135,6 +1135,7 @@
 
        info("USB disconnect on device %d", dev->devnum);
 
+       lock_kernel(); /*guard against modules being unloaded */
        if (dev->actconfig) {
                for (i = 0; i < dev->actconfig->bNumInterfaces; i++) {
                        struct usb_interface *interface = 
&dev->actconfig->interface[i];
@@ -1156,6 +1157,7 @@
                        put_device(&interface->dev);
                }
        }
+       unlock_kernel();
 
        /* Free up all the children.. */
        for (i = 0; i < USB_MAXCHILDREN; i++) {
@@ -1349,7 +1351,9 @@
        usbfs_add_device(dev);
 
        /* find drivers willing to handle this device */
+       lock_kernel(); /* guard against modules unloading */
        usb_find_drivers(dev);
+       unlock_kernel();
 
        /* userspace may load modules and/or configure further */
        call_policy ("add", dev);

===================================================================


This BitKeeper patch contains the following changesets:
1.646
## Wrapped with gzip_uu ##


begin 664 bkpatch17020
M'XL(`/9D&ST``ZV56V^;0!"%G[V_8J2\M(EL=F8O&%>NTB156R52K51YKKBL
MP0*S%9BFE?CQ7;#D.!&-&S>6+?#.[N'LG`\X@;O:5+.1+58_3<5.X+.M-^ZO
M*6UI)IE=FV)5-K\FMDI=\=9:5_2Z86^[PHOR\:8RIO;N;9638F[6(MS$&;AB
M/1OA1.Q&-K]_F-GH]N.GNYL/MXS-YW"9A65JOID-S.<LRL^3QA23O+)AUEVP
MW95;XAP127&A-*J6ID+(%C6/$G>:D!\L(QVPM#+I^79Y;->/EQ/7I%$*3:I5
MI(1B5X`3+35P\KCVR`?"&>J9TF><9IS#=H/G0ZV`,X(Q9Q?P_YXO60QCJ$S2
MQ`8NKF^@J</4L&M02I!@BX<>L?$+/XSQD+/W`R:3JMM:[35UU/TF\8-9R0/4
M+0FI9!MK,D9-"?TX"@57S[7DD69L*_,@W+7>1R=+LE738"H/>LJ:`4\")8DV
MQE`OE2^D3"*E_!=ZV@GO>T(2BGH>A^</PWFDWZ>0/F=148`!!5RUJ(B"GECA
M/P66Y+\`RV$L7A'8.ELM-QVOCM1M_[["N+KOOXZ\Q5]:>03#5\B5`.J.+FT<
MSJEG[7!.+V#]8$[[>'.![DG"J94:<=KGA"Z0HX*2K_MDV0]J>_,="JK?V!%!
M?4%T<"(;%3;.O^>F*DWQYNT[\$[3)JP2"--P5=8;6-ND*4P-D5F5*31E8</$
M)'#J=0IJVBET@_L:KB(4#FK#L/A6MKM`K^L`'=3=O9OBS,1YW:SGF,1BR8UA
*?P`X-VZO&@<`````
`
end



-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to