public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* lock_kernel() / unlock_kernel inconsistency
@ 2000-12-14 21:51 Jason Wohlgemuth
  2000-12-16  0:19 ` lock_kernel() / unlock_kernel inconsistency Don't do this! george anzinger
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Wohlgemuth @ 2000-12-14 21:51 UTC (permalink / raw)
  To: linux-kernel

In an effort to stay consistent with the community, I migrated some code 
to a driver to use the daemonize() routine in the function specified by 
the kernel_thread() call.

However, in looking at a few drivers in the system (drivers/usb/hub.c , 
drivers/md/md.c, drivers/media/video/msp3400.c), I noticed some 
inconsistencies.  Specifically with the use of lock_kernel() / 
unlock_kernel().

drivers/md/md.c looks like:
int md_thread(void * arg)
{
   md_lock_kernel();

   daemonize();
   .
   .
   .
   //md_unlock_kernel();
}

this is similiar to drivers/usb/hub.c (which doesn't call unlock_kernel 
following lock_kernel)

however drivers/media/video/msp3400.c looks like:
static int msp3400c_thread(void *data)
{
   .
   .
   .
#ifdef CONFIG_SMP
   lock_kernel();
#endif
   daemonize();
   .
   .
   .
#ifdef CONFIG_SMP
   unlock_kernel();
#endif
}

The latter example seems logically correct to me.  Does this imply that 
after the CPU that is responsible for starting the thread in md.c or 
hub.c claims the global lock it will never be released to any other CPU?

If I am incorrect here please just point out my error, however, I 
figured I would bring this to the mailing list's attention if in fact 
this is truely in error.

Thanks,
Jason

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-12-16  1:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-14 21:51 lock_kernel() / unlock_kernel inconsistency Jason Wohlgemuth
2000-12-16  0:19 ` lock_kernel() / unlock_kernel inconsistency Don't do this! george anzinger
2000-12-16  0:37   ` Alan Cox
2000-12-16  0:48     ` george anzinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox