mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [regression 2.6.27.10 & 2.6.28] \"nolapic\" option causes \"nosmp\"?
@ 2009-01-05  3:18 Tetsuo Handa
  2009-01-05 22:07 ` Maciej W. Rozycki
  0 siblings, 1 reply; 3+ messages in thread
From: Tetsuo Handa @ 2009-01-05  3:18 UTC (permalink / raw)
  To: linux-kernel; +Cc: hpa

Hello.

Adding "nolapic" option to kernel command line causes /proc/cpuinfo to show
only 1 CPU, while the machine has 2 CPUs and the kernel was compiled with
CONFIG_SMP=y.

Something is wrong with CPU recognition/initialization code?

This topic is continued from http://lkml.org/lkml/2008/12/30/104 .
I confirmed that this problem occurs on native Ubuntu 8.04 (i386) and
native CentOS 5.2 (x86_64) on ThinkPad X60 (Core 2 Duo).

Kernel 2.6.26.8 seems to be OK.

Regards.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [regression 2.6.27.10 & 2.6.28] \"nolapic\" option causes \"nosmp\"?
  2009-01-05  3:18 [regression 2.6.27.10 & 2.6.28] \"nolapic\" option causes \"nosmp\"? Tetsuo Handa
@ 2009-01-05 22:07 ` Maciej W. Rozycki
  2009-01-06  2:06   ` Tetsuo Handa
  0 siblings, 1 reply; 3+ messages in thread
From: Maciej W. Rozycki @ 2009-01-05 22:07 UTC (permalink / raw)
  To: Tetsuo Handa; +Cc: linux-kernel, hpa

On Mon, 5 Jan 2009, Tetsuo Handa wrote:

> Adding "nolapic" option to kernel command line causes /proc/cpuinfo to show
> only 1 CPU, while the machine has 2 CPUs and the kernel was compiled with
> CONFIG_SMP=y.
> 
> Something is wrong with CPU recognition/initialization code?

 This is correct behaviour.  The hardware uses the local APIC to 
communicate between CPUs.  With the subsystem disabled there is no way to 
reach secondary CPUs on a standard x86 system.

> This topic is continued from http://lkml.org/lkml/2008/12/30/104 .
> I confirmed that this problem occurs on native Ubuntu 8.04 (i386) and
> native CentOS 5.2 (x86_64) on ThinkPad X60 (Core 2 Duo).
> 
> Kernel 2.6.26.8 seems to be OK.

 If this is the case, then "nolapic" must have been dysfunctional in that 
version of the kernel.

  Maciej

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [regression 2.6.27.10 & 2.6.28] \"nolapic\" option causes \"nosmp\"?
  2009-01-05 22:07 ` Maciej W. Rozycki
@ 2009-01-06  2:06   ` Tetsuo Handa
  0 siblings, 0 replies; 3+ messages in thread
From: Tetsuo Handa @ 2009-01-06  2:06 UTC (permalink / raw)
  To: macro; +Cc: linux-kernel, hpa

Hello.

Maciej W. Rozycki wrote:
> This is correct behaviour.  The hardware uses the local APIC to 
> communicate between CPUs.  With the subsystem disabled there is no way to 
> reach secondary CPUs on a standard x86 system.

Oh, I didn't know that.
Then, the problem is use of "for_each_possible_cpu".

---
 drivers/net/loopback.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- linux-2.6.28.orig/drivers/net/loopback.c
+++ linux-2.6.28/drivers/net/loopback.c
@@ -92,28 +92,35 @@ static int loopback_xmit(struct sk_buff 
 static struct net_device_stats *get_stats(struct net_device *dev)
 {
 	const struct pcpu_lstats *pcpu_lstats;
 	struct net_device_stats *stats = &dev->stats;
 	unsigned long bytes = 0;
 	unsigned long packets = 0;
 	int i;
 
+	printk(KERN_INFO "Entering get_stats()\n");
 	pcpu_lstats = dev->ml_priv;
 	for_each_possible_cpu(i) {
 		const struct pcpu_lstats *lb_stats;
+		printk(KERN_INFO "CPU=%u\n", i);
 
 		lb_stats = per_cpu_ptr(pcpu_lstats, i);
+		if (!lb_stats) {
+			printk(KERN_INFO "lb_stats == NULL for CPU %u\n", i);
+			continue;
+		}
 		bytes   += lb_stats->bytes;
 		packets += lb_stats->packets;
 	}
 	stats->rx_packets = packets;
 	stats->tx_packets = packets;
 	stats->rx_bytes = bytes;
 	stats->tx_bytes = bytes;
+	printk(KERN_INFO "Leaving get_stats()\n");
 	return stats;
 }
 
 static u32 always_on(struct net_device *dev)
 {
 	return 1;
 }
 

Applying the above patch and compiling with config at
http://I-love.SAKURA.ne.jp/tmp/config-2.6.28 and booting with "nolapic"
produces below output.

----------------------------------------
BIOS EBDA/lowmem at: 0009f800/0009f800
Linux version 2.6.28 (root@tomoyo) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Jan 6 10:18:14 JST 2009
(..... snipped .....)
Kernel command line: ro root=LABEL=/ nolapic
(..... snipped .....)
ACPI: bus type pnp registered
pnp: PnP ACPI: found 13 devices
ACPI: ACPI bus type pnp unregistered
system 00:01: ioport range 0x1000-0x103f has been reserved
system 00:01: ioport range 0x1040-0x104f has been reserved
system 00:01: ioport range 0xcf0-0xcf1 has been reserved
system 00:0c: ioport range 0x1060-0x107f has been reserved
system 00:0c: iomem range 0xe0000000-0xefffffff has been reserved
system 00:0c: iomem range 0xdb400000-0xdb5fffff has been reserved
Entering get_stats()
CPU=0
Leaving get_stats()
pci 0000:00:01.0: PCI bridge, secondary bus 0000:01
pci 0000:00:01.0:   IO window: disabled
pci 0000:00:01.0:   MEM window: disabled
pci 0000:00:01.0:   PREFETCH window: disabled
(..... snipped .....)
kjournald starting.  Commit interval 5 seconds
(..... snipped .....)
device-mapper: uevent: version 1.0.3
device-mapper: ioctl: 4.14.0-ioctl (2008-04-23) initialised: dm-devel@redhat.com
device-mapper: multipath: version 1.0.5 loaded
EXT3 FS on sda1, internal journal
Entering get_stats()
CPU=0
CPU=1
lb_stats == NULL for CPU 1
Leaving get_stats()
warning: process `kudzu' used the deprecated sysctl system call with 1.23.
NET: Registered protocol family 10
lo: Disabled Privacy Extensions
process `sysctl' is using deprecated sysctl (syscall) net.ipv6.neigh.default.retrans_time; Use net.ipv6.neigh.default.retrans_time_ms instead.
Entering get_stats()
CPU=0
CPU=1
lb_stats == NULL for CPU 1
Leaving get_stats()
----------------------------------------

When "nolapic" is given, it prints "lb_stats == NULL for CPU 1" message.
If '"nolapic" disables CPU 1' is correct behavior, the "CPU=1" message
should not be printed.

Regards.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-06  2:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-05  3:18 [regression 2.6.27.10 & 2.6.28] \"nolapic\" option causes \"nosmp\"? Tetsuo Handa
2009-01-05 22:07 ` Maciej W. Rozycki
2009-01-06  2:06   ` Tetsuo Handa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®