Skip to contentSkip to conversation

sc3200 cpu + apm module kernel crash

DISCUSSION Nicolas FR 2 participants 4 messages Nov 3, 2006 – Nov 5, 2006

lore
Share & tools
lore

Nicolas FR

author
#0 lore raw

Hi,

I am currently trying to setup a fully functionnal linux on a Tatung webpad (shipped with winCE), which has a AMD/NSC SC3200 CPU (more details on my blog here: http://www.geek-fr.com ). So far everything goes fine except one thing:

when I try to load the APM module, the kernel crashes. I have tried different options, but always got the same crash. I have enabled some verbosing and finally found that the crash is happening in arch/i386/kernel/apm.c in function static void apm_mainloop(void) when calling apm_event_handler();

I have thrown a bunch of "printk(KERN_INFO "apm: I am here\n");" and noticed the crash is happening just when calling apm_event_handler(); and does not even execute any instruction in this function... This is the point I don't understand, how can it crash just on calling a function and not executing the first statement in this function?

Moreover by enabling soft lockup detection I have managed to get those informations:

==========================
apm: BIOS version 1.2 Flags 0x07 (Driver version 1.16ac)
apm: entry f000:51c8 cseg16 f000 dseg 40 cseg len ffff, dseg ken ffff cseg16 len ffff
apm: Connection version 1.2
apm: AC on line, battery statys high, battery life 100%
apm: battery flag 0x01, battery life unknown

BUG: soft lockup detected on CPU#0!
[<c011d102>] update_process_times+0x22/0x60
[<c0106441>] timer_interrupt+0x41/0x80
[<c0134773>] handle_IRQ_event+0x33/0x60
[<c0134813>] __do_IRQ+0x73/0xd0
[<c0105171>] do_IRQ+0x31/0x70
[<c0103b1a>] common_interrupt+0x1a/0x20
[<c0409200>] do_cyrix_devid+0x60/0x90
==========================

Any idea on what can be happening here?

Regards,
Nicolas.

PS: please CC me if answering this message, as I am not subscribed to the list
PPS: I have read the list FAQ before posting, but still if this message is not appropriate to the list, then sorry.

#1 lore raw

Ar Sad, 2006-11-04 am 00:06 +0100, ysgrifennodd Nicolas FR:

Quoted 5 lines

I have thrown a bunch of "printk(KERN_INFO "apm: I am here\n");" and noticed the crash is happening just when calling apm_event_handler(); and does not even execute any instruction in this function... This is the point I don't understand, how can it crash just on calling a function and not executing the first statement in this function?

APM is BIOS code so the assembler inlines trap into the firmware and the firmware sometimes isn't very good, particularly the 32bit entry points which are not used by a certain other vendors products.

In those cases you need to trace the asm code in the firmware and see if the firmware is buggy.

author
#2 lore raw

I have finally traced down the bug (Tatung webpad TWN-5213CU with SC3200 CPU):

- in apm_mainloop there is an for(;;) loop, which set a scheduler_timeout (1second) and then calls apm_event_handler().

- apm_event_handler does some checks and calls check_events();

- check_events has a loop:

	while ((event = get_event()) != 0) { switch (event) {...} }

The module was "crashing" on my box because it keeps on receiving events=APM_UPDATE_TIME meaning that it would never get out of the while() loop in check_events. I need to do some tests but I might simply fix this by ignoring APM_UPDATE_TIME events. I first thought replacing the "while ((event = get_event()) != 0)" by an "if ((event = get_event()) != 0)" but maybe I would miss other events doing this?

Best regards,
Nicolas.

PS: btw, thanks for your email that's really nice to answer every message on this mailing list.

Quoted 15 lines · Alan Cox

Ar Sad, 2006-11-04 am 00:06 +0100, ysgrifennodd Nicolas FR:

Quoted 5 lines

I have thrown a bunch of "printk(KERN_INFO "apm: I am here\n");" and noticed the crash is happening just when calling apm_event_handler(); and does not even execute any instruction in this function... This is the point I don't understand, how can it crash just on calling a function and not executing the first statement in this function?

APM is BIOS code so the assembler inlines trap into the firmware and the firmware sometimes isn't very good, particularly the 32bit entry points which are not used by a certain other vendors products.

In those cases you need to trace the asm code in the firmware and see if the firmware is buggy.

#3 lore raw

Ar Sul, 2006-11-05 am 22:33 +0100, ysgrifennodd Nicolas FR:

Quoted 3 lines

The module was "crashing" on my box because it keeps on receiving events=APM_UPDATE_TIME meaning that it would never get out of the while() loop in check_events. I need to do some tests but I might

That's a BIOS bug

Quoted 1 line

simply fix this by ignoring APM_UPDATE_TIME events. I first thought

If that works can you run dmidecode on your box and post me the output, from that we can add a blacklist entry to automatically handle this.