Bug#434557: Acknowledgement (Random kernel panic on boot with MacBook)

2007-07-25 Thread Tim Hull

I applied the attached patch (from Ubuntu) to the latest 2.6.22 kernel from
Sid and it resolved the problem.  Could this be looked into?



On 7/24/07, Debian Bug Tracking System [EMAIL PROTECTED] wrote:


Thank you for the problem report you have sent regarding Debian.
This is an automatically generated reply, to let you know your message has
been received.  It is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
Debian Kernel Team debian-kernel@lists.debian.org

If you wish to submit further information on your problem, please send
it to [EMAIL PROTECTED] (and *not* to
[EMAIL PROTECTED]).

If you have filed this report in error and wish to close it, please
send mail to [EMAIL PROTECTED] with an explanation
why the bug report should be closed.

Please do not reply to the address at the top of this message,
unless you wish to report a problem with the Bug-tracking system.

Debian bug tracking system administrator
(administrator, Debian Bugs database)

diff -urp a/init/calibrate.c b/init/calibrate.c
--- a/init/calibrate.c	2006-10-02 11:39:32.0 -0400
+++ b/init/calibrate.c	2007-01-27 16:39:35.0 -0500
@@ -1,5 +1,7 @@
 /* calibrate.c: default delay calibration
  *
+ * vim:sw=8 noet
+ *
  * Excised from init/main.c
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
@@ -7,9 +9,36 @@
 #include linux/sched.h
 #include linux/delay.h
 #include linux/init.h
+#include linux/dmi.h
+#include asm/io.h
 
 #include asm/timex.h
 
+/* On Macbook we have trouble calibrating the delay loop due to excessive
+ * latency in the system management interrupt.  We fix this problem by
+ * disabling the legacy USB function of the SMC during delay loop
+ * calibration.  From Intel ICH7 manual, this is bit 3 of SMI_EN register
+ * located at 0x430.
+ */
+static int __initdata macbook_calibrate_quirk;
+
+static int __init init_macbook_calibrate_quirk (struct dmi_system_id *d)
+{
+	printk(KERN_WARNING %s detected (calibration quirk enabled)\n,
+	   d-ident);
+	macbook_calibrate_quirk = 1;
+	return 0;
+}
+
+static struct dmi_system_id __initdata calibrate_quirks[] = {
+	{
+	 .callback = init_macbook_calibrate_quirk,
+	 .ident = Apple MacBook,
+	 .matches = {DMI_MATCH(DMI_PRODUCT_NAME, MacBook1,1),},
+	 },
+	{},
+};
+
 static unsigned long preset_lpj;
 static int __init lpj_setup(char *str)
 {
@@ -37,8 +66,16 @@ static unsigned long __devinit calibrate
 	unsigned long tsc_rate_min, tsc_rate_max;
 	unsigned long good_tsc_sum = 0;
 	unsigned long good_tsc_count = 0;
+	unsigned long saved_smi_en = 0;
 	int i;
 
+	if (macbook_calibrate_quirk)
+	{
+		saved_smi_en = inl(0x430);
+		/* mask out bit 3 */
+		outl(saved_smi_en  ~8, 0x430);
+	}
+
 	if (read_current_timer(pre_start)  0 )
 		return 0;
 
@@ -94,6 +131,9 @@ static unsigned long __devinit calibrate
 		}
 	}
 
+	if (macbook_calibrate_quirk)
+		outl(saved_smi_en, 0x430);
+
 	if (good_tsc_count)
 		return (good_tsc_sum/good_tsc_count);
 
@@ -117,6 +157,8 @@ void __devinit calibrate_delay(void)
 	unsigned long ticks, loopbit;
 	int lps_precision = LPS_PREC;
 
+	dmi_check_system(calibrate_quirks);
+
 	if (preset_lpj) {
 		loops_per_jiffy = preset_lpj;
 		printk(Calibrating delay loop (skipped)... 


Bug#434540: MacBook makes subtle whining noise when idle since 2.6.21

2007-07-24 Thread Tim Hull

Package: linux-image-2.6-686
Version: 2.6.22-1

Since kernel 2.6.21, my MacBook has made a subtle whining noise when idle.
This happens when using the Debian stock kernels from testing and unstable,
but also when using other kernels.  I believe it has something to do with
certain ACPI power-saving modes and/or the switch from 250hz kernel timing
to a tickless kernel.  2.6.18 as shipped in Etch does NOT exhibit this
problem, and disabling C3/C4 ACPI C-states is a functional workaround for
2.6.21+ (though doing so results in the loss of some battery life).
However, C3/C4 ACPI C-states work fine in the aforementioned 2.6.18 kernel,
so the HZ timing seems like a more likely root cause.


Bug#434557: Random kernel panic on boot with MacBook

2007-07-24 Thread Tim Hull

Package: kernel-image-2.6-686
Version: 2.6.22-1

On my MacBook Core Duo, I am experiencing random kernel panics on boot.
The message I am getting is as follows:

Kernel panic - not syncing: IO-APIC + timer doesn't work!

This appears about 50% of the time on boot, and happens on every version of
the Debian kernel including that shipped with Etch and the latest version.

This can be worked around by using the lpj= kernel parameter on boot
(lpj=733 for a 1.83GHz MacBook).
Ubuntu has the same issue (Bug 54621 on Launchpad -
https://bugs.launchpad.net/bugs/54621) and a fix mentioned in that thread
has apparently been committed.

Could this be fixed in the Debian kernel?