Re: [RFC] [patch 4/6 -rt] powerpc 2.6.20-rt8: fix a runtime warnings for xmon

Arnd Bergmann
2007-03-07T11:07:07Z

On Wednesday 07 March 2007, Ingo Molnar wrote:
> i'm not an xmon expert, but maybe it might make more sense to first
> disable preemption, then interrupts - otherwise you could be preempted
> right after having disabled these interrupts (and be scheduled to
> another CPU, etc.). What is the difference between local_irq_save() and
> the above 'disable interrupts' sequence? If it's not the same and
> xmon_core() relied on having hardirqs disabled then it might make sense
> to do a local_irq_save() there, instead of a preempt_disable().

Since relatively recently, powerpc does no longer actually disable
the hardware interrupts with local_irq_disable(), but rather sets
a per-cpu flag that will be checked if an actual interrupt comes
in as part of the critical section.

The mtmsr() sequence in xmon corresponds to hard_irq_disable()
and should probably changed to that, but then you still need
the extra preempt_disable() / preempt_enable().

I think you're right about the sequence having to be
1. preempt_disable()
2. hard_irq_disable()
3.
4. hard_irq_enable()
5. preempt_enable()