Re: newbie questions about while (1) in kernel mode and spinlocks

2006-12-21 Thread Steven Rostedt
On Thu, 2006-12-21 at 10:41 +0100, Sorin Manolache wrote: > Dear list, > > I am in the process of learning how to write linux device drivers. > > I have a 2.6.16.5 kernel running on a monoprocessor machine. We usually call that a Uniprocessor or just UP. > #CONFIG_SMP is not set > CONFIG_DEBUG

RE: newbie questions about while (1) in kernel mode and spinlocks

2006-12-21 Thread SR, Krishna
: Thursday, December 21, 2006 2:20 AM To: Sorin Manolache Cc: linux-kernel@vger.kernel.org Subject: Re: newbie questions about while (1) in kernel mode and spinlocks On Thu, 21 Dec 2006 10:41:44 +0100 "Sorin Manolache" <[EMAIL PROTECTED]> wrote: > spin_lock(&lck); > down

Re: newbie questions about while (1) in kernel mode and spinlocks

2006-12-21 Thread Robert Hancock
Sorin Manolache wrote: The Linux Device Drivers book says that a spin_lock should not be shared between a process and an interrupt handler. The explanation is that the process may hold the lock, an interrupt occurs, the interrupt handler spins on the lock held by the process and the system freez

Re: newbie questions about while (1) in kernel mode and spinlocks

2006-12-21 Thread Paolo Ornati
On Thu, 21 Dec 2006 10:41:44 +0100 "Sorin Manolache" <[EMAIL PROTECTED]> wrote: > while (1) > ; > > in the read function of a test device driver. I expect the calling > process to freeze, and then a timer interrupt to preempt the kernel > and to schedule another process. This does not happen,

Re: newbie questions about while (1) in kernel mode and spinlocks

2006-12-21 Thread Paolo Ornati
On Thu, 21 Dec 2006 10:41:44 +0100 "Sorin Manolache" <[EMAIL PROTECTED]> wrote: > spin_lock(&lck); > down(&sem); /* I know that one shouldn't sleep when holding a lock */ > /* but I want to understand why */ I suppose because the lock is held for an indefinite amount of time a

Re: newbie questions about while (1) in kernel mode and spinlocks

2006-12-21 Thread Paolo Ornati
On Thu, 21 Dec 2006 10:41:44 +0100 "Sorin Manolache" <[EMAIL PROTECTED]> wrote: > The Linux Device Drivers book says that a spin_lock should not be > shared between a process and an interrupt handler. The explanation is > that the process may hold the lock, an interrupt occurs, the interrupt > han

newbie questions about while (1) in kernel mode and spinlocks

2006-12-21 Thread Sorin Manolache
Dear list, I am in the process of learning how to write linux device drivers. I have a 2.6.16.5 kernel running on a monoprocessor machine. #CONFIG_SMP is not set CONFIG_DEBUG_SPINLOCK=y. CONFIG_PREEMPT=y CONFIG_PREEMPT_BKL=y First question: I wrote while (1) ; in the read function of a te