Re: x86-64 preemption fix from IRQ and BKL in 2.6.12-rc1-mm2

Andi Kleen
2005-03-27T17:26:30Z

On Fri, Mar 25, 2005 at 08:26:25PM +0100, Christophe Saout wrote:
> Fortunately the kernel locked up and there was no data corruption.
>
> I've got PREEMPT and PREEMPT_BKL enabled under UP.
>
> I just took a look at the change and found this:
>
> x86-64 does this (in entry.S):
>
> bt $9,EFLAGS-ARGOFFSET(%rsp) /* interrupts off? */
> jnc retint_restore_args
> movl $PREEMPT_ACTIVE,threadinfo_preempt_count(%rcx)
> sti
> call schedule
> cli
> GET_THREAD_INFO(%rcx)
> movl $0,threadinfo_preempt_count(%rcx)
> jmp exit_intr
>
> while i386 does this:
>
> testl $IF_MASK,EFLAGS(%esp) # interrupts off (exception path) ?
> jz restore_all
> call preempt_schedule_irq
> jmp need_resched
>
> preempt_schedule_irq is not an i386 specific function and seems to take
> special care of BKL preemption and since reiserfs does use the BKL to do
> certain things I think this actually might be the problem...?

Hmm, preempt_schedule_irq is not in mainline as far as I can see.
My patches are always for mainline; i dont do a special
patch kit for -mm*

It looks like a unfortunate interaction with some other patches
in mm. Andrew, can you disable CONFIG_PREEMPT on x86-64 in
mm for now?

Just calling preempt_schedule_irq may also work,
but most likely the patch that introduces that function needs
careful reading if it does not require more support from architectures.
BTW I suspect it will break other archs too...

> Unfortunately I don't have a amd64 machine to play with, so can somebody
> please check this?

How did you generate the crash dumps above then?

-Andi