Re: Q: deadlock

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

 



On Sun, Mar 10, 2002 at 11:12:15AM +0000, arjan@fenrus.demon.nl wrote:
> In article <63342002301010163277@antisocial.com> you wrote:
> > 
> > Why can the kernel deadlock when calling e.g copy_to_user while holding a 
> > spinlock?
> > I understand that the function can block, but not that it could result in a 
> > deadlock.
> 
> you hold the spinlock and schedule. another process
> gets scheduled and wants to grab the exact same spinlock.....
> grabbing spinlock is busy waiting without scheduling so the
> original process never ever gets a chance to release the lock.... lock
> doesn't get released -> you busy wait forever
> --

You have a conflict there. First you say that the first process schedules
_because_ of the spinlock. Then you say that 'grabbing spinlock is busy waiting
without scheduling'. AFAIK, spinlocks are disabled for UP. They only work for SMP.
The idea is that while one process busy waits on the spinlock on one processor, 
the other process on the other processor (the one actually holding the spinlock)
can do whatever it needs to do and than release the spinlock. Than the first process
is released and can aquire the lock.

-- 
Etay Meiri
cl1@netvision.net.il
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux