Skip to contentSkip to conversation

Disable SMP on the MacBook by default

PATCH In review Marco Gerards 4 participants 11 messages Sep 13, 2006 – Sep 14, 2006 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Disable SMP on the MacBook by default

Hi,

As I mentioned before, SMP is non functional on the MacBook. It even makes the machine crash. I am using a patch to disable SMP support in the case a MacBook was detected. I have included this patch at the end of this email.

Because this will be useful for the LiveCD, I hope you will commit this patch. Please let me know if there are issues that I need to take care of before it can be committed.

Thanks,
Marco

xen/arch/x86/dmi_scan.c +21 -0
diff -r 3e31c5e160cf xen/arch/x86/dmi_scan.c
@@ -8,6 +8,7 @@
 #include <xen/acpi.h>
 #include <asm/io.h>
 #include <asm/system.h>
+#include <xen/smp.h>
 #include <xen/dmi.h>
 
 #define bt_ioremap(b,l)  ((u8 *)__acpi_map_table(b,l))
@@ -181,6 +182,15 @@
 	return 0;
 }
 
+/*
+ * Disable SMP.  */
+static int __init dmi_disable_smp(struct dmi_blacklist *d)
+{
+	printk(KERN_NOTICE "%s detected: SMP support disabled\n", d->ident);
+	opt_nosmp = 1;
+	return 0;
+}
+
 
 #ifdef CONFIG_ACPI_SLEEP
 static __init int reset_videomode_after_s3(struct dmi_blacklist *d)
@@ -262,6 +272,17 @@
 			MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
 			NO_MATCH, NO_MATCH, NO_MATCH
 			} },
+
+	/*
+	 * SMP support is broken for the MacBook.  Disable SMP to
+	 * prevent further problems.
+	 */
+	 {
+	   .callback = dmi_disable_smp,
+	   .ident = "Apple MacBook",
+	   .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "MacBook1,1"),},
+	 },
+
 #ifdef CONFIG_ACPI_SLEEP
 	{ reset_videomode_after_s3, "Toshiba Satellite 4030cdt", { /* Reset video mode after returning from ACPI S3 sleep */
 			MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
xen/arch/x86/setup.c +1 -1
diff -r 3e31c5e160cf xen/arch/x86/setup.c
@@ -40,7 +40,7 @@
 #endif
 
 /* opt_nosmp: If true, secondary processors are ignored. */
-static int opt_nosmp = 0;
+int opt_nosmp = 0;
 boolean_param("nosmp", opt_nosmp);
 
 /* maxcpus: maximum number of CPUs to activate. */
xen/include/xen/smp.h +2 -0
diff -r 3e31c5e160cf xen/include/xen/smp.h
@@ -111,4 +111,6 @@
 
 #define smp_processor_id() raw_smp_processor_id()
 
+extern int opt_nosmp ;
+
 #endif
#1 lore raw
Quoted 4 lines

As I mentioned before, SMP is non functional on the MacBook. It even makes the machine crash. I am using a patch to disable SMP support in the case a MacBook was detected. I have included this patch at the end of this email.

Am I totally confused, or wasn't this solved by some update to grub legacy to change A20 gate stuff?

Thanks,
Ian

Quoted 20 lines

Because this will be useful for the LiveCD, I hope you will commit this patch. Please let me know if there are issues that I need to take care of before it can be committed.

Thanks,
Marco

diff -r 3e31c5e160cf xen/arch/x86/dmi_scan.c

xen/arch/x86/dmi_scan.c +1 -0
@@ -8,6 +8,7 @@
 #include <xen/acpi.h>
 #include <asm/io.h>
 #include <asm/system.h>
+#include <xen/smp.h>
 #include <xen/dmi.h>
 
 #define bt_ioremap(b,l)  ((u8 *)__acpi_map_table(b,l))

xen/arch/x86/dmi_scan.c line 189

Quoted 8 lines
xen/arch/x86/dmi_scan.c +5 -0
@@ -181,6 +182,15 @@
 	return 0;
 }
 
+/*
+ * Disable SMP.  */
+static int __init dmi_disable_smp(struct dmi_blacklist *d)
+{
+	printk(KERN_NOTICE "%s detected: SMP support disabled\n",

d->ident);

Quoted 14 lines
xen/arch/x86/dmi_scan.c +7 -0
+	opt_nosmp = 1;
+	return 0;
+}
+
 
 #ifdef CONFIG_ACPI_SLEEP
 static __init int reset_videomode_after_s3(struct dmi_blacklist *d)
@@ -262,6 +272,17 @@
 			MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
 			NO_MATCH, NO_MATCH, NO_MATCH
 			} },
+
+	/*
+	 * SMP support is broken for the MacBook.  Disable SMP to

xen/arch/x86/dmi_scan.c line 287

Quoted 10 lines
xen/arch/x86/dmi_scan.c +8 -0
+	 * prevent further problems.
+	 */
+	 {
+	   .callback = dmi_disable_smp,
+	   .ident = "Apple MacBook",
+	   .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "MacBook1,1"),},
+	 },
+
 #ifdef CONFIG_ACPI_SLEEP
 	{ reset_videomode_after_s3, "Toshiba Satellite 4030cdt", { /*

Reset

Quoted 30 lines

video mode after returning from ACPI S3 sleep */
MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
diff -r 3e31c5e160cf xen/arch/x86/setup.c

xen/arch/x86/setup.c +1 -1
@@ -40,7 +40,7 @@
 #endif
 
 /* opt_nosmp: If true, secondary processors are ignored. */
-static int opt_nosmp = 0;
+int opt_nosmp = 0;
 boolean_param("nosmp", opt_nosmp);
 
 /* maxcpus: maximum number of CPUs to activate. */

diff -r 3e31c5e160cf xen/include/xen/smp.h

xen/include/xen/smp.h +2 -0
@@ -111,4 +111,6 @@
 
 #define smp_processor_id() raw_smp_processor_id()
 
+extern int opt_nosmp ;
+
 #endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

"Ian Pratt" <[email protected]> writes:

Hi Ian,

Quoted 7 lines
Quoted 4 lines

As I mentioned before, SMP is non functional on the MacBook. It even makes the machine crash. I am using a patch to disable SMP support in the case a MacBook was detected. I have included this patch at the end of this email.

Am I totally confused, or wasn't this solved by some update to grub legacy to change A20 gate stuff?

The A20 gate patch was to make sure GRUB works on the Intel Mac. The old way to enable the A20 gate is not present anymore. So this patch is also required when using the Intel Mac, but unrelated.

The SMP issue can be avoided from GRUB when you press the "right arrow" key instead of "enter" to boot. Someone mentioned this on the mailinglist, perhaps that is why you mixed up the two?

Thanks,
Marco

#3 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line

As I mentioned before, SMP is non functional on the MacBook. It

even

Quoted 1 line
Quoted 1 line
Quoted 1 line

makes the machine crash. I am using a patch to disable SMP support

in

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

the case a MacBook was detected. I have included this patch at the end of this email.

Am I totally confused, or wasn't this solved by some update to grub legacy to change A20 gate stuff?

Quoted 7 lines

The A20 gate patch was to make sure GRUB works on the Intel Mac. The old way to enable the A20 gate is not present anymore. So this patch is also required when using the Intel Mac, but unrelated.

The SMP issue can be avoided from GRUB when you press the "right arrow" key instead of "enter" to boot. Someone mentioned this on the mailinglist, perhaps that is why you mixed up the two?

This does kinda suggest that a further Grub patch might be part of the solution, no?

Are there any issues with SMP linux 2.6.16 at all?

Any idea what's going on?

What are distros link Ubuntu using for booting on MacBook? Do they go with bootcamp/grub, or elilo?

Thanks,
Ian

#4 lore raw

"Ian Pratt" <[email protected]> writes:

[...]

Quoted 6 lines
Quoted 3 lines

The SMP issue can be avoided from GRUB when you press the "right arrow" key instead of "enter" to boot. Someone mentioned this on the mailinglist, perhaps that is why you mixed up the two?

This does kinda suggest that a further Grub patch might be part of the solution, no?

This is something I looked at, of course. The GRUB code doesn't make a difference between "right arrow" and return. Besides that, it doesn't work with the timeout either.

Quoted 1 line

Are there any issues with SMP linux 2.6.16 at all?

No, unless you disable ACPI.

The FreeBSD and NetBSD hackers have encountered the same problem. They were not able to come up with a patch yet.

Quoted 1 line

Any idea what's going on?

The second core can not be initialized because the INIT IPI does not arrive. It only happens on the MacBook and not on the desktop Intel Macs. On the MacBook the second core is put into deep sleep mode. It should get out of sleep mode when an IPI or interrupt is received.

That does not happen. It looks like the keyboard interrupt does wakeup the second core, after which the IPI is received.

The annoying thing is that both the keyboard handling and ACPI on the Intel Mac is a big mess. There are a lot of bugs. It could also be a bug in the processor itself. The reason why Windows and Linux work is that the ACPI interpreter is used, perhaps this also has a side effect of waking up the second core.

Quoted 2 lines

What are distros link Ubuntu using for booting on MacBook? Do they go with bootcamp/grub, or elilo?

Sorry, I am not sure what you mean. English is not my native language. Do you mean which bootloaders they use by default?

When I was installing Ubuntu for the first time on the MacBook, it tried installing GRUB and failed. First I tried lilo which worked. Later I started using GRUB. I haven't seen ELILO being used anywhere.

--
Marco

#5 lore raw
Quoted 7 lines · Marco Gerards

"Ian Pratt" <[email protected]> writes:

[...]

Quoted 3 lines
Quoted 3 lines

The SMP issue can be avoided from GRUB when you press the "right arrow" key instead of "enter" to boot. Someone mentioned this on the mailinglist, perhaps that is why you mixed up the two?

Quoted 6 lines
Quoted 2 lines

This does kinda suggest that a further Grub patch might be part of the solution, no?

This is something I looked at, of course. The GRUB code doesn't make a difference between "right arrow" and return. Besides that, it doesn't work with the timeout either.

Hm... The strange thing is, hitting the "Return" key crashed xen every time. Using the "Rigth arrow" key made xen bootable evry time from grub. So there must be a difference.

Quoted 26 lines
Quoted 1 line

Are there any issues with SMP linux 2.6.16 at all?

No, unless you disable ACPI.

The FreeBSD and NetBSD hackers have encountered the same problem. They were not able to come up with a patch yet.

Quoted 1 line

Any idea what's going on?

The second core can not be initialized because the INIT IPI does not arrive. It only happens on the MacBook and not on the desktop Intel Macs. On the MacBook the second core is put into deep sleep mode. It should get out of sleep mode when an IPI or interrupt is received.

That does not happen. It looks like the keyboard interrupt does wakeup the second core, after which the IPI is received.

The annoying thing is that both the keyboard handling and ACPI on the Intel Mac is a big mess. There are a lot of bugs. It could also be a bug in the processor itself. The reason why Windows and Linux work is that the ACPI interpreter is used, perhaps this also has a side effect of waking up the second core.

Quoted 2 lines

What are distros link Ubuntu using for booting on MacBook? Do they go with bootcamp/grub, or elilo?

Quoted 6 lines

Sorry, I am not sure what you mean. English is not my native language. Do you mean which bootloaders they use by default?

When I was installing Ubuntu for the first time on the MacBook, it tried installing GRUB and failed. First I tried lilo which worked. Later I started using GRUB. I haven't seen ELILO being used anywhere.

I use the patched grub and elilo.

Quoted 9 lines

--
Marco

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#6 lore raw

I had also many crashes with xen until. I did some search on google and found a patch on the xen ml for the bridging code in linux which cused the crashes. Have atached the patch.

cu

Edgar (gimli) Hucek

Quoted 61 lines · gimli
Quoted 4 lines · Marco Gerards

"Ian Pratt" <[email protected]> writes:

[...]

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

The SMP issue can be avoided from GRUB when you press the "right arrow" key instead of "enter" to boot. Someone mentioned this on the mailinglist, perhaps that is why you mixed up the two?

This does kinda suggest that a further Grub patch might be part of the solution, no?

This is something I looked at, of course. The GRUB code doesn't make a difference between "right arrow" and return. Besides that, it doesn't work with the timeout either.

Hm... The strange thing is, hitting the "Return" key crashed xen every time. Using the "Rigth arrow" key made xen bootable evry time from grub. So there must be a difference.

Quoted 21 lines
Quoted 1 line

Are there any issues with SMP linux 2.6.16 at all?

No, unless you disable ACPI.

The FreeBSD and NetBSD hackers have encountered the same problem. They were not able to come up with a patch yet.

Quoted 1 line

Any idea what's going on?

The second core can not be initialized because the INIT IPI does not arrive. It only happens on the MacBook and not on the desktop Intel Macs. On the MacBook the second core is put into deep sleep mode. It should get out of sleep mode when an IPI or interrupt is received.

That does not happen. It looks like the keyboard interrupt does wakeup the second core, after which the IPI is received.

The annoying thing is that both the keyboard handling and ACPI on the Intel Mac is a big mess. There are a lot of bugs. It could also be a bug in the processor itself. The reason why Windows and Linux work is that the ACPI interpreter is used, perhaps this also has a side effect of waking up the second core.

Quoted 8 lines
Quoted 2 lines

What are distros link Ubuntu using for booting on MacBook? Do they go with bootcamp/grub, or elilo?

Sorry, I am not sure what you mean. English is not my native language. Do you mean which bootloaders they use by default?

When I was installing Ubuntu for the first time on the MacBook, it tried installing GRUB and failed. First I tried lilo which worked. Later I started using GRUB. I haven't seen ELILO being used anywhere.

I use the patched grub and elilo.

Quoted 9 lines

--
Marco

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 5 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

include/linux/netfilter_bridge.h +2 -2
@@ -73,14 +73,14 @@ void nf_bridge_maybe_copy_header(struct 
 			memcpy(skb->data - 18, skb->nf_bridge->data, 18);
 			skb_push(skb, 4);
 		} else
-			memcpy(skb->data - 16, skb->nf_bridge->data, 16);
+			memcpy(skb->data - 14, skb->nf_bridge->data, 14);
 	}
 }
 
 static inline
 void nf_bridge_save_header(struct sk_buff *skb)
 {
-        int header_size = 16;
+        int header_size = 14;
 
 	if (skb->protocol == __constant_htons(ETH_P_8021Q))
 		header_size = 18;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#7 lore raw
Quoted 2 lines

I had also many crashes with xen until. I did some search on google

and

Quoted 4 lines

found
a patch on the xen ml for the bridging code in linux which cused the crashes.
Have atached the patch.

I'm pretty sure a 'better' fix from upstream linux was put in the xen-unstable patch queue sometime back.

As I recall, it was the sky2 driver that exhibited this.

Would be good if you could confirm the fix.

Thanks,
Ian

Quoted 12 lines

cu

Edgar (gimli) Hucek

Quoted 7 lines · gimli
Quoted 6 lines · Marco Gerards

"Ian Pratt" <[email protected]> writes:

[...]

Quoted 2 lines
Quoted 2 lines

The SMP issue can be avoided from GRUB when you press the "right arrow" key instead of "enter" to boot. Someone mentioned this on

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

mailinglist, perhaps that is why you mixed up the two?

This does kinda suggest that a further Grub patch might be part of

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

solution, no?

This is something I looked at, of course. The GRUB code doesn't

make

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

a difference between "right arrow" and return. Besides that, it doesn't work with the timeout either.

Hm... The strange thing is, hitting the "Return" key crashed xen

every

Quoted 2 lines

time.

Quoted 1 line

Using the "Rigth arrow" key made xen bootable evry time from grub.

So

Quoted 11 lines

there must

Quoted 10 lines

be a difference.

Quoted 8 lines
Quoted 1 line

Are there any issues with SMP linux 2.6.16 at all?

No, unless you disable ACPI.

The FreeBSD and NetBSD hackers have encountered the same problem. They were not able to come up with a patch yet.

Quoted 1 line

Any idea what's going on?

The second core can not be initialized because the INIT IPI does

not

Quoted 1 line
Quoted 1 line
Quoted 1 line

arrive. It only happens on the MacBook and not on the desktop

Intel

Quoted 1 line
Quoted 1 line
Quoted 1 line

Macs. On the MacBook the second core is put into deep sleep mode.

It

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

should get out of sleep mode when an IPI or interrupt is received.

That does not happen. It looks like the keyboard interrupt does wakeup the second core, after which the IPI is received.

The annoying thing is that both the keyboard handling and ACPI on

the

Quoted 1 line
Quoted 1 line
Quoted 1 line

Intel Mac is a big mess. There are a lot of bugs. It could also

be a

Quoted 1 line
Quoted 1 line
Quoted 1 line

bug in the processor itself. The reason why Windows and Linux work

is

Quoted 1 line
Quoted 1 line
Quoted 1 line

that the ACPI interpreter is used, perhaps this also has a side

effect

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

of waking up the second core.

Quoted 1 line

What are distros link Ubuntu using for booting on MacBook? Do they

go

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

with bootcamp/grub, or elilo?

Sorry, I am not sure what you mean. English is not my native language. Do you mean which bootloaders they use by default?

When I was installing Ubuntu for the first time on the MacBook, it tried installing GRUB and failed. First I tried lilo which worked. Later I started using GRUB. I haven't seen ELILO being used

anywhere.

Quoted 19 lines
Quoted 19 lines

I use the patched grub and elilo.

Quoted 9 lines

--
Marco

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#8 lore raw
In reply to gimli
Quoted 11 lines · gimli
Quoted 10 lines · Marco Gerards

"Ian Pratt" <[email protected]> writes:

[...]

Quoted 5 lines
Quoted 3 lines

The SMP issue can be avoided from GRUB when you press the "right arrow" key instead of "enter" to boot. Someone mentioned this on the mailinglist, perhaps that is why you mixed up the two?

This does kinda suggest that a further Grub patch might be part of the solution, no?

Quoted 7 lines
Quoted 3 lines

This is something I looked at, of course. The GRUB code doesn't make a difference between "right arrow" and return. Besides that, it doesn't work with the timeout either.

Hm... The strange thing is, hitting the "Return" key crashed xen every time. Using the "Rigth arrow" key made xen bootable evry time from grub. So there must be a difference.

What I am thinking about is that it is a difference related to interrupts or so. Another thing can be that the Legacy BIOS code has a bug. There is another known bug in this code already related to keyboard handling. But this is all speculation. There is nothing in GRUB that even remotely looks like something that can cause such a problem.

[...]

Quoted 5 lines
Quoted 3 lines

When I was installing Ubuntu for the first time on the MacBook, it tried installing GRUB and failed. First I tried lilo which worked. Later I started using GRUB. I haven't seen ELILO being used anywhere.

I use the patched grub and elilo.

Right, otherwise it will not work at all.

--
Marco

#9 lore raw
In reply to Marco Gerards
Quoted 7 lines · Marco Gerards

The second core can not be initialized because the INIT IPI does not arrive. It only happens on the MacBook and not on the desktop Intel Macs. On the MacBook the second core is put into deep sleep mode. It should get out of sleep mode when an IPI or interrupt is received.

That does not happen. It looks like the keyboard interrupt does wakeup the second core, after which the IPI is received.

Have you tried tickling the second core with some interrupt or NMI IPIs from the boot core? Sounds like a slightly harder kick is required.

What about tracing what the Linux ACPI interpreter kicks out in terms of hardware accesses? Perhaps you can work out what the ACPI goop actually does in low-level terms, which could then perhaps be applied in a simpler form (than ACPI interpreting) to Xen?

-- Keir

#10 lore raw
Quoted 7 lines · Keir Fraser
Quoted 5 lines · Marco Gerards

The second core can not be initialized because the INIT IPI does not arrive. It only happens on the MacBook and not on the desktop Intel Macs. On the MacBook the second core is put into deep sleep mode. It should get out of sleep mode when an IPI or interrupt is received.

Quoted 5 lines
Quoted 2 lines

That does not happen. It looks like the keyboard interrupt does wakeup the second core, after which the IPI is received.

Have you tried tickling the second core with some interrupt or NMI IPIs from the boot core? Sounds like a slightly harder kick is required.

Yes I did try NMI IPIs, that did not have any effect. IIRC I tried generating interrupts using the APIC, but I do not remember if I succeed, but if I did it didn't fix the problem.

Is there any other way I can have a look at to easily generate an interrupt without causing weird side effects?

Quoted 4 lines

What about tracing what the Linux ACPI interpreter kicks out in terms of hardware accesses? Perhaps you can work out what the ACPI goop actually does in low-level terms, which could then perhaps be applied in a simpler form (than ACPI interpreting) to Xen?

How would that work? To be honest I do not know much about ACPI and what's possible with it. A few pointers to get me started is highly appreciated.

Thanks,
Marco