linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* raw_spinlock_t rules
@ 2010-09-19 13:09 Avi Kivity
  2010-09-19 16:38 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2010-09-19 13:09 UTC (permalink / raw)
  To: Steven Rostedt, Thomas Gleixner
  Cc: linux-kernel, KVM list, Marcelo Tosatti, Ingo Molnar

  Some time ago, the i8259 emulation code in kvm was changed to use 
raw_spinlock_t, as it was called in a preempt_disable() and 
local_irq_disable() context, which doesn't work with preemptible 
spinlocks used with CONFIG_PREEMPT_RT.

In Linux 2.6.37, the spinlock will no longer be taken in these contexts, 
so I'd like to change it to a normal spinlock_t.  However, it is still 
taken in a spin_lock_irq() context.

Is it okay to do this change?  I figured since spin_lock_irq() is part 
of the spinlock infrastructure it might to the right thing.

-- 
error compiling committee.c: too many arguments to function


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

* Re: raw_spinlock_t rules
  2010-09-19 13:09 raw_spinlock_t rules Avi Kivity
@ 2010-09-19 16:38 ` Steven Rostedt
  2010-09-19 16:43   ` Avi Kivity
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2010-09-19 16:38 UTC (permalink / raw)
  To: Avi Kivity
  Cc: Thomas Gleixner, linux-kernel, KVM list, Marcelo Tosatti,
	Ingo Molnar

On Sun, 2010-09-19 at 15:09 +0200, Avi Kivity wrote:
> Some time ago, the i8259 emulation code in kvm was changed to use 
> raw_spinlock_t, as it was called in a preempt_disable() and 
> local_irq_disable() context, which doesn't work with preemptible 
> spinlocks used with CONFIG_PREEMPT_RT.
> 
> In Linux 2.6.37, the spinlock will no longer be taken in these contexts, 
> so I'd like to change it to a normal spinlock_t.  However, it is still 
> taken in a spin_lock_irq() context.
> 
> Is it okay to do this change?  I figured since spin_lock_irq() is part 
> of the spinlock infrastructure it might to the right thing.
> 

In PREEMPT_RT all interrupts (besides the timer) is converted to a
thread. The spin_lock_irq() will not disable interrupts in PREEMPT_RT,
because it is not needed (irqs are threaded and wont cause a deadlock if
they share the same spin_locks).

Note, spin_locks used by the timer will must be raw_spin_lock(), and
threaded context must disable interrupts for real before using it.

-- Steve



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

* Re: raw_spinlock_t rules
  2010-09-19 16:38 ` Steven Rostedt
@ 2010-09-19 16:43   ` Avi Kivity
  0 siblings, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2010-09-19 16:43 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Thomas Gleixner, linux-kernel, KVM list, Marcelo Tosatti,
	Ingo Molnar

  On 09/19/2010 06:38 PM, Steven Rostedt wrote:
> On Sun, 2010-09-19 at 15:09 +0200, Avi Kivity wrote:
> >  Some time ago, the i8259 emulation code in kvm was changed to use
> >  raw_spinlock_t, as it was called in a preempt_disable() and
> >  local_irq_disable() context, which doesn't work with preemptible
> >  spinlocks used with CONFIG_PREEMPT_RT.
> >
> >  In Linux 2.6.37, the spinlock will no longer be taken in these contexts,
> >  so I'd like to change it to a normal spinlock_t.  However, it is still
> >  taken in a spin_lock_irq() context.
> >
> >  Is it okay to do this change?  I figured since spin_lock_irq() is part
> >  of the spinlock infrastructure it might to the right thing.
> >
>
> In PREEMPT_RT all interrupts (besides the timer) is converted to a
> thread. The spin_lock_irq() will not disable interrupts in PREEMPT_RT,
> because it is not needed (irqs are threaded and wont cause a deadlock if
> they share the same spin_locks).
>
> Note, spin_locks used by the timer will must be raw_spin_lock(), and
> threaded context must disable interrupts for real before using it.
>

Thanks.  So it looks like we can convert that spinlock.

-- 
error compiling committee.c: too many arguments to function


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

end of thread, other threads:[~2010-09-19 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-19 13:09 raw_spinlock_t rules Avi Kivity
2010-09-19 16:38 ` Steven Rostedt
2010-09-19 16:43   ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).