2.6.2-rc2-bk1 oopses on boot (ACPI patch)
Already reported, but I'll do so once again, since it looks like
in a short while I won't be able to boot official kernels in my current config...
Original report here:
http://www.ussg.iu.edu/hypermail/linux/kernel/0312.3/0442.html
Please advise whether I should give up cpufreq for now - I really
don't want to bang my head against a wall.
Thanks in advance,
--alessandro
"Two rivers run too deep
The seasons change and so do I"
(U2, "Indian Summer Sky")
Quoted 8 lines · Alessandro Suardi
Already reported, but I'll do so once again, since it looks like
in a short while I won't be able to boot official kernels in my current config...Original report here:
http://www.ussg.iu.edu/hypermail/linux/kernel/0312.3/0442.html
Divide by zero. Looks like ACPI is now passing bad values into the frequency change notifier.
Does this make the oops go away?
drivers/cpufreq/cpufreq.c renamed from drivers/cpufreq/cpufreq.c~cpufreq-workaround +5 -0
@@ -928,6 +928,11 @@ void cpufreq_notify_transition(struct cpreturn ;/* Only valid if we're in the resume process where * everyone knows what CPU frequency we are at */ +if (freqs->new ==0 ) { +printk ("%s: avoiding div-by-zero\n" , __FUNCTION__); +return ; + } +down_read (&cpufreq_notifier_rwsem);switch (state) {case CPUFREQ_PRECHANGE :
_
Quoted 5 lines · Andrew Morton
Divide by zero. Looks like ACPI is now passing bad values into the frequency change notifier.
Does this make the oops go away?
Other values will still cause divide-by-zero (any divisor in 0..9 will do it). Besides, we're dividing with _old_, not new, so that's the one we should likely check.
Linus
Quoted 6 lines · Linus Torvalds
Quoted 3 lines · Andrew Morton
Divide by zero. Looks like ACPI is now passing bad values into the frequency change notifier.
Quoted 6 lines
Quoted 1 line
Does this make the oops go away?
Other values will still cause divide-by-zero (any divisor in 0..9 will do it). Besides, we're dividing with _old_, not new, so that's the one we should likely check.
Linus
Indeed... I get two of the debug printks from the patch, but in the
end I still oops due to a div-by-zero with EIP in time_cpufreq_notifier.
I'll try and look into Linus' suggestion about printing out stuff from
adjust_jiffies() in cpufreq.c and will report later.
Thanks,
--alessandro
"Two rivers run too deep
The seasons change and so do I"
(U2, "Indian Summer Sky")
Quoted 11 lines · Andrew Morton
Quoted 7 lines · Alessandro Suardi
Already reported, but I'll do so once again, since it looks like
in a short while I won't be able to boot official kernels in my current config...Original report here:
http://www.ussg.iu.edu/hypermail/linux/kernel/0312.3/0442.html
Divide by zero. Looks like ACPI is now passing bad values into the frequency change notifier.
It is a common problem with Dell's DSDT implementation which does not follow ACPI spec and it's been going on for ages. From the original report:
cpufreq: CPU0 - ACPI performance management activated
cpufreq: *P0: 1Mhz, 0 mW, 0 uS
cpufreq: P1: 0Mhz, 0 mW, 0 uS
divide error: 0000 [#1]
As you can see all data is bogus... Patching DSDT cures it for sure, sometimes CONFIG_ACPI_RELAXED_AML helps as well.
I suppose ACPI P-states driver could check frequencies/latencies and refuse to activate if the are bogus.
Signature · 1 line
Dmitry
Quoted 7 lines · Dmitry Torokhov
Quoted 2 lines
Divide by zero. Looks like ACPI is now passing bad values into the frequency change notifier.
It is a common problem with Dell's DSDT implementation which does not follow ACPI spec and it's been going on for ages. From the original report:
Quoted 7 lines
cpufreq: CPU0 - ACPI performance management activated
cpufreq: *P0: 1Mhz, 0 mW, 0 uS
cpufreq: P1: 0Mhz, 0 mW, 0 uS
divide error: 0000 [#1]As you can see all data is bogus... Patching DSDT cures it for sure, sometimes
CONFIG_ACPI_RELAXED_AMLhelps as well.
Please send me your DSDT and output of dmidecode, and ideally what a proper DSDT should show in this case (I'm not familiar enough with what all the various ACPI tables should contain), and I'll take it up with the BIOS programmers for that platform.
Thanks,
Matt
Signature · 4 lines
Matt Domsch Sr. Software Engineer, Lead Engineer Dell Linux Solutions linux.dell.com & www.dell.com/linux Linux on Dell mailing lists @ http://lists.us.dell.com
Quoted 14 lines · Matt Domsch
Quoted 12 lines · Dmitry Torokhov
Quoted 2 lines
Divide by zero. Looks like ACPI is now passing bad values into the frequency change notifier.
It is a common problem with Dell's DSDT implementation which does not follow ACPI spec and it's been going on for ages. From the original report:
cpufreq: CPU0 - ACPI performance management activated
cpufreq: *P0: 1Mhz, 0 mW, 0 uS
cpufreq: P1: 0Mhz, 0 mW, 0 uS
divide error: 0000 [#1]
Quoted 8 lines
Quoted 2 lines
As you can see all data is bogus... Patching DSDT cures it for sure, sometimes
CONFIG_ACPI_RELAXED_AMLhelps as well.Please send me your DSDT and output of dmidecode, and ideally what a proper DSDT should show in this case (I'm not familiar enough with what all the various ACPI tables should contain), and I'll take it up with the BIOS programmers for that platform.
While appreciating your offer, I'd like to remind that this works
perfectly prior to the 20031203 ACPI patch. Indeed, this is what 2.6.1 vanilla says in that area:
cpufreq: CPU0 - ACPI performance management activated.
cpufreq: *P0: 1800 MHz, 0 mW, 250 uS
cpufreq: P1: 1200 MHz, 0 mW, 250 uS
Attaching the gzipped dmesg for my 2.6.1 boot - let me know if
you want anyway dmidecode output and DSDT; for this latter I'll have to ask for instructions (or is the output of a simple 'cat /proc/acpi/dsdt' enough ?).
--alessandro
"Two rivers run too deep
The seasons change and so do I"
(U2, "Indian Summer Sky")
Quoted 6 lines · Alessandro Suardi
Already reported, but I'll do so once again, since it looks like
in a short while I won't be able to boot official kernels in my current config...http://www.ussg.iu.edu/hypermail/linux/kernel/0312.3/0442.html
Can you make adjust_jiffies() print out its arguments (it's in drivers/cpufreq/cpufreq.c).
It looks like cpufreq_scale() gets a divide-by-zero or an overflow on one of
l_p_j_ref, l_p_j_ref_freq, ci->new
and just printing out those values would be interesting.
That said, the code is crap anyway. It does various divides without actually testing for any sanity at all, and tries to "avoid overflow" by totally bogus methods, instead of just using the 64-bit do_div64().
Dominic? Dave? Suggestions about nicer failure modes?
Linus
Quoted 10 lines · Linus Torvalds
Quoted 5 lines · Alessandro Suardi
Already reported, but I'll do so once again, since it looks like
in a short while I won't be able to boot official kernels in my current config...http://www.ussg.iu.edu/hypermail/linux/kernel/0312.3/0442.html
Quoted 7 lines
Can you make
adjust_jiffies()print out its arguments (it's indrivers/cpufreq/cpufreq.c).It looks like
cpufreq_scale()gets a divide-by-zero or an overflow on one ofl_p_j_ref, l_p_j_ref_freq, ci->newand just printing out those values would be interesting.
Assuming the late hour (hmm, early by now) hasn't crossed my
eyes entirely the three above entities are %lu, %u, %u... so this line
printk("CPUFREQ DEBUG: [%lu] [%u] [%u]\n", l_p_j_ref, l_p_j_ref_freq, ci->new);
as both first and last instruction in adjust_jiffies() turns up the same values, which are 1773568, 1, 0.
Side-note, since master penguin is looking... after the oops
all SysRq stuff keeps working - except Alt-SysRq-B; the atkbd.c code tells me the keyboard says "too many keys pressed". K, T, P just do their job fine.
(yeah, okay, Alt-SysRq-O prints Power Off but obviously doesn't).
Thanks,
--alessandro
"Two rivers run too deep
The seasons change and so do I"
(U2, "Indian Summer Sky")
Quoted 5 lines · Alessandro Suardi
printk("CPUFREQ DEBUG: [%lu] [%u] [%u]\n", l_p_j_ref, l_p_j_ref_freq, ci->new);as both first and last instruction in
adjust_jiffies()turns up the same values, which are 1773568, 1, 0.
The ACPI tables report totally bogus CPU frequencies -- 1 and 0 MHz. I'm surprised this differs between 2.6.0 and 2.6.x-mm... Len, any idea?
Quoted 16 lines · Linus Torvalds
Quoted 6 lines · Alessandro Suardi
Already reported, but I'll do so once again, since it looks like
in a short while I won't be able to boot official kernels in my current config...http://www.ussg.iu.edu/hypermail/linux/kernel/0312.3/0442.htmlCan you make
adjust_jiffies()print out its arguments (it's indrivers/cpufreq/cpufreq.c).It looks like
cpufreq_scale()gets a divide-by-zero or an overflow on one of
Quoted 8 lines
l_p_j_ref, l_p_j_ref_freq, ci->newand just printing out those values would be interesting.
That said, the code is crap anyway.
It does various divides without
actually testing for any sanity at all,
CPUfreq and the CPUfreq timing code _need_ to rely on the CPU frequencies being reported by the drivers. If they're wrong all timing will be wrong[1]... Nonetheless, a fix for the acpi driver which aborts on such "zero" MHz reports has already been sent to Len for reviewal [2].
Quoted 2 lines
and tries to "avoid overflow" by
totally bogus methods, instead of just using the 64-bitdo_div64().
Agreed, will fix it.
Dominik
[1] Especially as the pmtmr also uses tsc for the delay() routines...
[2] http://marc.theaimsgroup.com/?l=acpi4linux&m=107421039607335&w=2
Quoted 16 lines · Linus Torvalds
Quoted 6 lines · Alessandro Suardi
Already reported, but I'll do so once again, since it looks like
in a short while I won't be able to boot official kernels in my current config...http://www.ussg.iu.edu/hypermail/linux/kernel/0312.3/0442.htmlCan you make
adjust_jiffies()print out its arguments (it's indrivers/cpufreq/cpufreq.c).It looks like
cpufreq_scale()gets a divide-by-zero or an overflow on one of
Quoted 7 lines
l_p_j_ref, l_p_j_ref_freq, ci->newand just printing out those values would be interesting.
That said, the code is crap anyway. It does various divides without actually testing for any sanity at all, and tries to "avoid overflow" by totally bogus methods, instead of just using the 64-bit
do_div64().
Does this look better?
Dominik
Use do_div on 32-bit archs in cpufreq_scale, and native "/" on 64-bit archs.
include/linux/cpufreq.h | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-)
include/linux/cpufreq.h +11 -11
@@ -110,24 +110,24 @@* @div: divisor * @mult: multiplier * -* Needed for loops_per_jiffy and similar calculations. We do it -* this way to avoid math overflow on 32-bit machines. This will -* become architecture dependent once high-resolution-timer is -* merged (or any other thing that introduces sc_math.h). * * new = old * mult / div */ static inline unsigned long cpufreq_scale (unsigned long old,u_int div,u_int mult) { -unsigned long val, carry; +#if BITS_PER_LONG ==32 - mult /=100 ; - div /=100 ; - val = (old / div) * mult; - carry = old % div; - carry = carry * mult / div; +u64 result = ((u64 ) old) * ((u64 ) mult); +do_div (result, div); +return (unsigned long ) result; -return carry + val; +#elif BITS_PER_LONG ==64 + +unsigned long result = old * ((u64 ) mult); + result /= div; +return result; + +#endif };/*********************************************************************