public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Suresh Siddha <suresh.b.siddha@intel.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"ananth@in.ibm.com" <ananth@in.ibm.com>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH -v2 5/5] x86: use dmi check to treat disabled cpus as hotplug cpus.
Date: Tue, 12 Jan 2010 15:17:53 -0800	[thread overview]
Message-ID: <1263338274-6485-5-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1263338274-6485-1-git-send-email-yinghai@kernel.org>

some systems that have disable cpus entries because same
  BIOS will support 2 sockets and 4 sockets and more at
  same time, BIOS just leave some disable entries, but
  those system do not support cpu hotplug. we don't need
  treat disabled_cpus as hotplug cpus.
so we can make nr_cpu_ids smaller and save more space
  (pcpu data allocations), and could make some systems run
  with logical flat instead of physical flat apic mode

-v2: change to black list instead

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/smpboot.c |   76 ++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 74 insertions(+), 2 deletions(-)

Index: linux-2.6/arch/x86/kernel/smpboot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/smpboot.c
+++ linux-2.6/arch/x86/kernel/smpboot.c
@@ -47,6 +47,7 @@
 #include <linux/bootmem.h>
 #include <linux/err.h>
 #include <linux/nmi.h>
+#include <linux/dmi.h>
 #include <linux/tboot.h>
 
 #include <asm/acpi.h>
@@ -1178,6 +1179,59 @@ static int __init _setup_possible_cpus(c
 }
 early_param("possible_cpus", _setup_possible_cpus);
 
+static __initdata int treat_disabled_cpus_as_hotplug = 1;
+static __init int hotplug_cpus_check(const struct dmi_system_id *d)
+{
+        printk(KERN_NOTICE "%s detected: treat disabled cpus as hotplug ones\n", d->ident);
+        treat_disabled_cpus_as_hotplug = 0;
+
+        return 0;
+}
+
+static struct dmi_system_id hotplug_cpus_dmi_table[] __initdata = {
+        {
+                .callback = hotplug_cpus_check,
+                .ident = "Sun Microsystems Sun Fire X4440",
+                .matches = {
+                        DMI_MATCH(DMI_SYS_VENDOR, "Sun Microsystems"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Sun Fire X4440"),
+                },
+        },
+        {
+                .callback = hotplug_cpus_check,
+                .ident = "Sun Microsystems Sun Fire X4240",
+                .matches = {
+                        DMI_MATCH(DMI_SYS_VENDOR, "Sun Microsystems"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Sun Fire X4240"),
+                },
+        },
+        {
+                .callback = hotplug_cpus_check,
+                .ident = "Sun Microsystems Sun Fire X4140",
+                .matches = {
+                        DMI_MATCH(DMI_SYS_VENDOR, "Sun Microsystems"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Sun Fire X4140"),
+                },
+        },
+        {
+                .callback = hotplug_cpus_check,
+                .ident = "Sun Microsystems Sun Fire X4600",
+                .matches = {
+                        DMI_MATCH(DMI_SYS_VENDOR, "Sun Microsystems"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Sun Fire X4600"),
+                },
+        },
+        {
+                .callback = hotplug_cpus_check,
+                .ident = "Sun Microsystems Sun Fire X4640",
+                .matches = {
+                        DMI_MATCH(DMI_SYS_VENDOR, "Sun Microsystems"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Sun Fire X4640"),
+                },
+        },
+        { } /* NULL entry stops DMI scanning */
+};
+
 
 /*
  * cpu_possible_mask should be static, it cannot change as cpu's
@@ -1204,8 +1258,26 @@ __init void prefill_possible_map(void)
 	if (!num_processors)
 		num_processors = 1;
 
-	if (setup_possible_cpus == -1)
-		possible = num_processors + disabled_cpus;
+	if (setup_possible_cpus == -1) {
+		possible = num_processors;
+		/*
+		 * do we have better way to detect hotplug cpus?
+		 *
+		 * some systems that have disable cpus entries because same
+		 *  BIOS will support 2 sockets and 4 sockets and more at
+		 *  same time, BIOS just leave some disabled entries with wild
+		 *  apicid, but those system do not support cpu hotplug.
+		 *  we don't need treat disabled_cpus as hotplug cpus.
+		 * so we can make nr_cpu_ids smaller and save more space
+		 *  (pcpu data allocations), and could make some systems run
+		 *  with logical flat instead of physical flat apic mode
+		 */
+		if (disabled_cpus) {
+			dmi_check_system(hotplug_cpus_dmi_table);
+			if (treat_disabled_cpus_as_hotplug)
+				possible += disabled_cpus;
+		}
+	}
 	else
 		possible = setup_possible_cpus;
 

  parent reply	other threads:[~2010-01-12 23:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-12 23:17 [PATCH 0/5] clean up logical flat apic mode using Yinghai Lu
2010-01-12 23:17 ` [PATCH -v2 1/5] use nr_cpus= to set nr_cpu_ids early Yinghai Lu
2010-01-12 23:17 ` [PATCH 2/5] x86: using logical flat for amd cpu too Yinghai Lu
2010-01-12 23:17 ` [PATCH -v2 3/5] x86: according to nr_cpu_ids to decide if need to leave logical flat Yinghai Lu
2010-01-12 23:17 ` Yinghai Lu [this message]
2010-01-12 23:56   ` [PATCH -v2 5/5] x86: use dmi check to treat disabled cpus as hotplug cpus Suresh Siddha
2010-01-13  0:05     ` Yinghai Lu
2010-01-13  1:48       ` Suresh Siddha
2010-01-13  1:55         ` Yinghai Lu
2010-01-13  2:06           ` Suresh Siddha
2010-01-13  2:13             ` Yinghai Lu
2010-01-13  2:21               ` Suresh Siddha
2010-01-13  2:26                 ` Yinghai Lu
2010-01-13 21:46       ` Andi Kleen
2010-01-13 22:00         ` H. Peter Anvin
2010-01-13 22:23           ` Andi Kleen
2010-01-13 22:27             ` H. Peter Anvin
2010-01-13 22:29               ` Suresh Siddha
2010-01-13 22:36                 ` H. Peter Anvin
2010-01-13 22:49                   ` Suresh Siddha
2010-01-13 23:02                     ` Yinghai Lu
2010-01-13 23:13                       ` H. Peter Anvin
2010-01-13 23:52                         ` Andi Kleen
2010-01-14  9:25                     ` Andi Kleen
2010-01-12 23:17 ` [PATCH 4/5] x86: make 32bit apic flat to physflat switch like 64bit Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263338274-6485-5-git-send-email-yinghai@kernel.org \
    --to=yinghai@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ananth@in.ibm.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox