Skip to contentSkip to conversation

lockup on Athlon systems, kernel race condition?

DISCUSSION Manfred Spraul 2 participants 4 messages Sep 3, 2002 – Sep 4, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 10 lines
Quoted 9 lines · Terence Ripperda

...

asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)

{
        struct file * filp;
        unsigned int flag;
        int on, error = -EBADF;
Quoted 5 lines
Quoted 5 lines
        filp = fget(fd);
        if (!filp)
                goto out;
        error = 0;
        lock_kernel();    <====

Which compiler to you use, and which kernel? Which additional patches?

With my 2.4.20-pre4-ac1 kernel, the lock_kernel is at offset +3a, according to your dump it's at +6a.

Quoted 10 lines
Quoted 1 line
        switch (cmd) {

This CPU is spinning, waiting for kernel_flag. It will take the IPI and the other CPU's smp_call_function() will succeed.

Possibly the IPI has got lost - seems that this is a popular failure mode for flakey chipsets/motherboards.

Or someone has called sys_ioctl() with interrupts disabled. That's very doubtful.

Is it possible to display the cpu registers with kdb? Could you check that the interrupts are enabled?

I'd add a quick test into sys_ioctl() or lock_kernel: save_flags, and check that bit 9 is always enabled. Check __global_cli for sample code. The X server probably runs with enough priveledges to disable the interrupts, perhaps it's doing something stupid.

--
Manfred

#1 lore raw
Quoted 4 lines · On Tue, Sep 03, 2002 at 11:46:11PM +0200, [email protected] wrote:

Which compiler to you use, and which kernel? Which additional patches?

With my 2.4.20-pre4-ac1 kernel, the lock_kernel is at offset +3a, according to your dump it's at +6a.

I'm using gcc 2.95.4 (on debian). The kernel I'm currently using is 2.4.19, with the kdb patch and apic_routing patches applied. Neither of these is required to reproduce the problem, they're just to help debug the problem.

that reminds me. when I originally tried to use the nmi watchdog to break into the debugger when the hang occured, I got the following at bootup:

Sep  3 14:56:49 localhost kernel: activating NMI Watchdog ... done.
Sep  3 14:56:49 localhost kernel: testing NMI watchdog ... CPU#0: NMI appears to be stuck!
Quoted 2 lines

Is it possible to display the cpu registers with kdb? Could you check that the interrupts are enabled?

I don't have things caught in the debugger currently, but I did check the registers at the time. bit 9 of eflags was enabled on both cpus.

Terence

#2 lore raw
Quoted 3 lines · Terence Ripperda

I don't have things caught in the debugger currently, but I did check the registers at the time. bit 9 of eflags was enabled on both cpus.

That rules out a disabled interrupt flag.

What was cpu1 doing? There are 3 loops in smp_call_function:
spin_lock(&call_lock), and 2 while loops with barrier() [first one for IPI arrival, second one for synchroneous ipi's. TLB flush is sync].

--
Manfred

#3 lore raw
Quoted 3 lines · On Wed, Sep 04, 2002 at 05:05:58PM +0200, [email protected] wrote:

What was cpu1 doing? There are 3 loops in smp_call_function:
spin_lock(&call_lock), and 2 while loops with barrier() [first one for IPI arrival, second one for synchroneous ipi's. TLB flush is sync].

it was spinning on the first barrier loop, waiting for verification of the IPI arrival:

        /* Wait for response */
        while (atomic_read(&data.started) != cpus)
                barrier();

Terence