Re: usb-uhci forgets to destroy kmem entries
Hello! On Fri, Sep 15, 2000 at 10:04:59PM +0200, Manfred Spraul wrote: > > +#ifdef DEBUG_SLAB > > + if (retval < 0 ) { > > + if(kmem_cache_destroy(uhci_desc_kmem)) > Why only #ifdef DEBUG_SLAB? > AFAICS the driver should always destroy it's slab cache. Because we have such construction in usb-uhci.c::uhci_init(): #ifdef DEBUG_SLAB uhci_desc_kmem = kmem_cache_create("uhci_desc", sizeof(uhci_desc_t), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); if(!uhci_desc_kmem) { err("kmem_cache_create for uhci_desc failed (out of memory)"); return -ENOMEM; } urb_priv_kmem = kmem_cache_create("urb_priv", sizeof(urb_priv_t), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); if(!urb_priv_kmem) { err("kmem_cache_create for urb_priv_t failed (out of memory)"); return -ENOMEM; } #endif And DEBUG_SLAB is unconditionally defined in the beginning of usb-uhci.c, too Bye, Oleg - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: usb-uhci forgets to destroy kmem entries
Hello! On Fri, Sep 15, 2000 at 10:04:59PM +0200, Manfred Spraul wrote: +#ifdef DEBUG_SLAB + if (retval 0 ) { + if(kmem_cache_destroy(uhci_desc_kmem)) Why only #ifdef DEBUG_SLAB? AFAICS the driver should always destroy it's slab cache. Because we have such construction in usb-uhci.c::uhci_init(): #ifdef DEBUG_SLAB uhci_desc_kmem = kmem_cache_create("uhci_desc", sizeof(uhci_desc_t), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); if(!uhci_desc_kmem) { err("kmem_cache_create for uhci_desc failed (out of memory)"); return -ENOMEM; } urb_priv_kmem = kmem_cache_create("urb_priv", sizeof(urb_priv_t), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); if(!urb_priv_kmem) { err("kmem_cache_create for urb_priv_t failed (out of memory)"); return -ENOMEM; } #endif And DEBUG_SLAB is unconditionally defined in the beginning of usb-uhci.c, too Bye, Oleg - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
RE: usb-uhci forgets to destroy kmem entries
> > +#ifdef DEBUG_SLAB > > + if (retval < 0 ) { > > + if(kmem_cache_destroy(uhci_desc_kmem)) > > Why only #ifdef DEBUG_SLAB? > AFAICS the driver should always destroy it's slab cache. > > Please cc, I'm not subscribed to linux-kernel. (why not? :) > -- > Manfred This driver only uses slab caches when it's debugging. DEBUG & SLAB go together. ~Randy - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
RE: usb-uhci forgets to destroy kmem entries
> > +#ifdef DEBUG_SLAB > + if (retval < 0 ) { > + if(kmem_cache_destroy(uhci_desc_kmem)) Why only #ifdef DEBUG_SLAB? AFAICS the driver should always destroy it's slab cache. Please cc, I'm not subscribed to linux-kernel. -- Manfred - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
RE: usb-uhci forgets to destroy kmem entries
+#ifdef DEBUG_SLAB + if (retval 0 ) { + if(kmem_cache_destroy(uhci_desc_kmem)) Why only #ifdef DEBUG_SLAB? AFAICS the driver should always destroy it's slab cache. Please cc, I'm not subscribed to linux-kernel. -- Manfred - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
RE: usb-uhci forgets to destroy kmem entries
+#ifdef DEBUG_SLAB + if (retval 0 ) { + if(kmem_cache_destroy(uhci_desc_kmem)) Why only #ifdef DEBUG_SLAB? AFAICS the driver should always destroy it's slab cache. Please cc, I'm not subscribed to linux-kernel. (why not? :) -- Manfred This driver only uses slab caches when it's debugging. DEBUG SLAB go together. ~Randy - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
RE: usb-uhci forgets to destroy kmem entries
Yes, people use it. Thanks. ~Randy ___ |Randy Dunlap Intel Corp., DALSr. SW Engr.| |randy.dunlap.at.intel.com503-696-2055| |NOTE: Any views presented here are mine alone | |and may not represent the views of my employer. | |_| > From: Oleg Drokin [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, September 13, 2000 7:40 AM > > Hello! > >I do not know, if anybody really uses this driver ('UHCI > (Intel PIIX4, VIA, >...) support'), but based one the name, I choosen it, and > found, that when it >cannot find any USB host, it forgots to do kmem_destroy_..., and >because of that any subsequent attempts to load usb-uhci > modules ends up >with BUG in slab.c. >Here is the patch, below. It is against 2.4.0-test8. > > --- drivers/usb/usb-uhci.c.orig Wed Sep 13 17:36:20 2000 > +++ drivers/usb/usb-uhci.cWed Sep 13 18:34:33 2000 > @@ -2842,6 +2842,7 @@ > > if(!urb_priv_kmem) { > err("kmem_cache_create for urb_priv_t failed > (out of memory)"); > + kmem_cache_destroy(urb_priv_kmem); > return -ENOMEM; > } > #endif > @@ -2876,6 +2877,15 @@ > i++; > } > > +#ifdef DEBUG_SLAB > + if (retval < 0 ) { > + if(kmem_cache_destroy(uhci_desc_kmem)) > + err("uhci_desc_kmem remained"); > + if(kmem_cache_destroy(urb_priv_kmem)) > + err("urb_priv_kmem remained"); > + } > +#endif > + > return retval; > } > > - - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
RE: usb-uhci forgets to destroy kmem entries
Yes, people use it. Thanks. ~Randy ___ |Randy Dunlap Intel Corp., DALSr. SW Engr.| |randy.dunlap.at.intel.com503-696-2055| |NOTE: Any views presented here are mine alone | |and may not represent the views of my employer. | |_| From: Oleg Drokin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 13, 2000 7:40 AM Hello! I do not know, if anybody really uses this driver ('UHCI (Intel PIIX4, VIA, ...) support'), but based one the name, I choosen it, and found, that when it cannot find any USB host, it forgots to do kmem_destroy_..., and because of that any subsequent attempts to load usb-uhci modules ends up with BUG in slab.c. Here is the patch, below. It is against 2.4.0-test8. --- drivers/usb/usb-uhci.c.orig Wed Sep 13 17:36:20 2000 +++ drivers/usb/usb-uhci.cWed Sep 13 18:34:33 2000 @@ -2842,6 +2842,7 @@ if(!urb_priv_kmem) { err("kmem_cache_create for urb_priv_t failed (out of memory)"); + kmem_cache_destroy(urb_priv_kmem); return -ENOMEM; } #endif @@ -2876,6 +2877,15 @@ i++; } +#ifdef DEBUG_SLAB + if (retval 0 ) { + if(kmem_cache_destroy(uhci_desc_kmem)) + err("uhci_desc_kmem remained"); + if(kmem_cache_destroy(urb_priv_kmem)) + err("urb_priv_kmem remained"); + } +#endif + return retval; } - - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/