* x2APIC and many-APIC systems... @ 2012-03-13 9:29 Daniel J Blueman 2012-03-13 22:58 ` Yinghai Lu 0 siblings, 1 reply; 32+ messages in thread From: Daniel J Blueman @ 2012-03-13 9:29 UTC (permalink / raw) To: Ingo Molnar, Suresh Siddha Cc: H. Peter Anvin, Thomas Gleixner, linux-kernel, x86, Steffen Persvold, Yinghai Lu Ingo, Suresh, Commit a35fd28256e7736cc84af8931a16224f0bfaaf6c prevents x2APIC structures being used from the ACPI MADT if the cores don't advertise the x2APIC feature. Commit c284b42abadbb22083bfde24d308899c08d44ffa prevents onlining cores with APIC ID >255 in non-x2APIC mode. Since NumaChip/NumaConnect uses x2APIC structures to describe non-x2APIC systems (AMD Opteron) with lots of APICs, we thus now can't boot all the cores. We are able to set the x2APIC bit in the processor feature flags, so get caught by the second patch. Is there an appropriate approach to use in these circumstances? Otherwise, would a patch that separates the APIC ID handover and future x2APIC MSR access be appropriate? Many thanks, Daniel -- Daniel J Blueman Principal Software Engineer, Numascale Asia ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: x2APIC and many-APIC systems... 2012-03-13 9:29 x2APIC and many-APIC systems Daniel J Blueman @ 2012-03-13 22:58 ` Yinghai Lu 2012-03-13 23:16 ` Suresh Siddha 0 siblings, 1 reply; 32+ messages in thread From: Yinghai Lu @ 2012-03-13 22:58 UTC (permalink / raw) To: Daniel J Blueman Cc: Ingo Molnar, Suresh Siddha, H. Peter Anvin, Thomas Gleixner, linux-kernel, x86, Steffen Persvold On Tue, Mar 13, 2012 at 2:29 AM, Daniel J Blueman <daniel@numascale-asia.com> wrote: > Ingo, Suresh, > > Commit a35fd28256e7736cc84af8931a16224f0bfaaf6c prevents x2APIC structures > being used from the ACPI MADT if the cores don't advertise the x2APIC > feature. Commit c284b42abadbb22083bfde24d308899c08d44ffa prevents onlining > cores with APIC ID >255 in non-x2APIC mode. Since NumaChip/NumaConnect uses > x2APIC structures to describe non-x2APIC systems (AMD Opteron) with lots of > APICs, we thus now can't boot all the cores. > > We are able to set the x2APIC bit in the processor feature flags, so get > caught by the second patch. Is there an appropriate approach to use in these > circumstances? Otherwise, would a patch that separates the APIC ID handover > and future x2APIC MSR access be appropriate? > add is_apicid_valid() in struct apic? Yinghai ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: x2APIC and many-APIC systems... 2012-03-13 22:58 ` Yinghai Lu @ 2012-03-13 23:16 ` Suresh Siddha 2012-03-14 7:17 ` [PATCH] Move APIC ID validity check into platform APIC code Daniel J Blueman 0 siblings, 1 reply; 32+ messages in thread From: Suresh Siddha @ 2012-03-13 23:16 UTC (permalink / raw) To: Yinghai Lu Cc: Daniel J Blueman, Ingo Molnar, H. Peter Anvin, Thomas Gleixner, linux-kernel, x86, Steffen Persvold On Tue, 2012-03-13 at 15:58 -0700, Yinghai Lu wrote: > On Tue, Mar 13, 2012 at 2:29 AM, Daniel J Blueman > <daniel@numascale-asia.com> wrote: > > Ingo, Suresh, > > > > Commit a35fd28256e7736cc84af8931a16224f0bfaaf6c prevents x2APIC structures > > being used from the ACPI MADT if the cores don't advertise the x2APIC > > feature. Commit c284b42abadbb22083bfde24d308899c08d44ffa prevents onlining > > cores with APIC ID >255 in non-x2APIC mode. Since NumaChip/NumaConnect uses > > x2APIC structures to describe non-x2APIC systems (AMD Opteron) with lots of > > APICs, we thus now can't boot all the cores. > > > > We are able to set the x2APIC bit in the processor feature flags, so get > > caught by the second patch. Is there an appropriate approach to use in these > > circumstances? Otherwise, would a patch that separates the APIC ID handover > > and future x2APIC MSR access be appropriate? > > > > add is_apicid_valid() in struct apic? Yes, we can generalize that and move into the apicdriver. Daniel, will you be able to prepare such a patch? thanks, suresh ^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH] Move APIC ID validity check into platform APIC code 2012-03-13 23:16 ` Suresh Siddha @ 2012-03-14 7:17 ` Daniel J Blueman 2012-03-14 11:27 ` [tip:x86/platform] x86/platform: " tip-bot for Daniel J Blueman 2012-03-14 17:58 ` [PATCH] " Yinghai Lu 0 siblings, 2 replies; 32+ messages in thread From: Daniel J Blueman @ 2012-03-14 7:17 UTC (permalink / raw) To: Suresh Siddha Cc: Yinghai Lu, Ingo Molnar, H. Peter Anvin, Thomas Gleixner, linux-kernel, x86, Steffen Persvold, Daniel J Blueman Move APIC ID validity check into platform APIC code, so it can be overridden when needed. For NumaChip systems, always trust MADT, as it's constructed with high APIC IDs. Behaviour verifies on standard x86 systems and on NumaChip systems with this, and compile-tested with allyesconfig. Signed-off-by: Daniel J Blueman <daniel@numascale-asia.com> Reviewed-by: Steffen Persvold <sp@numascale.com> --- arch/x86/include/asm/apic.h | 6 ++++++ arch/x86/kernel/apic/apic_flat_64.c | 2 ++ arch/x86/kernel/apic/apic_noop.c | 1 + arch/x86/kernel/apic/apic_numachip.c | 10 +++++++++- arch/x86/kernel/apic/bigsmp_32.c | 1 + arch/x86/kernel/apic/es7000_32.c | 2 ++ arch/x86/kernel/apic/numaq_32.c | 1 + arch/x86/kernel/apic/probe_32.c | 1 + arch/x86/kernel/apic/summit_32.c | 1 + arch/x86/kernel/apic/x2apic_cluster.c | 1 + arch/x86/kernel/apic/x2apic_phys.c | 1 + arch/x86/kernel/apic/x2apic_uv_x.c | 1 + arch/x86/kernel/smpboot.c | 2 +- 13 files changed, 28 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 3ab9bdd..a9371c9 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -288,6 +288,7 @@ struct apic { int (*probe)(void); int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); + int (*apic_id_valid)(int apicid); int (*apic_id_registered)(void); u32 irq_delivery_mode; @@ -532,6 +533,11 @@ static inline unsigned int read_apic_id(void) return apic->get_apic_id(reg); } +static inline int default_apic_id_valid(int apicid) +{ + return x2apic_mode || (apicid < 255); +} + extern void default_setup_apic_routing(void); extern struct apic apic_noop; diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c index 8c3cdde..359b689 100644 --- a/arch/x86/kernel/apic/apic_flat_64.c +++ b/arch/x86/kernel/apic/apic_flat_64.c @@ -180,6 +180,7 @@ static struct apic apic_flat = { .name = "flat", .probe = flat_probe, .acpi_madt_oem_check = flat_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = flat_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, @@ -337,6 +338,7 @@ static struct apic apic_physflat = { .name = "physical flat", .probe = physflat_probe, .acpi_madt_oem_check = physflat_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = flat_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c index 775b82b..634ae6c 100644 --- a/arch/x86/kernel/apic/apic_noop.c +++ b/arch/x86/kernel/apic/apic_noop.c @@ -124,6 +124,7 @@ struct apic apic_noop = { .probe = noop_probe, .acpi_madt_oem_check = NULL, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = noop_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c index 09d3d8c..d9ea5f3 100644 --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c @@ -56,6 +56,12 @@ static unsigned int read_xapic_id(void) return get_apic_id(apic_read(APIC_ID)); } +static int numachip_apic_id_valid(int apicid) +{ + /* Trust what bootloader passes in MADT */ + return 1; +} + static int numachip_apic_id_registered(void) { return physid_isset(read_xapic_id(), phys_cpu_present_map); @@ -223,10 +229,11 @@ static int __init numachip_system_init(void) } early_initcall(numachip_system_init); -static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) +static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) { if (!strncmp(oem_id, "NUMASC", 6)) { numachip_system = 1; + setup_force_cpu_cap(X86_FEATURE_X2APIC); return 1; } @@ -238,6 +245,7 @@ static struct apic apic_numachip __refconst = { .name = "NumaConnect system", .probe = numachip_probe, .acpi_madt_oem_check = numachip_acpi_madt_oem_check, + .apic_id_valid = numachip_apic_id_valid, .apic_id_registered = numachip_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c index 521bead..0cdec70 100644 --- a/arch/x86/kernel/apic/bigsmp_32.c +++ b/arch/x86/kernel/apic/bigsmp_32.c @@ -198,6 +198,7 @@ static struct apic apic_bigsmp = { .name = "bigsmp", .probe = probe_bigsmp, .acpi_madt_oem_check = NULL, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = bigsmp_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c index 5d513bc..e42d1d3b9 100644 --- a/arch/x86/kernel/apic/es7000_32.c +++ b/arch/x86/kernel/apic/es7000_32.c @@ -625,6 +625,7 @@ static struct apic __refdata apic_es7000_cluster = { .name = "es7000", .probe = probe_es7000, .acpi_madt_oem_check = es7000_acpi_madt_oem_check_cluster, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = es7000_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, @@ -690,6 +691,7 @@ static struct apic __refdata apic_es7000 = { .name = "es7000", .probe = probe_es7000, .acpi_madt_oem_check = es7000_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = es7000_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c index c4a61ca..00d2422 100644 --- a/arch/x86/kernel/apic/numaq_32.c +++ b/arch/x86/kernel/apic/numaq_32.c @@ -478,6 +478,7 @@ static struct apic __refdata apic_numaq = { .name = "NUMAQ", .probe = probe_numaq, .acpi_madt_oem_check = NULL, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = numaq_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c index 0787bb3..ff2c1b9 100644 --- a/arch/x86/kernel/apic/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c @@ -92,6 +92,7 @@ static struct apic apic_default = { .name = "default", .probe = probe_default, .acpi_madt_oem_check = NULL, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = default_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/summit_32.c b/arch/x86/kernel/apic/summit_32.c index 1911442..fea000b 100644 --- a/arch/x86/kernel/apic/summit_32.c +++ b/arch/x86/kernel/apic/summit_32.c @@ -496,6 +496,7 @@ static struct apic apic_summit = { .name = "summit", .probe = probe_summit, .acpi_madt_oem_check = summit_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = summit_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index 5007958..9193713 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c @@ -213,6 +213,7 @@ static struct apic apic_x2apic_cluster = { .name = "cluster x2apic", .probe = x2apic_cluster_probe, .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = x2apic_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index f5373df..bcd1db6 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c @@ -119,6 +119,7 @@ static struct apic apic_x2apic_phys = { .name = "physical x2apic", .probe = x2apic_phys_probe, .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = x2apic_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 79b05b8..fc47714 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c @@ -351,6 +351,7 @@ static struct apic __refdata apic_x2apic_uv_x = { .name = "UV large system", .probe = uv_probe, .acpi_madt_oem_check = uv_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = uv_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 66d250c..d279e6e 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -847,7 +847,7 @@ int __cpuinit native_cpu_up(unsigned int cpu) if (apicid == BAD_APICID || apicid == boot_cpu_physical_apicid || !physid_isset(apicid, phys_cpu_present_map) || - (!x2apic_mode && apicid >= 255)) { + !apic->apic_id_valid(apicid)) { printk(KERN_ERR "%s: bad cpu %d\n", __func__, cpu); return -EINVAL; } -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [tip:x86/platform] x86/platform: Move APIC ID validity check into platform APIC code 2012-03-14 7:17 ` [PATCH] Move APIC ID validity check into platform APIC code Daniel J Blueman @ 2012-03-14 11:27 ` tip-bot for Daniel J Blueman 2012-03-14 17:58 ` [PATCH] " Yinghai Lu 1 sibling, 0 replies; 32+ messages in thread From: tip-bot for Daniel J Blueman @ 2012-03-14 11:27 UTC (permalink / raw) To: linux-tip-commits Cc: linux-kernel, hpa, mingo, yinghai, sp, suresh.b.siddha, tglx, hpa, mingo, daniel Commit-ID: fa63030e9c79e37b4d4e63b39ffb09cfb7aa0fe4 Gitweb: http://git.kernel.org/tip/fa63030e9c79e37b4d4e63b39ffb09cfb7aa0fe4 Author: Daniel J Blueman <daniel@numascale-asia.com> AuthorDate: Wed, 14 Mar 2012 15:17:34 +0800 Committer: Ingo Molnar <mingo@elte.hu> CommitDate: Wed, 14 Mar 2012 09:49:48 +0100 x86/platform: Move APIC ID validity check into platform APIC code Move APIC ID validity check into platform APIC code, so it can be overridden when needed. For NumaChip systems, always trust MADT, as it's constructed with high APIC IDs. Behaviour verifies on standard x86 systems and on NumaChip systems with this, and compile-tested with allyesconfig. Signed-off-by: Daniel J Blueman <daniel@numascale-asia.com> Reviewed-by: Steffen Persvold <sp@numascale.com> Cc: Yinghai Lu <yinghai@kernel.org> Cc: H. Peter Anvin <hpa@linux.intel.com> Cc: Suresh Siddha <suresh.b.siddha@intel.com> Link: http://lkml.kernel.org/r/1331709454-27966-1-git-send-email-daniel@numascale-asia.com Signed-off-by: Ingo Molnar <mingo@elte.hu> --- arch/x86/include/asm/apic.h | 6 ++++++ arch/x86/kernel/apic/apic_flat_64.c | 2 ++ arch/x86/kernel/apic/apic_noop.c | 1 + arch/x86/kernel/apic/apic_numachip.c | 10 +++++++++- arch/x86/kernel/apic/bigsmp_32.c | 1 + arch/x86/kernel/apic/es7000_32.c | 2 ++ arch/x86/kernel/apic/numaq_32.c | 1 + arch/x86/kernel/apic/probe_32.c | 1 + arch/x86/kernel/apic/summit_32.c | 1 + arch/x86/kernel/apic/x2apic_cluster.c | 1 + arch/x86/kernel/apic/x2apic_phys.c | 1 + arch/x86/kernel/apic/x2apic_uv_x.c | 1 + arch/x86/kernel/smpboot.c | 2 +- 13 files changed, 28 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 3ab9bdd..a9371c9 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -288,6 +288,7 @@ struct apic { int (*probe)(void); int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); + int (*apic_id_valid)(int apicid); int (*apic_id_registered)(void); u32 irq_delivery_mode; @@ -532,6 +533,11 @@ static inline unsigned int read_apic_id(void) return apic->get_apic_id(reg); } +static inline int default_apic_id_valid(int apicid) +{ + return x2apic_mode || (apicid < 255); +} + extern void default_setup_apic_routing(void); extern struct apic apic_noop; diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c index 8c3cdde..359b689 100644 --- a/arch/x86/kernel/apic/apic_flat_64.c +++ b/arch/x86/kernel/apic/apic_flat_64.c @@ -180,6 +180,7 @@ static struct apic apic_flat = { .name = "flat", .probe = flat_probe, .acpi_madt_oem_check = flat_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = flat_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, @@ -337,6 +338,7 @@ static struct apic apic_physflat = { .name = "physical flat", .probe = physflat_probe, .acpi_madt_oem_check = physflat_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = flat_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c index 775b82b..634ae6c 100644 --- a/arch/x86/kernel/apic/apic_noop.c +++ b/arch/x86/kernel/apic/apic_noop.c @@ -124,6 +124,7 @@ struct apic apic_noop = { .probe = noop_probe, .acpi_madt_oem_check = NULL, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = noop_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c index 09d3d8c..d9ea5f3 100644 --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c @@ -56,6 +56,12 @@ static unsigned int read_xapic_id(void) return get_apic_id(apic_read(APIC_ID)); } +static int numachip_apic_id_valid(int apicid) +{ + /* Trust what bootloader passes in MADT */ + return 1; +} + static int numachip_apic_id_registered(void) { return physid_isset(read_xapic_id(), phys_cpu_present_map); @@ -223,10 +229,11 @@ static int __init numachip_system_init(void) } early_initcall(numachip_system_init); -static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) +static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) { if (!strncmp(oem_id, "NUMASC", 6)) { numachip_system = 1; + setup_force_cpu_cap(X86_FEATURE_X2APIC); return 1; } @@ -238,6 +245,7 @@ static struct apic apic_numachip __refconst = { .name = "NumaConnect system", .probe = numachip_probe, .acpi_madt_oem_check = numachip_acpi_madt_oem_check, + .apic_id_valid = numachip_apic_id_valid, .apic_id_registered = numachip_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c index 521bead..0cdec70 100644 --- a/arch/x86/kernel/apic/bigsmp_32.c +++ b/arch/x86/kernel/apic/bigsmp_32.c @@ -198,6 +198,7 @@ static struct apic apic_bigsmp = { .name = "bigsmp", .probe = probe_bigsmp, .acpi_madt_oem_check = NULL, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = bigsmp_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c index 5d513bc..e42d1d3b9 100644 --- a/arch/x86/kernel/apic/es7000_32.c +++ b/arch/x86/kernel/apic/es7000_32.c @@ -625,6 +625,7 @@ static struct apic __refdata apic_es7000_cluster = { .name = "es7000", .probe = probe_es7000, .acpi_madt_oem_check = es7000_acpi_madt_oem_check_cluster, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = es7000_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, @@ -690,6 +691,7 @@ static struct apic __refdata apic_es7000 = { .name = "es7000", .probe = probe_es7000, .acpi_madt_oem_check = es7000_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = es7000_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c index c4a61ca..00d2422 100644 --- a/arch/x86/kernel/apic/numaq_32.c +++ b/arch/x86/kernel/apic/numaq_32.c @@ -478,6 +478,7 @@ static struct apic __refdata apic_numaq = { .name = "NUMAQ", .probe = probe_numaq, .acpi_madt_oem_check = NULL, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = numaq_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c index 0787bb3..ff2c1b9 100644 --- a/arch/x86/kernel/apic/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c @@ -92,6 +92,7 @@ static struct apic apic_default = { .name = "default", .probe = probe_default, .acpi_madt_oem_check = NULL, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = default_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/summit_32.c b/arch/x86/kernel/apic/summit_32.c index 1911442..fea000b 100644 --- a/arch/x86/kernel/apic/summit_32.c +++ b/arch/x86/kernel/apic/summit_32.c @@ -496,6 +496,7 @@ static struct apic apic_summit = { .name = "summit", .probe = probe_summit, .acpi_madt_oem_check = summit_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = summit_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index 5007958..9193713 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c @@ -213,6 +213,7 @@ static struct apic apic_x2apic_cluster = { .name = "cluster x2apic", .probe = x2apic_cluster_probe, .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = x2apic_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index f5373df..bcd1db6 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c @@ -119,6 +119,7 @@ static struct apic apic_x2apic_phys = { .name = "physical x2apic", .probe = x2apic_phys_probe, .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = x2apic_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 79b05b8..fc47714 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c @@ -351,6 +351,7 @@ static struct apic __refdata apic_x2apic_uv_x = { .name = "UV large system", .probe = uv_probe, .acpi_madt_oem_check = uv_acpi_madt_oem_check, + .apic_id_valid = default_apic_id_valid, .apic_id_registered = uv_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 66d250c..d279e6e 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -847,7 +847,7 @@ int __cpuinit native_cpu_up(unsigned int cpu) if (apicid == BAD_APICID || apicid == boot_cpu_physical_apicid || !physid_isset(apicid, phys_cpu_present_map) || - (!x2apic_mode && apicid >= 255)) { + !apic->apic_id_valid(apicid)) { printk(KERN_ERR "%s: bad cpu %d\n", __func__, cpu); return -EINVAL; } ^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH] Move APIC ID validity check into platform APIC code 2012-03-14 7:17 ` [PATCH] Move APIC ID validity check into platform APIC code Daniel J Blueman 2012-03-14 11:27 ` [tip:x86/platform] x86/platform: " tip-bot for Daniel J Blueman @ 2012-03-14 17:58 ` Yinghai Lu 2012-03-14 20:18 ` Steffen Persvold 1 sibling, 1 reply; 32+ messages in thread From: Yinghai Lu @ 2012-03-14 17:58 UTC (permalink / raw) To: Daniel J Blueman Cc: Suresh Siddha, Ingo Molnar, H. Peter Anvin, Thomas Gleixner, linux-kernel, x86, Steffen Persvold On Wed, Mar 14, 2012 at 12:17 AM, Daniel J Blueman <daniel@numascale-asia.com> wrote: > Move APIC ID validity check into platform APIC code, so it can be > overridden when needed. For NumaChip systems, always trust MADT, > as it's constructed with high APIC IDs. > > Behaviour verifies on standard x86 systems and on NumaChip systems > with this, and compile-tested with allyesconfig. > > Signed-off-by: Daniel J Blueman <daniel@numascale-asia.com> > Reviewed-by: Steffen Persvold <sp@numascale.com> > > --- > arch/x86/include/asm/apic.h | 6 ++++++ > arch/x86/kernel/apic/apic_flat_64.c | 2 ++ > arch/x86/kernel/apic/apic_noop.c | 1 + > arch/x86/kernel/apic/apic_numachip.c | 10 +++++++++- > arch/x86/kernel/apic/bigsmp_32.c | 1 + > arch/x86/kernel/apic/es7000_32.c | 2 ++ > arch/x86/kernel/apic/numaq_32.c | 1 + > arch/x86/kernel/apic/probe_32.c | 1 + > arch/x86/kernel/apic/summit_32.c | 1 + > arch/x86/kernel/apic/x2apic_cluster.c | 1 + > arch/x86/kernel/apic/x2apic_phys.c | 1 + > arch/x86/kernel/apic/x2apic_uv_x.c | 1 + > arch/x86/kernel/smpboot.c | 2 +- > 13 files changed, 28 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h > index 3ab9bdd..a9371c9 100644 > --- a/arch/x86/include/asm/apic.h > +++ b/arch/x86/include/asm/apic.h > @@ -288,6 +288,7 @@ struct apic { > > int (*probe)(void); > int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); > + int (*apic_id_valid)(int apicid); > int (*apic_id_registered)(void); > > u32 irq_delivery_mode; > @@ -532,6 +533,11 @@ static inline unsigned int read_apic_id(void) > return apic->get_apic_id(reg); > } > > +static inline int default_apic_id_valid(int apicid) > +{ > + return x2apic_mode || (apicid < 255); > +} > + > extern void default_setup_apic_routing(void); > > extern struct apic apic_noop; > diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c > index 8c3cdde..359b689 100644 > --- a/arch/x86/kernel/apic/apic_flat_64.c > +++ b/arch/x86/kernel/apic/apic_flat_64.c > @@ -180,6 +180,7 @@ static struct apic apic_flat = { > .name = "flat", > .probe = flat_probe, > .acpi_madt_oem_check = flat_acpi_madt_oem_check, > + .apic_id_valid = default_apic_id_valid, > .apic_id_registered = flat_apic_id_registered, > > .irq_delivery_mode = dest_LowestPrio, > @@ -337,6 +338,7 @@ static struct apic apic_physflat = { > .name = "physical flat", > .probe = physflat_probe, > .acpi_madt_oem_check = physflat_acpi_madt_oem_check, > + .apic_id_valid = default_apic_id_valid, > .apic_id_registered = flat_apic_id_registered, > > .irq_delivery_mode = dest_Fixed, > diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c > index 775b82b..634ae6c 100644 > --- a/arch/x86/kernel/apic/apic_noop.c > +++ b/arch/x86/kernel/apic/apic_noop.c > @@ -124,6 +124,7 @@ struct apic apic_noop = { > .probe = noop_probe, > .acpi_madt_oem_check = NULL, > > + .apic_id_valid = default_apic_id_valid, > .apic_id_registered = noop_apic_id_registered, > > .irq_delivery_mode = dest_LowestPrio, > diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c > index 09d3d8c..d9ea5f3 100644 > --- a/arch/x86/kernel/apic/apic_numachip.c > +++ b/arch/x86/kernel/apic/apic_numachip.c > @@ -56,6 +56,12 @@ static unsigned int read_xapic_id(void) > return get_apic_id(apic_read(APIC_ID)); > } > > +static int numachip_apic_id_valid(int apicid) > +{ > + /* Trust what bootloader passes in MADT */ > + return 1; > +} > + > static int numachip_apic_id_registered(void) > { > return physid_isset(read_xapic_id(), phys_cpu_present_map); > @@ -223,10 +229,11 @@ static int __init numachip_system_init(void) > } > early_initcall(numachip_system_init); > > -static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) > +static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) > { > if (!strncmp(oem_id, "NUMASC", 6)) { > numachip_system = 1; > + setup_force_cpu_cap(X86_FEATURE_X2APIC); > return 1; > } can you check if you can update !cpu_has_x2apic && (apic_id >= 0xff) && enabled in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic() to use some kind of apic_id_valid() so you could avoid setting that feature bit. the checking in SRAT could be removed. Yinghai ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Move APIC ID validity check into platform APIC code 2012-03-14 17:58 ` [PATCH] " Yinghai Lu @ 2012-03-14 20:18 ` Steffen Persvold 2012-03-14 23:19 ` Yinghai Lu 0 siblings, 1 reply; 32+ messages in thread From: Steffen Persvold @ 2012-03-14 20:18 UTC (permalink / raw) To: Yinghai Lu Cc: Daniel J Blueman, Suresh Siddha, Ingo Molnar, H. Peter Anvin, Thomas Gleixner, linux-kernel, x86 On 3/14/2012 18:58, Yinghai Lu wrote: > On Wed, Mar 14, 2012 at 12:17 AM, Daniel J Blueman [] > > can you check if you can update > > !cpu_has_x2apic&& (apic_id>= 0xff)&& enabled > > in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic() > > to use some kind of apic_id_valid() > > so you could avoid setting that feature bit. > > the checking in SRAT could be removed. > Yinghai/Team, One question (as I don't really know *why* this was added to the acpi/srat parsing code). In arch/x86/kernel/smpboot.c the check was originally : !x2apic_mode && apicid >= 255 However in arch/x86/kernel/acpi/boot.c and arch/x86/mm/srat.c these tests are used : !cpu_has_x2apic && (apic_id >= 0xff) Clearly, "cpu_has_x2apic" and "x2apic_mode" are two different things. Since we can force "cpu_has_x2apic", when Daniel crafted this patch he made the following "default" function : static inline int default_apic_id_valid(int apicid) { return x2apic_mode || (apicid < 255); } which, as you can see, checks against "x2apic_mode". My question is; Is checking for "x2apic_mode" going to do the trick in the arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic() ? If the answer is yes, the patch is going to be very simple. But we can't verify that the code in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic() actually triggers for the case you wanted it to trigger for because then it will check against "x2apic_mode" and not "cpu_has_x2apic". Cheers, -- Steffen Persvold, Chief Architect NumaChip Numascale AS - www.numascale.com Tel: +47 92 49 25 54 Skype: spersvold ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Move APIC ID validity check into platform APIC code 2012-03-14 20:18 ` Steffen Persvold @ 2012-03-14 23:19 ` Yinghai Lu 2012-03-15 18:03 ` [PATCH] Use x2apic_supported() in the default_apic_id_valid() function Steffen Persvold 0 siblings, 1 reply; 32+ messages in thread From: Yinghai Lu @ 2012-03-14 23:19 UTC (permalink / raw) To: Steffen Persvold Cc: Daniel J Blueman, Suresh Siddha, Ingo Molnar, H. Peter Anvin, Thomas Gleixner, linux-kernel, x86 On Wed, Mar 14, 2012 at 1:18 PM, Steffen Persvold <sp@numascale.com> wrote: > which, as you can see, checks against "x2apic_mode". > > My question is; Is checking for "x2apic_mode" going to do the trick in the > arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic() ? no, it is too early. at that time, only x2apic pre-enabled system have that x2apic_mode set. > > If the answer is yes, the patch is going to be very simple. But we can't > verify that the code in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic() > actually triggers for the case you wanted it to trigger for because then it > will check against "x2apic_mode" and not "cpu_has_x2apic". when kernel, found pre-enabled x2apic, can not use x2apic for some reason (like x2apic) it will clear x2apic in cpu feature bit. for other case like x2apic capable cpus and not preenabled, but not have dmar table, that feature is not cleared if the not apic id > 255. So we have default apic_id_valid only check cpu_has_x2apic instead of x2apic_mode instead. and use it in boot.c Yinghai ^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-14 23:19 ` Yinghai Lu @ 2012-03-15 18:03 ` Steffen Persvold 2012-03-15 20:23 ` Yinghai Lu 0 siblings, 1 reply; 32+ messages in thread From: Steffen Persvold @ 2012-03-15 18:03 UTC (permalink / raw) To: Ingo Molnar, Thomas Gleixner Cc: H. Peter Anvin, Daniel J Blueman, Yinghai Lu, Suresh Siddha, linux-kernel, x86, Steffen Persvold Use x2apic_supported() in the default_apic_id_valid() function. If x2apic mode is disabled (via nox2apic for example), x2apic_supported() will return false. This allows us to substitute the check in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic and avoid feigning the x2apic cpu feature in the NumaChip apic code. Signed-off-by: Steffen Persvold <sp@numascale.com> Reviewed-by: Daniel J Blueman <daniel@numascale-asia.com> --- arch/x86/include/asm/apic.h | 2 +- arch/x86/kernel/acpi/boot.c | 2 +- arch/x86/kernel/apic/apic_numachip.c | 1 - arch/x86/mm/srat.c | 7 +------ 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index a9371c9..b6d3987 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -535,7 +535,7 @@ static inline unsigned int read_apic_id(void) static inline int default_apic_id_valid(int apicid) { - return x2apic_mode || (apicid < 255); + return x2apic_supported() || (apicid < 255); } extern void default_setup_apic_routing(void); diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 406ed77..0f42c2f 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -239,7 +239,7 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end) * to not preallocating memory for all NR_CPUS * when we use CPU hotplug. */ - if (!cpu_has_x2apic && (apic_id >= 0xff) && enabled) + if (!apic->apic_id_valid(apic_id) && enabled) printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); else acpi_register_lapic(apic_id, enabled); diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c index d9ea5f3..c13fa9f 100644 --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c @@ -233,7 +233,6 @@ static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_ { if (!strncmp(oem_id, "NUMASC", 6)) { numachip_system = 1; - setup_force_cpu_cap(X86_FEATURE_X2APIC); return 1; } diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index 1c1c4f4..7efd0c6 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c @@ -69,12 +69,6 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0) return; pxm = pa->proximity_domain; - apic_id = pa->apic_id; - if (!cpu_has_x2apic && (apic_id >= 0xff)) { - printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n", - pxm, apic_id); - return; - } node = setup_node(pxm); if (node < 0) { printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm); @@ -82,6 +76,7 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) return; } + apic_id = pa->apic_id; if (apic_id >= MAX_LOCAL_APIC) { printk(KERN_INFO "SRAT: PXM %u -> APIC 0x%04x -> Node %u skipped apicid that is too big\n", pxm, apic_id, node); return; -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-15 18:03 ` [PATCH] Use x2apic_supported() in the default_apic_id_valid() function Steffen Persvold @ 2012-03-15 20:23 ` Yinghai Lu 2012-03-15 21:21 ` Suresh Siddha 0 siblings, 1 reply; 32+ messages in thread From: Yinghai Lu @ 2012-03-15 20:23 UTC (permalink / raw) To: Steffen Persvold Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, Suresh Siddha, linux-kernel, x86 On Thu, Mar 15, 2012 at 11:03 AM, Steffen Persvold <sp@numascale.com> wrote: > Use x2apic_supported() in the default_apic_id_valid() function. If x2apic mode is disabled (via nox2apic for example), x2apic_supported() will return false. > > This allows us to substitute the check in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic and avoid feigning the x2apic cpu feature in the NumaChip apic code. > > Signed-off-by: Steffen Persvold <sp@numascale.com> > Reviewed-by: Daniel J Blueman <daniel@numascale-asia.com> I double checked on system with x2apic preenabled, nox2apic in boot command line still works well and it skips starting APs with apic id > 255. Acked-by: Yinghai Lu <yinghai@kernel.org> ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-15 20:23 ` Yinghai Lu @ 2012-03-15 21:21 ` Suresh Siddha 2012-03-15 22:34 ` Steffen Persvold 2012-03-16 2:08 ` [PATCH] Use x2apic_supported() in the default_apic_id_valid() function Yinghai Lu 0 siblings, 2 replies; 32+ messages in thread From: Suresh Siddha @ 2012-03-15 21:21 UTC (permalink / raw) To: Yinghai Lu Cc: Steffen Persvold, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On Thu, 2012-03-15 at 13:23 -0700, Yinghai Lu wrote: > On Thu, Mar 15, 2012 at 11:03 AM, Steffen Persvold <sp@numascale.com> wrote: > > Use x2apic_supported() in the default_apic_id_valid() function. If x2apic mode is disabled (via nox2apic for example), x2apic_supported() will return false. > > > > This allows us to substitute the check in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic and avoid feigning the x2apic cpu feature in the NumaChip apic code. > > > > Signed-off-by: Steffen Persvold <sp@numascale.com> > > Reviewed-by: Daniel J Blueman <daniel@numascale-asia.com> > > I double checked on system with x2apic preenabled, > nox2apic in boot command line still works well and it > skips starting APs with apic id > 255. > > Acked-by: Yinghai Lu <yinghai@kernel.org> This breaks the smpboot check if enabling interrupt-remapping/x2apic fails on a platform. We will be in xapic mode and we don't clear the x2apic cpufeature bit in this case and as such smpboot check will fail. So this change breaks the commit c284b42abadbb22083bfde24d308899c08d44ffa. I think the right thing is to have two different apid_id_valid checks one for xapic driver (apic_flat_64.c) and another for x2apic driver (x2apic_phys/cluster.c) and that way, x2apic MADT entries will be parsed only if bios has handed over the OS in x2apic mode or if we have selected the numachip model. thanks, suresh ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-15 21:21 ` Suresh Siddha @ 2012-03-15 22:34 ` Steffen Persvold 2012-03-15 22:58 ` Steffen Persvold 2012-03-15 23:04 ` Suresh Siddha 2012-03-16 2:08 ` [PATCH] Use x2apic_supported() in the default_apic_id_valid() function Yinghai Lu 1 sibling, 2 replies; 32+ messages in thread From: Steffen Persvold @ 2012-03-15 22:34 UTC (permalink / raw) To: Suresh Siddha Cc: Yinghai Lu, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On 3/15/12 22:21 , Suresh Siddha wrote: > On Thu, 2012-03-15 at 13:23 -0700, Yinghai Lu wrote: >> On Thu, Mar 15, 2012 at 11:03 AM, Steffen Persvold<sp@numascale.com> wrote: >>> Use x2apic_supported() in the default_apic_id_valid() function. If x2apic mode is disabled (via nox2apic for example), x2apic_supported() will return false. >>> >>> This allows us to substitute the check in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic and avoid feigning the x2apic cpu feature in the NumaChip apic code. >>> >>> Signed-off-by: Steffen Persvold<sp@numascale.com> >>> Reviewed-by: Daniel J Blueman<daniel@numascale-asia.com> >> >> I double checked on system with x2apic preenabled, >> nox2apic in boot command line still works well and it >> skips starting APs with apic id> 255. >> >> Acked-by: Yinghai Lu<yinghai@kernel.org> > Suresh, > This breaks the smpboot check if enabling interrupt-remapping/x2apic > fails on a platform. We will be in xapic mode and we don't clear the > x2apic cpufeature bit in this case and as such smpboot check will fail. > > So this change breaks the commit > c284b42abadbb22083bfde24d308899c08d44ffa. > I was afraid of that. > I think the right thing is to have two different apid_id_valid checks > one for xapic driver (apic_flat_64.c) and another for x2apic driver > (x2apic_phys/cluster.c) and that way, x2apic MADT entries will be parsed > only if bios has handed over the OS in x2apic mode or if we have > selected the numachip model. > Is my understanding of your suggestion correct that in x2apic_phys/cluster.c we add the following apic_id_valid() function : static int x2apic_apic_id_valid(int apicid) { return x2apic_mode || (apicid < 255); } ? Considering that this function (apic->apic_id_valid()) is called already in the acpi/boot.c::acpi_parse_x2apic() function is it sufficient enough to test for x2apic_mode ? Yinghai indicated that x2apic_mode was not set at this point, thus it was testing cpu_has_x2apic instead ? I must admit that I am not familiar enough with the APIC/ACPI code base to determine the sequence of events here (i.e MADT parsing, enabling of x2apic mode etc. etc.). Please advice. Kind regards, Steffen ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-15 22:34 ` Steffen Persvold @ 2012-03-15 22:58 ` Steffen Persvold 2012-03-15 23:04 ` Suresh Siddha 1 sibling, 0 replies; 32+ messages in thread From: Steffen Persvold @ 2012-03-15 22:58 UTC (permalink / raw) To: Suresh Siddha Cc: Yinghai Lu, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On 3/15/12 23:34 , Steffen Persvold wrote: > On 3/15/12 22:21 , Suresh Siddha wrote: >> On Thu, 2012-03-15 at 13:23 -0700, Yinghai Lu wrote: >>> On Thu, Mar 15, 2012 at 11:03 AM, Steffen Persvold<sp@numascale.com> >>> wrote: >>>> Use x2apic_supported() in the default_apic_id_valid() function. If >>>> x2apic mode is disabled (via nox2apic for example), >>>> x2apic_supported() will return false. >>>> >>>> This allows us to substitute the check in >>>> arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic and avoid feigning >>>> the x2apic cpu feature in the NumaChip apic code. >>>> >>>> Signed-off-by: Steffen Persvold<sp@numascale.com> >>>> Reviewed-by: Daniel J Blueman<daniel@numascale-asia.com> >>> >>> I double checked on system with x2apic preenabled, >>> nox2apic in boot command line still works well and it >>> skips starting APs with apic id> 255. >>> >>> Acked-by: Yinghai Lu<yinghai@kernel.org> >> > > Suresh, > >> This breaks the smpboot check if enabling interrupt-remapping/x2apic >> fails on a platform. We will be in xapic mode and we don't clear the >> x2apic cpufeature bit in this case and as such smpboot check will fail. >> >> So this change breaks the commit >> c284b42abadbb22083bfde24d308899c08d44ffa. >> > > I was afraid of that. > >> I think the right thing is to have two different apid_id_valid checks >> one for xapic driver (apic_flat_64.c) and another for x2apic driver >> (x2apic_phys/cluster.c) and that way, x2apic MADT entries will be parsed >> only if bios has handed over the OS in x2apic mode or if we have >> selected the numachip model. >> > > Is my understanding of your suggestion correct that in > x2apic_phys/cluster.c we add the following apic_id_valid() function : > > static int x2apic_apic_id_valid(int apicid) > { > return x2apic_mode || (apicid < 255); > } > > ? > > Considering that this function (apic->apic_id_valid()) is called already > in the acpi/boot.c::acpi_parse_x2apic() function is it sufficient enough > to test for x2apic_mode ? Yinghai indicated that x2apic_mode was not set > at this point, thus it was testing cpu_has_x2apic instead ? > > I must admit that I am not familiar enough with the APIC/ACPI code base > to determine the sequence of events here (i.e MADT parsing, enabling of > x2apic mode etc. etc.). After reading the code a bit more it seems that the sequence is as follows : kernel/setup.c::setup_arch() calls check_x2apic(). check_x2apic() first checks the cpu feature flag, then checks the MSR_IA32_APICBASE msr to see if bios has enabled x2apic mode. If this is the case, x2apic_preenabled and x2apic_mode is set to 1. Later on in setup_arch(), the ACPI parsing starts. My assumption is that the approach suggested in my previous email (based on Suresh' comment) with separate apic_id_valid() functions would be sufficient even for the MADT parsing ? Kind regards, Steffen ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-15 22:34 ` Steffen Persvold 2012-03-15 22:58 ` Steffen Persvold @ 2012-03-15 23:04 ` Suresh Siddha 2012-03-15 23:17 ` Steffen Persvold ` (2 more replies) 1 sibling, 3 replies; 32+ messages in thread From: Suresh Siddha @ 2012-03-15 23:04 UTC (permalink / raw) To: Steffen Persvold Cc: Yinghai Lu, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On Thu, 2012-03-15 at 23:34 +0100, Steffen Persvold wrote: > Is my understanding of your suggestion correct that in > x2apic_phys/cluster.c we add the following apic_id_valid() function : > > static int x2apic_apic_id_valid(int apicid) > { > return x2apic_mode || (apicid < 255); > } Steffen, We can have something like: static int x2apic_apic_id_valid(int apicid) { return 1; } and static int xapic_apic_id_valid(int apicid) { return apicid < 255; } If we have selected x2apic driver, then we know we are already in x2apic mode. And also x2apic_uv_x need to use the x2apic version above. > Considering that this function (apic->apic_id_valid()) is called already > in the acpi/boot.c::acpi_parse_x2apic() function is it sufficient enough > to test for x2apic_mode ? Yinghai indicated that x2apic_mode was not set > at this point, thus it was testing cpu_has_x2apic instead ? If the bios has handed over to us in x2apic mode (or if it is a numachip platform), then by this point apic driver is already set to the corresponding x2apic/numachip driver etc. so we should be fine. When we are in xapic mode, typically there should be no x2apic MADT entries. And even if there are any (bios not following x2apic spec), the above xapic_apic_id_valid() check will consider only those x2apic MADT entries whose id's are less than 255. xapic mode can go into x2apic mode later but that flow is not supposed to bring up any cpu with apic id > 255. So parsing only entries with apic id < 255 here should be fine. Hope this clarifies. thanks, suresh ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-15 23:04 ` Suresh Siddha @ 2012-03-15 23:17 ` Steffen Persvold 2012-03-15 23:33 ` Steffen Persvold 2012-03-16 0:07 ` [PATCH] Added separate apic_id_valid() functions for selected apic drivers Steffen Persvold 2 siblings, 0 replies; 32+ messages in thread From: Steffen Persvold @ 2012-03-15 23:17 UTC (permalink / raw) To: Suresh Siddha Cc: Yinghai Lu, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On 3/16/2012 00:04, Suresh Siddha wrote: > On Thu, 2012-03-15 at 23:34 +0100, Steffen Persvold wrote: >> Is my understanding of your suggestion correct that in >> x2apic_phys/cluster.c we add the following apic_id_valid() function : >> >> static int x2apic_apic_id_valid(int apicid) >> { >> return x2apic_mode || (apicid< 255); >> } > > Steffen, We can have something like: > > static int x2apic_apic_id_valid(int apicid) > { > return 1; > } > > and > > static int xapic_apic_id_valid(int apicid) > { > return apicid< 255; > } > > If we have selected x2apic driver, then we know we are already in x2apic > mode. And also x2apic_uv_x need to use the x2apic version above. > >> Considering that this function (apic->apic_id_valid()) is called already >> in the acpi/boot.c::acpi_parse_x2apic() function is it sufficient enough >> to test for x2apic_mode ? Yinghai indicated that x2apic_mode was not set >> at this point, thus it was testing cpu_has_x2apic instead ? > > If the bios has handed over to us in x2apic mode (or if it is a numachip > platform), then by this point apic driver is already set to the > corresponding x2apic/numachip driver etc. so we should be fine. > > When we are in xapic mode, typically there should be no x2apic MADT > entries. And even if there are any (bios not following x2apic spec), the > above xapic_apic_id_valid() check will consider only those x2apic MADT > entries whose id's are less than 255. xapic mode can go into x2apic mode > later but that flow is not supposed to bring up any cpu with apic id> > 255. So parsing only entries with apic id< 255 here should be fine. > > Hope this clarifies. > Yes, this is now my understanding aswell. Thank you. I will resend a reviced patch shortly. Kind regards, -- Steffen Persvold, Chief Architect NumaChip Numascale AS - www.numascale.com Tel: +47 92 49 25 54 Skype: spersvold ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-15 23:04 ` Suresh Siddha 2012-03-15 23:17 ` Steffen Persvold @ 2012-03-15 23:33 ` Steffen Persvold 2012-03-15 23:44 ` Steffen Persvold 2012-03-16 0:07 ` [PATCH] Added separate apic_id_valid() functions for selected apic drivers Steffen Persvold 2 siblings, 1 reply; 32+ messages in thread From: Steffen Persvold @ 2012-03-15 23:33 UTC (permalink / raw) To: Suresh Siddha Cc: Yinghai Lu, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On 3/16/2012 00:04, Suresh Siddha wrote: > On Thu, 2012-03-15 at 23:34 +0100, Steffen Persvold wrote: >> Is my understanding of your suggestion correct that in >> x2apic_phys/cluster.c we add the following apic_id_valid() function : >> >> static int x2apic_apic_id_valid(int apicid) >> { >> return x2apic_mode || (apicid< 255); >> } > > Steffen, We can have something like: > > static int x2apic_apic_id_valid(int apicid) > { > return 1; > } > > and > > static int xapic_apic_id_valid(int apicid) > { > return apicid< 255; > } > > If we have selected x2apic driver, then we know we are already in x2apic > mode. And also x2apic_uv_x need to use the x2apic version above. > If you specify "nox2apic" option, will it choose the xapic driver instead (and early enough) ? Otherwise I think we might break Yinghai's commit (a35fd28256e7736cc84af8931a16224f0bfaaf6c). Cheers, -- Steffen Persvold, Chief Architect NumaChip Numascale AS - www.numascale.com Tel: +47 92 49 25 54 Skype: spersvold ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-15 23:33 ` Steffen Persvold @ 2012-03-15 23:44 ` Steffen Persvold 0 siblings, 0 replies; 32+ messages in thread From: Steffen Persvold @ 2012-03-15 23:44 UTC (permalink / raw) To: Suresh Siddha Cc: Yinghai Lu, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On 3/16/2012 00:33, Steffen Persvold wrote: > On 3/16/2012 00:04, Suresh Siddha wrote: >> On Thu, 2012-03-15 at 23:34 +0100, Steffen Persvold wrote: >>> Is my understanding of your suggestion correct that in >>> x2apic_phys/cluster.c we add the following apic_id_valid() function : >>> >>> static int x2apic_apic_id_valid(int apicid) >>> { >>> return x2apic_mode || (apicid< 255); >>> } >> >> Steffen, We can have something like: >> >> static int x2apic_apic_id_valid(int apicid) >> { >> return 1; >> } >> >> and >> >> static int xapic_apic_id_valid(int apicid) >> { >> return apicid< 255; >> } >> >> If we have selected x2apic driver, then we know we are already in x2apic >> mode. And also x2apic_uv_x need to use the x2apic version above. >> > > If you specify "nox2apic" option, will it choose the xapic driver > instead (and early enough) ? Otherwise I think we might break Yinghai's > commit (a35fd28256e7736cc84af8931a16224f0bfaaf6c). > Answering myself here, my apologies, but yes it looks like both x2apic drivers will be de-activated if the "nox2apic" option is specified (x2apic_enabled() will return false). Cheers, Steffen ^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH] Added separate apic_id_valid() functions for selected apic drivers 2012-03-15 23:04 ` Suresh Siddha 2012-03-15 23:17 ` Steffen Persvold 2012-03-15 23:33 ` Steffen Persvold @ 2012-03-16 0:07 ` Steffen Persvold 2012-03-16 0:13 ` Suresh Siddha 2 siblings, 1 reply; 32+ messages in thread From: Steffen Persvold @ 2012-03-16 0:07 UTC (permalink / raw) To: Suresh Siddha Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, Yinghai Lu, Jack Steiner, linux-kernel, x86, Steffen Persvold This allows us to substitute the check in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic and avoid feigning the x2apic cpu feature in the NumaChip apic code. The following apic drivers have separate apic_id_valid() functions which will accept x2apic type IDs : x2apic_phys x2apic_cluster x2apic_uv_x apic_numachip Signed-off-by: Steffen Persvold <sp@numascale.com> --- arch/x86/include/asm/apic.h | 2 +- arch/x86/include/asm/x2apic.h | 5 +++++ arch/x86/kernel/acpi/boot.c | 2 +- arch/x86/kernel/apic/apic_numachip.c | 3 +-- arch/x86/kernel/apic/x2apic_cluster.c | 2 +- arch/x86/kernel/apic/x2apic_phys.c | 2 +- arch/x86/kernel/apic/x2apic_uv_x.c | 7 ++++++- arch/x86/mm/srat.c | 7 +------ 8 files changed, 17 insertions(+), 13 deletions(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index a9371c9..d3eaac4 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -535,7 +535,7 @@ static inline unsigned int read_apic_id(void) static inline int default_apic_id_valid(int apicid) { - return x2apic_mode || (apicid < 255); + return (apicid < 255); } extern void default_setup_apic_routing(void); diff --git a/arch/x86/include/asm/x2apic.h b/arch/x86/include/asm/x2apic.h index 6bf5b8e..92e54ab 100644 --- a/arch/x86/include/asm/x2apic.h +++ b/arch/x86/include/asm/x2apic.h @@ -18,6 +18,11 @@ static const struct cpumask *x2apic_target_cpus(void) return cpu_online_mask; } +static int x2apic_apic_id_valid(int apicid) +{ + return 1; +} + static int x2apic_apic_id_registered(void) { return 1; diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 406ed77..0f42c2f 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -239,7 +239,7 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end) * to not preallocating memory for all NR_CPUS * when we use CPU hotplug. */ - if (!cpu_has_x2apic && (apic_id >= 0xff) && enabled) + if (!apic->apic_id_valid(apic_id) && enabled) printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); else acpi_register_lapic(apic_id, enabled); diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c index d9ea5f3..899803e 100644 --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c @@ -229,11 +229,10 @@ static int __init numachip_system_init(void) } early_initcall(numachip_system_init); -static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) +static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) { if (!strncmp(oem_id, "NUMASC", 6)) { numachip_system = 1; - setup_force_cpu_cap(X86_FEATURE_X2APIC); return 1; } diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index 9193713..48f3103 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c @@ -213,7 +213,7 @@ static struct apic apic_x2apic_cluster = { .name = "cluster x2apic", .probe = x2apic_cluster_probe, .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, - .apic_id_valid = default_apic_id_valid, + .apic_id_valid = x2apic_apic_id_valid, .apic_id_registered = x2apic_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index bcd1db6..8a778db 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c @@ -119,7 +119,7 @@ static struct apic apic_x2apic_phys = { .name = "physical x2apic", .probe = x2apic_phys_probe, .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, - .apic_id_valid = default_apic_id_valid, + .apic_id_valid = x2apic_apic_id_valid, .apic_id_registered = x2apic_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index fc47714..87bfa69 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c @@ -266,6 +266,11 @@ static void uv_send_IPI_all(int vector) uv_send_IPI_mask(cpu_online_mask, vector); } +static int uv_apic_id_valid(int apicid) +{ + return 1; +} + static int uv_apic_id_registered(void) { return 1; @@ -351,7 +356,7 @@ static struct apic __refdata apic_x2apic_uv_x = { .name = "UV large system", .probe = uv_probe, .acpi_madt_oem_check = uv_acpi_madt_oem_check, - .apic_id_valid = default_apic_id_valid, + .apic_id_valid = uv_apic_id_valid, .apic_id_registered = uv_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index 1c1c4f4..7efd0c6 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c @@ -69,12 +69,6 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0) return; pxm = pa->proximity_domain; - apic_id = pa->apic_id; - if (!cpu_has_x2apic && (apic_id >= 0xff)) { - printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n", - pxm, apic_id); - return; - } node = setup_node(pxm); if (node < 0) { printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm); @@ -82,6 +76,7 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) return; } + apic_id = pa->apic_id; if (apic_id >= MAX_LOCAL_APIC) { printk(KERN_INFO "SRAT: PXM %u -> APIC 0x%04x -> Node %u skipped apicid that is too big\n", pxm, apic_id, node); return; -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH] Added separate apic_id_valid() functions for selected apic drivers 2012-03-16 0:07 ` [PATCH] Added separate apic_id_valid() functions for selected apic drivers Steffen Persvold @ 2012-03-16 0:13 ` Suresh Siddha 2012-03-16 0:57 ` Yinghai Lu 2012-03-16 6:45 ` Steffen Persvold 0 siblings, 2 replies; 32+ messages in thread From: Suresh Siddha @ 2012-03-16 0:13 UTC (permalink / raw) To: Steffen Persvold Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, Yinghai Lu, Jack Steiner, linux-kernel, x86 On Fri, 2012-03-16 at 01:07 +0100, Steffen Persvold wrote: > diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c > index 1c1c4f4..7efd0c6 100644 > --- a/arch/x86/mm/srat.c > +++ b/arch/x86/mm/srat.c > @@ -69,12 +69,6 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) > if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0) > return; > pxm = pa->proximity_domain; > - apic_id = pa->apic_id; > - if (!cpu_has_x2apic && (apic_id >= 0xff)) { not sure why you removed this. Shouldn't this be replaced with apic->apic_id_valid() check? thanks. > - printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n", > - pxm, apic_id); > - return; > - } > node = setup_node(pxm); > if (node < 0) { > printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm); > @@ -82,6 +76,7 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) > return; > } > > + apic_id = pa->apic_id; > if (apic_id >= MAX_LOCAL_APIC) { > printk(KERN_INFO "SRAT: PXM %u -> APIC 0x%04x -> Node %u skipped apicid that is too big\n", pxm, apic_id, node); > return; ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Added separate apic_id_valid() functions for selected apic drivers 2012-03-16 0:13 ` Suresh Siddha @ 2012-03-16 0:57 ` Yinghai Lu 2012-03-16 6:45 ` Steffen Persvold 1 sibling, 0 replies; 32+ messages in thread From: Yinghai Lu @ 2012-03-16 0:57 UTC (permalink / raw) To: Suresh Siddha Cc: Steffen Persvold, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, Jack Steiner, linux-kernel, x86 On Thu, Mar 15, 2012 at 5:13 PM, Suresh Siddha <suresh.b.siddha@intel.com> wrote: > On Fri, 2012-03-16 at 01:07 +0100, Steffen Persvold wrote: >> diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c >> index 1c1c4f4..7efd0c6 100644 >> --- a/arch/x86/mm/srat.c >> +++ b/arch/x86/mm/srat.c >> @@ -69,12 +69,6 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) >> if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0) >> return; >> pxm = pa->proximity_domain; >> - apic_id = pa->apic_id; >> - if (!cpu_has_x2apic && (apic_id >= 0xff)) { > > not sure why you removed this. Shouldn't this be replaced with > apic->apic_id_valid() check? > yes, it should change to apic->apic_id_valid(). in arch/x86/kernel/setup.c, early_acpi_boot_init() calling will probe and install right apic. Yinghai ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Added separate apic_id_valid() functions for selected apic drivers 2012-03-16 0:13 ` Suresh Siddha 2012-03-16 0:57 ` Yinghai Lu @ 2012-03-16 6:45 ` Steffen Persvold 1 sibling, 0 replies; 32+ messages in thread From: Steffen Persvold @ 2012-03-16 6:45 UTC (permalink / raw) To: Suresh Siddha Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, Yinghai Lu, Jack Steiner, linux-kernel, x86 On 3/16/2012 01:13, Suresh Siddha wrote: > On Fri, 2012-03-16 at 01:07 +0100, Steffen Persvold wrote: >> diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c >> index 1c1c4f4..7efd0c6 100644 >> --- a/arch/x86/mm/srat.c >> +++ b/arch/x86/mm/srat.c >> @@ -69,12 +69,6 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) >> if ((pa->flags& ACPI_SRAT_CPU_ENABLED) == 0) >> return; >> pxm = pa->proximity_domain; >> - apic_id = pa->apic_id; >> - if (!cpu_has_x2apic&& (apic_id>= 0xff)) { > > not sure why you removed this. Shouldn't this be replaced with > apic->apic_id_valid() check? > Well I removed it in both my patches because Yinghai stated : >>>the checking in SRAT could be removed. >>> >>>Yinghai a couple of emails ago. I could of course use apic->apic_id_valid() here too to avoid parsing the PXM. Cheers, -- Steffen Persvold, Chief Architect NumaChip Numascale AS - www.numascale.com Tel: +47 92 49 25 54 Skype: spersvold ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-15 21:21 ` Suresh Siddha 2012-03-15 22:34 ` Steffen Persvold @ 2012-03-16 2:08 ` Yinghai Lu 2012-03-16 3:03 ` Yinghai Lu 2012-03-16 4:19 ` Yinghai Lu 1 sibling, 2 replies; 32+ messages in thread From: Yinghai Lu @ 2012-03-16 2:08 UTC (permalink / raw) To: Suresh Siddha Cc: Steffen Persvold, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On Thu, Mar 15, 2012 at 2:21 PM, Suresh Siddha <suresh.b.siddha@intel.com> wrote: > On Thu, 2012-03-15 at 13:23 -0700, Yinghai Lu wrote: >> On Thu, Mar 15, 2012 at 11:03 AM, Steffen Persvold <sp@numascale.com> wrote: >> > Use x2apic_supported() in the default_apic_id_valid() function. If x2apic mode is disabled (via nox2apic for example), x2apic_supported() will return false. >> > >> > This allows us to substitute the check in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic and avoid feigning the x2apic cpu feature in the NumaChip apic code. >> > >> > Signed-off-by: Steffen Persvold <sp@numascale.com> >> > Reviewed-by: Daniel J Blueman <daniel@numascale-asia.com> >> >> I double checked on system with x2apic preenabled, >> nox2apic in boot command line still works well and it >> skips starting APs with apic id > 255. >> >> Acked-by: Yinghai Lu <yinghai@kernel.org> > > This breaks the smpboot check if enabling interrupt-remapping/x2apic > fails on a platform. We will be in xapic mode and we don't clear the > x2apic cpufeature bit in this case and as such smpboot check will fail. two cases: A: x2apic is pre-enabled, and some apic id > 255 B: x2apic is not pre-enabled, but x2apic capable, suppose all apic id < 255. in case A: if nox2apic is passed, or dmar table is not there or intr-remap can not be enabled. that feature bit will be cleared. So check cpu_has_x2apic is enough there. in case B: if can not enable x2apic, the feature is not cleared, but apic id already < 255. so that check will pass too. So it should not break the smpboot check. > > So this change breaks the commit > c284b42abadbb22083bfde24d308899c08d44ffa. > > I think the right thing is to have two different apid_id_valid checks > one for xapic driver (apic_flat_64.c) and another for x2apic driver > (x2apic_phys/cluster.c) and that way, x2apic MADT entries will be parsed > only if bios has handed over the OS in x2apic mode or if we have > selected the numachip model. that looks like more clear. Thanks Yinghai ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-16 2:08 ` [PATCH] Use x2apic_supported() in the default_apic_id_valid() function Yinghai Lu @ 2012-03-16 3:03 ` Yinghai Lu 2012-03-16 4:19 ` Yinghai Lu 1 sibling, 0 replies; 32+ messages in thread From: Yinghai Lu @ 2012-03-16 3:03 UTC (permalink / raw) To: Suresh Siddha Cc: Steffen Persvold, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On Thu, Mar 15, 2012 at 7:08 PM, Yinghai Lu <yinghai@kernel.org> wrote: > On Thu, Mar 15, 2012 at 2:21 PM, Suresh Siddha > <suresh.b.siddha@intel.com> wrote: >> On Thu, 2012-03-15 at 13:23 -0700, Yinghai Lu wrote: >>> On Thu, Mar 15, 2012 at 11:03 AM, Steffen Persvold <sp@numascale.com> wrote: >>> > Use x2apic_supported() in the default_apic_id_valid() function. If x2apic mode is disabled (via nox2apic for example), x2apic_supported() will return false. >>> > >>> > This allows us to substitute the check in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic and avoid feigning the x2apic cpu feature in the NumaChip apic code. >>> > >>> > Signed-off-by: Steffen Persvold <sp@numascale.com> >>> > Reviewed-by: Daniel J Blueman <daniel@numascale-asia.com> >>> >>> I double checked on system with x2apic preenabled, >>> nox2apic in boot command line still works well and it >>> skips starting APs with apic id > 255. >>> >>> Acked-by: Yinghai Lu <yinghai@kernel.org> >> >> This breaks the smpboot check if enabling interrupt-remapping/x2apic >> fails on a platform. We will be in xapic mode and we don't clear the >> x2apic cpufeature bit in this case and as such smpboot check will fail. > > two cases: > A: x2apic is pre-enabled, and some apic id > 255 > B: x2apic is not pre-enabled, but x2apic capable, suppose all apic id < 255. > > in case A: if nox2apic is passed, or dmar table is not there or > intr-remap can not be enabled. > that feature bit will be cleared. So check cpu_has_x2apic is enough there. > > in case B: if can not enable x2apic, the feature is not cleared, but > apic id already < 255. > so that check will pass too. > > So it should not break the smpboot check. > >> >> So this change breaks the commit >> c284b42abadbb22083bfde24d308899c08d44ffa. Actually before I sent out acked-by, I did test the patch on my 8 sockets x2apic pre-enabled system with nox2apic. It booted well while skipping all cpu with apic id > 255. Thanks Yinghai ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-16 2:08 ` [PATCH] Use x2apic_supported() in the default_apic_id_valid() function Yinghai Lu 2012-03-16 3:03 ` Yinghai Lu @ 2012-03-16 4:19 ` Yinghai Lu 2012-03-16 6:56 ` Steffen Persvold 1 sibling, 1 reply; 32+ messages in thread From: Yinghai Lu @ 2012-03-16 4:19 UTC (permalink / raw) To: Suresh Siddha Cc: Steffen Persvold, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On Thu, Mar 15, 2012 at 7:08 PM, Yinghai Lu <yinghai@kernel.org> wrote: >> So this change breaks the commit >> c284b42abadbb22083bfde24d308899c08d44ffa. >> >> I think the right thing is to have two different apid_id_valid checks >> one for xapic driver (apic_flat_64.c) and another for x2apic driver >> (x2apic_phys/cluster.c) and that way, x2apic MADT entries will be parsed >> only if bios has handed over the OS in x2apic mode or if we have >> selected the numachip model. > > that looks like more clear. after more thinking, I think We should still use cpu_has_x2apic checking. one maybe invalid case: System have some cpus apic id < 255, and some cpu apic id > 255. BSP apic id < 255. those cpus apic id < 255 will be put into xapic mode, cpus > 255 will be put into x2apic mode. and DMAR table intr-remapping will be working. So if we check x2apic_mode early, will skip cpu with apic id > 255, even switch to x2apic later. Thanks Yinghai Lu ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-16 4:19 ` Yinghai Lu @ 2012-03-16 6:56 ` Steffen Persvold 2012-03-16 16:57 ` Yinghai Lu 0 siblings, 1 reply; 32+ messages in thread From: Steffen Persvold @ 2012-03-16 6:56 UTC (permalink / raw) To: Yinghai Lu Cc: Suresh Siddha, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On 3/16/2012 05:19, Yinghai Lu wrote: > On Thu, Mar 15, 2012 at 7:08 PM, Yinghai Lu<yinghai@kernel.org> wrote: >>> So this change breaks the commit >>> c284b42abadbb22083bfde24d308899c08d44ffa. >>> >>> I think the right thing is to have two different apid_id_valid checks >>> one for xapic driver (apic_flat_64.c) and another for x2apic driver >>> (x2apic_phys/cluster.c) and that way, x2apic MADT entries will be parsed >>> only if bios has handed over the OS in x2apic mode or if we have >>> selected the numachip model. >> >> that looks like more clear. > > after more thinking, I think We should still use cpu_has_x2apic checking. > > one maybe invalid case: > > System have some cpus apic id< 255, and some cpu apic id> 255. > BSP apic id< 255. > those cpus apic id< 255 will be put into xapic mode, cpus> 255 will > be put into x2apic mode. > and DMAR table intr-remapping will be working. Hmm, I didn't know you could have two apic drivers (e.g. apic_flat_64 and x2apic_*) available at the same time ? Or did I read the above wrong ? > > So if we check x2apic_mode early, will skip cpu with apic id> 255, > even switch to x2apic later. > Which one of the two patches I sent, do you (Suresh/Yinghai/others) believe is the best/cleanest and works in all cases. I, unfortunately, can't test the Intel case as I don't have any available to test on :/ Either patch works fine for NumaChip enabled systems. If desired I will re-post the patch with the approach you find best, but add the apic->apic_id_valid() check in the SRAT code aswell. Cheers, -- Steffen Persvold, Chief Architect NumaChip Numascale AS - www.numascale.com Tel: +47 92 49 25 54 Skype: spersvold ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-16 6:56 ` Steffen Persvold @ 2012-03-16 16:57 ` Yinghai Lu 2012-03-16 18:01 ` Suresh Siddha 0 siblings, 1 reply; 32+ messages in thread From: Yinghai Lu @ 2012-03-16 16:57 UTC (permalink / raw) To: Steffen Persvold Cc: Suresh Siddha, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On Thu, Mar 15, 2012 at 11:56 PM, Steffen Persvold <sp@numascale.com> wrote: > Which one of the two patches I sent, do you (Suresh/Yinghai/others) believe > is the best/cleanest and works in all cases. I, unfortunately, can't test > the Intel case as I don't have any available to test on :/ > > Either patch works fine for NumaChip enabled systems. > > If desired I will re-post the patch with the approach you find best, but add > the apic->apic_id_valid() check in the SRAT code aswell. Ok, let use second way that Suresh proposed, please repost that without removing checking in srat. should like: From: Steffen Persvold <sp@numascale.com> Subject: [PATCH] Added separate apic_id_valid() functions for selected apic drivers This allows us to substitute the check in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic and avoid feigning the x2apic cpu feature in the NumaChip apic code. The following apic drivers have separate apic_id_valid() functions which will accept x2apic type IDs : x2apic_phys x2apic_cluster x2apic_uv_x apic_numachip Signed-off-by: Steffen Persvold <sp@numascale.com> --- arch/x86/include/asm/apic.h | 2 +- arch/x86/include/asm/x2apic.h | 5 +++++ arch/x86/kernel/acpi/boot.c | 2 +- arch/x86/kernel/apic/apic_numachip.c | 3 +-- arch/x86/kernel/apic/x2apic_cluster.c | 2 +- arch/x86/kernel/apic/x2apic_phys.c | 2 +- arch/x86/kernel/apic/x2apic_uv_x.c | 7 ++++++- arch/x86/mm/srat.c | 2 +- 8 files changed, 17 insertions(+), 8 deletions(-) Index: linux-2.6/arch/x86/include/asm/apic.h =================================================================== --- linux-2.6.orig/arch/x86/include/asm/apic.h +++ linux-2.6/arch/x86/include/asm/apic.h @@ -535,7 +535,7 @@ static inline unsigned int read_apic_id( static inline int default_apic_id_valid(int apicid) { - return x2apic_mode || (apicid < 255); + return (apicid < 255); } extern void default_setup_apic_routing(void); Index: linux-2.6/arch/x86/include/asm/x2apic.h =================================================================== --- linux-2.6.orig/arch/x86/include/asm/x2apic.h +++ linux-2.6/arch/x86/include/asm/x2apic.h @@ -18,6 +18,11 @@ static const struct cpumask *x2apic_targ return cpu_online_mask; } +static int x2apic_apic_id_valid(int apicid) +{ + return 1; +} + static int x2apic_apic_id_registered(void) { return 1; Index: linux-2.6/arch/x86/kernel/acpi/boot.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/acpi/boot.c +++ linux-2.6/arch/x86/kernel/acpi/boot.c @@ -227,7 +227,7 @@ acpi_parse_x2apic(struct acpi_subtable_h * to not preallocating memory for all NR_CPUS * when we use CPU hotplug. */ - if (!cpu_has_x2apic && (apic_id >= 0xff) && enabled) + if (!apic->apic_id_valid(apic_id) && enabled) printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); else acpi_register_lapic(apic_id, enabled); Index: linux-2.6/arch/x86/kernel/apic/apic_numachip.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/apic/apic_numachip.c +++ linux-2.6/arch/x86/kernel/apic/apic_numachip.c @@ -229,11 +229,10 @@ static int __init numachip_system_init(v } early_initcall(numachip_system_init); -static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) +static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) { if (!strncmp(oem_id, "NUMASC", 6)) { numachip_system = 1; - setup_force_cpu_cap(X86_FEATURE_X2APIC); return 1; } Index: linux-2.6/arch/x86/kernel/apic/x2apic_cluster.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/apic/x2apic_cluster.c +++ linux-2.6/arch/x86/kernel/apic/x2apic_cluster.c @@ -218,7 +218,7 @@ static struct apic apic_x2apic_cluster = .name = "cluster x2apic", .probe = x2apic_cluster_probe, .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, - .apic_id_valid = default_apic_id_valid, + .apic_id_valid = x2apic_apic_id_valid, .apic_id_registered = x2apic_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, Index: linux-2.6/arch/x86/kernel/apic/x2apic_phys.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/apic/x2apic_phys.c +++ linux-2.6/arch/x86/kernel/apic/x2apic_phys.c @@ -119,7 +119,7 @@ static struct apic apic_x2apic_phys = { .name = "physical x2apic", .probe = x2apic_phys_probe, .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, - .apic_id_valid = default_apic_id_valid, + .apic_id_valid = x2apic_apic_id_valid, .apic_id_registered = x2apic_apic_id_registered, .irq_delivery_mode = dest_Fixed, Index: linux-2.6/arch/x86/kernel/apic/x2apic_uv_x.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux-2.6/arch/x86/kernel/apic/x2apic_uv_x.c @@ -266,6 +266,11 @@ static void uv_send_IPI_all(int vector) uv_send_IPI_mask(cpu_online_mask, vector); } +static int uv_apic_id_valid(int apicid) +{ + return 1; +} + static int uv_apic_id_registered(void) { return 1; @@ -351,7 +356,7 @@ static struct apic __refdata apic_x2apic .name = "UV large system", .probe = uv_probe, .acpi_madt_oem_check = uv_acpi_madt_oem_check, - .apic_id_valid = default_apic_id_valid, + .apic_id_valid = uv_apic_id_valid, .apic_id_registered = uv_apic_id_registered, .irq_delivery_mode = dest_Fixed, Index: linux-2.6/arch/x86/mm/srat.c =================================================================== --- linux-2.6.orig/arch/x86/mm/srat.c +++ linux-2.6/arch/x86/mm/srat.c @@ -70,7 +70,7 @@ acpi_numa_x2apic_affinity_init(struct ac return; pxm = pa->proximity_domain; apic_id = pa->apic_id; - if (!cpu_has_x2apic && (apic_id >= 0xff)) { + if (!apic->apic_id_valid(apic_id)) { printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n", pxm, apic_id); return; ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-16 16:57 ` Yinghai Lu @ 2012-03-16 18:01 ` Suresh Siddha 2012-03-16 19:10 ` Yinghai Lu 0 siblings, 1 reply; 32+ messages in thread From: Suresh Siddha @ 2012-03-16 18:01 UTC (permalink / raw) To: Yinghai Lu Cc: Steffen Persvold, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On Fri, 2012-03-16 at 09:57 -0700, Yinghai Lu wrote: > On Thu, Mar 15, 2012 at 11:56 PM, Steffen Persvold <sp@numascale.com> wrote: > > Which one of the two patches I sent, do you (Suresh/Yinghai/others) believe > > is the best/cleanest and works in all cases. I, unfortunately, can't test > > the Intel case as I don't have any available to test on :/ > > > > Either patch works fine for NumaChip enabled systems. > > > > If desired I will re-post the patch with the approach you find best, but add > > the apic->apic_id_valid() check in the SRAT code aswell. > > Ok, let use second way that Suresh proposed, please repost that > without removing checking in srat. > > should like: > > From: Steffen Persvold <sp@numascale.com> > Subject: [PATCH] Added separate apic_id_valid() functions for selected > apic drivers > > This allows us to substitute the check in > arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic and avoid feigning the > x2apic cpu feature in the NumaChip apic code. > > The following apic drivers have separate apic_id_valid() functions > which will accept x2apic type IDs : > > x2apic_phys > x2apic_cluster > x2apic_uv_x > apic_numachip > > Signed-off-by: Steffen Persvold <sp@numascale.com> I have no complaints with this version ;) Acked-by: Suresh Siddha <suresh.b.siddha@intel.com> > --- > arch/x86/include/asm/apic.h | 2 +- > arch/x86/include/asm/x2apic.h | 5 +++++ > arch/x86/kernel/acpi/boot.c | 2 +- > arch/x86/kernel/apic/apic_numachip.c | 3 +-- > arch/x86/kernel/apic/x2apic_cluster.c | 2 +- > arch/x86/kernel/apic/x2apic_phys.c | 2 +- > arch/x86/kernel/apic/x2apic_uv_x.c | 7 ++++++- > arch/x86/mm/srat.c | 2 +- > 8 files changed, 17 insertions(+), 8 deletions(-) > > Index: linux-2.6/arch/x86/include/asm/apic.h > =================================================================== > --- linux-2.6.orig/arch/x86/include/asm/apic.h > +++ linux-2.6/arch/x86/include/asm/apic.h > @@ -535,7 +535,7 @@ static inline unsigned int read_apic_id( > > static inline int default_apic_id_valid(int apicid) > { > - return x2apic_mode || (apicid < 255); > + return (apicid < 255); > } > > extern void default_setup_apic_routing(void); > Index: linux-2.6/arch/x86/include/asm/x2apic.h > =================================================================== > --- linux-2.6.orig/arch/x86/include/asm/x2apic.h > +++ linux-2.6/arch/x86/include/asm/x2apic.h > @@ -18,6 +18,11 @@ static const struct cpumask *x2apic_targ > return cpu_online_mask; > } > > +static int x2apic_apic_id_valid(int apicid) > +{ > + return 1; > +} > + > static int x2apic_apic_id_registered(void) > { > return 1; > Index: linux-2.6/arch/x86/kernel/acpi/boot.c > =================================================================== > --- linux-2.6.orig/arch/x86/kernel/acpi/boot.c > +++ linux-2.6/arch/x86/kernel/acpi/boot.c > @@ -227,7 +227,7 @@ acpi_parse_x2apic(struct acpi_subtable_h > * to not preallocating memory for all NR_CPUS > * when we use CPU hotplug. > */ > - if (!cpu_has_x2apic && (apic_id >= 0xff) && enabled) > + if (!apic->apic_id_valid(apic_id) && enabled) > printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); > else > acpi_register_lapic(apic_id, enabled); > Index: linux-2.6/arch/x86/kernel/apic/apic_numachip.c > =================================================================== > --- linux-2.6.orig/arch/x86/kernel/apic/apic_numachip.c > +++ linux-2.6/arch/x86/kernel/apic/apic_numachip.c > @@ -229,11 +229,10 @@ static int __init numachip_system_init(v > } > early_initcall(numachip_system_init); > > -static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char > *oem_table_id) > +static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) > { > if (!strncmp(oem_id, "NUMASC", 6)) { > numachip_system = 1; > - setup_force_cpu_cap(X86_FEATURE_X2APIC); > return 1; > } > > Index: linux-2.6/arch/x86/kernel/apic/x2apic_cluster.c > =================================================================== > --- linux-2.6.orig/arch/x86/kernel/apic/x2apic_cluster.c > +++ linux-2.6/arch/x86/kernel/apic/x2apic_cluster.c > @@ -218,7 +218,7 @@ static struct apic apic_x2apic_cluster = > .name = "cluster x2apic", > .probe = x2apic_cluster_probe, > .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, > - .apic_id_valid = default_apic_id_valid, > + .apic_id_valid = x2apic_apic_id_valid, > .apic_id_registered = x2apic_apic_id_registered, > > .irq_delivery_mode = dest_LowestPrio, > Index: linux-2.6/arch/x86/kernel/apic/x2apic_phys.c > =================================================================== > --- linux-2.6.orig/arch/x86/kernel/apic/x2apic_phys.c > +++ linux-2.6/arch/x86/kernel/apic/x2apic_phys.c > @@ -119,7 +119,7 @@ static struct apic apic_x2apic_phys = { > .name = "physical x2apic", > .probe = x2apic_phys_probe, > .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, > - .apic_id_valid = default_apic_id_valid, > + .apic_id_valid = x2apic_apic_id_valid, > .apic_id_registered = x2apic_apic_id_registered, > > .irq_delivery_mode = dest_Fixed, > Index: linux-2.6/arch/x86/kernel/apic/x2apic_uv_x.c > =================================================================== > --- linux-2.6.orig/arch/x86/kernel/apic/x2apic_uv_x.c > +++ linux-2.6/arch/x86/kernel/apic/x2apic_uv_x.c > @@ -266,6 +266,11 @@ static void uv_send_IPI_all(int vector) > uv_send_IPI_mask(cpu_online_mask, vector); > } > > +static int uv_apic_id_valid(int apicid) > +{ > + return 1; > +} > + > static int uv_apic_id_registered(void) > { > return 1; > @@ -351,7 +356,7 @@ static struct apic __refdata apic_x2apic > .name = "UV large system", > .probe = uv_probe, > .acpi_madt_oem_check = uv_acpi_madt_oem_check, > - .apic_id_valid = default_apic_id_valid, > + .apic_id_valid = uv_apic_id_valid, > .apic_id_registered = uv_apic_id_registered, > > .irq_delivery_mode = dest_Fixed, > Index: linux-2.6/arch/x86/mm/srat.c > =================================================================== > --- linux-2.6.orig/arch/x86/mm/srat.c > +++ linux-2.6/arch/x86/mm/srat.c > @@ -70,7 +70,7 @@ acpi_numa_x2apic_affinity_init(struct ac > return; > pxm = pa->proximity_domain; > apic_id = pa->apic_id; > - if (!cpu_has_x2apic && (apic_id >= 0xff)) { > + if (!apic->apic_id_valid(apic_id)) { > printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n", > pxm, apic_id); > return; ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] Use x2apic_supported() in the default_apic_id_valid() function. 2012-03-16 18:01 ` Suresh Siddha @ 2012-03-16 19:10 ` Yinghai Lu 2012-03-16 19:25 ` [PATCH REPOST] Added separate apic_id_valid() functions for selected apic drivers Steffen Persvold 0 siblings, 1 reply; 32+ messages in thread From: Yinghai Lu @ 2012-03-16 19:10 UTC (permalink / raw) To: Suresh Siddha Cc: Steffen Persvold, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, linux-kernel, x86 On Fri, Mar 16, 2012 at 11:01 AM, Suresh Siddha <suresh.b.siddha@intel.com> wrote: > On Fri, 2012-03-16 at 09:57 -0700, Yinghai Lu wrote: >> On Thu, Mar 15, 2012 at 11:56 PM, Steffen Persvold <sp@numascale.com> wrote: >> > Which one of the two patches I sent, do you (Suresh/Yinghai/others) believe >> > is the best/cleanest and works in all cases. I, unfortunately, can't test >> > the Intel case as I don't have any available to test on :/ >> > >> > Either patch works fine for NumaChip enabled systems. >> > >> > If desired I will re-post the patch with the approach you find best, but add >> > the apic->apic_id_valid() check in the SRAT code aswell. >> >> Ok, let use second way that Suresh proposed, please repost that >> without removing checking in srat. >> >> should like: >> >> From: Steffen Persvold <sp@numascale.com> >> Subject: [PATCH] Added separate apic_id_valid() functions for selected >> apic drivers >> >> This allows us to substitute the check in >> arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic and avoid feigning the >> x2apic cpu feature in the NumaChip apic code. >> >> The following apic drivers have separate apic_id_valid() functions >> which will accept x2apic type IDs : >> >> x2apic_phys >> x2apic_cluster >> x2apic_uv_x >> apic_numachip >> >> Signed-off-by: Steffen Persvold <sp@numascale.com> > > I have no complaints with this version ;) > > Acked-by: Suresh Siddha <suresh.b.siddha@intel.com> good, also we could add more lines in changelog: for x2apic pre-enabled system, apic driver is set already early through early_acpi_boot_init()/early_acpi_process_madt()/acpi_parse_madt()/default_acpi_madt_oem_check() so that apic_id_valid() checking will let entry go during MADT and SRAT prasing. for x2apic not pre-enabled system, all apic id should be less than 255. Acked-by: Yinghai Lu <yinghai@kernel.org> > >> --- >> arch/x86/include/asm/apic.h | 2 +- >> arch/x86/include/asm/x2apic.h | 5 +++++ >> arch/x86/kernel/acpi/boot.c | 2 +- >> arch/x86/kernel/apic/apic_numachip.c | 3 +-- >> arch/x86/kernel/apic/x2apic_cluster.c | 2 +- >> arch/x86/kernel/apic/x2apic_phys.c | 2 +- >> arch/x86/kernel/apic/x2apic_uv_x.c | 7 ++++++- >> arch/x86/mm/srat.c | 2 +- >> 8 files changed, 17 insertions(+), 8 deletions(-) >> >> Index: linux-2.6/arch/x86/include/asm/apic.h >> =================================================================== >> --- linux-2.6.orig/arch/x86/include/asm/apic.h >> +++ linux-2.6/arch/x86/include/asm/apic.h >> @@ -535,7 +535,7 @@ static inline unsigned int read_apic_id( >> >> static inline int default_apic_id_valid(int apicid) >> { >> - return x2apic_mode || (apicid < 255); >> + return (apicid < 255); >> } >> >> extern void default_setup_apic_routing(void); >> Index: linux-2.6/arch/x86/include/asm/x2apic.h >> =================================================================== >> --- linux-2.6.orig/arch/x86/include/asm/x2apic.h >> +++ linux-2.6/arch/x86/include/asm/x2apic.h >> @@ -18,6 +18,11 @@ static const struct cpumask *x2apic_targ >> return cpu_online_mask; >> } >> >> +static int x2apic_apic_id_valid(int apicid) >> +{ >> + return 1; >> +} >> + >> static int x2apic_apic_id_registered(void) >> { >> return 1; >> Index: linux-2.6/arch/x86/kernel/acpi/boot.c >> =================================================================== >> --- linux-2.6.orig/arch/x86/kernel/acpi/boot.c >> +++ linux-2.6/arch/x86/kernel/acpi/boot.c >> @@ -227,7 +227,7 @@ acpi_parse_x2apic(struct acpi_subtable_h >> * to not preallocating memory for all NR_CPUS >> * when we use CPU hotplug. >> */ >> - if (!cpu_has_x2apic && (apic_id >= 0xff) && enabled) >> + if (!apic->apic_id_valid(apic_id) && enabled) >> printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); >> else >> acpi_register_lapic(apic_id, enabled); >> Index: linux-2.6/arch/x86/kernel/apic/apic_numachip.c >> =================================================================== >> --- linux-2.6.orig/arch/x86/kernel/apic/apic_numachip.c >> +++ linux-2.6/arch/x86/kernel/apic/apic_numachip.c >> @@ -229,11 +229,10 @@ static int __init numachip_system_init(v >> } >> early_initcall(numachip_system_init); >> >> -static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char >> *oem_table_id) >> +static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) >> { >> if (!strncmp(oem_id, "NUMASC", 6)) { >> numachip_system = 1; >> - setup_force_cpu_cap(X86_FEATURE_X2APIC); >> return 1; >> } >> >> Index: linux-2.6/arch/x86/kernel/apic/x2apic_cluster.c >> =================================================================== >> --- linux-2.6.orig/arch/x86/kernel/apic/x2apic_cluster.c >> +++ linux-2.6/arch/x86/kernel/apic/x2apic_cluster.c >> @@ -218,7 +218,7 @@ static struct apic apic_x2apic_cluster = >> .name = "cluster x2apic", >> .probe = x2apic_cluster_probe, >> .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, >> - .apic_id_valid = default_apic_id_valid, >> + .apic_id_valid = x2apic_apic_id_valid, >> .apic_id_registered = x2apic_apic_id_registered, >> >> .irq_delivery_mode = dest_LowestPrio, >> Index: linux-2.6/arch/x86/kernel/apic/x2apic_phys.c >> =================================================================== >> --- linux-2.6.orig/arch/x86/kernel/apic/x2apic_phys.c >> +++ linux-2.6/arch/x86/kernel/apic/x2apic_phys.c >> @@ -119,7 +119,7 @@ static struct apic apic_x2apic_phys = { >> .name = "physical x2apic", >> .probe = x2apic_phys_probe, >> .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, >> - .apic_id_valid = default_apic_id_valid, >> + .apic_id_valid = x2apic_apic_id_valid, >> .apic_id_registered = x2apic_apic_id_registered, >> >> .irq_delivery_mode = dest_Fixed, >> Index: linux-2.6/arch/x86/kernel/apic/x2apic_uv_x.c >> =================================================================== >> --- linux-2.6.orig/arch/x86/kernel/apic/x2apic_uv_x.c >> +++ linux-2.6/arch/x86/kernel/apic/x2apic_uv_x.c >> @@ -266,6 +266,11 @@ static void uv_send_IPI_all(int vector) >> uv_send_IPI_mask(cpu_online_mask, vector); >> } >> >> +static int uv_apic_id_valid(int apicid) >> +{ >> + return 1; >> +} >> + >> static int uv_apic_id_registered(void) >> { >> return 1; >> @@ -351,7 +356,7 @@ static struct apic __refdata apic_x2apic >> .name = "UV large system", >> .probe = uv_probe, >> .acpi_madt_oem_check = uv_acpi_madt_oem_check, >> - .apic_id_valid = default_apic_id_valid, >> + .apic_id_valid = uv_apic_id_valid, >> .apic_id_registered = uv_apic_id_registered, >> >> .irq_delivery_mode = dest_Fixed, >> Index: linux-2.6/arch/x86/mm/srat.c >> =================================================================== >> --- linux-2.6.orig/arch/x86/mm/srat.c >> +++ linux-2.6/arch/x86/mm/srat.c >> @@ -70,7 +70,7 @@ acpi_numa_x2apic_affinity_init(struct ac >> return; >> pxm = pa->proximity_domain; >> apic_id = pa->apic_id; >> - if (!cpu_has_x2apic && (apic_id >= 0xff)) { >> + if (!apic->apic_id_valid(apic_id)) { >> printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n", >> pxm, apic_id); >> return; > > ^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH REPOST] Added separate apic_id_valid() functions for selected apic drivers. 2012-03-16 19:10 ` Yinghai Lu @ 2012-03-16 19:25 ` Steffen Persvold 2012-03-20 10:41 ` Steffen Persvold 2012-03-23 19:45 ` [tip:x86/urgent] x86/apic: Add " tip-bot for Steffen Persvold 0 siblings, 2 replies; 32+ messages in thread From: Steffen Persvold @ 2012-03-16 19:25 UTC (permalink / raw) To: Ingo Molnar Cc: Suresh Siddha, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, Yinghai Lu, Jack Steiner, linux-kernel, x86, Steffen Persvold As suggested by Suresh Siddha <suresh.b.siddha@intel.com> and Yinghai Lu <yinghai@kernel.org> : For x2apic pre-enabled systems, apic driver is set already early through early_acpi_boot_init()/early_acpi_process_madt()/acpi_parse_madt()/default_acpi_madt_oem_check() so that apic_id_valid() checking will be sufficient during MADT and SRAT prasing. For non- x2apic pre-enabled systems, all apic ids should be less than 255. This allows us to substitute the checks in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic() and arch/x86/mm/srat.c::acpi_numa_x2apic_affinity_init() with apic->apic_id_valid(). In addition we can avoid feigning the x2apic cpu feature in the NumaChip apic code. The following apic drivers have separate apic_id_valid() functions which will accept x2apic type IDs : x2apic_phys x2apic_cluster x2apic_uv_x apic_numachip Signed-off-by: Steffen Persvold <sp@numascale.com> --- arch/x86/include/asm/apic.h | 2 +- arch/x86/include/asm/x2apic.h | 5 +++++ arch/x86/kernel/acpi/boot.c | 2 +- arch/x86/kernel/apic/apic_numachip.c | 3 +-- arch/x86/kernel/apic/x2apic_cluster.c | 2 +- arch/x86/kernel/apic/x2apic_phys.c | 2 +- arch/x86/kernel/apic/x2apic_uv_x.c | 7 ++++++- arch/x86/mm/srat.c | 2 +- 8 files changed, 17 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index a9371c9..d3eaac4 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -535,7 +535,7 @@ static inline unsigned int read_apic_id(void) static inline int default_apic_id_valid(int apicid) { - return x2apic_mode || (apicid < 255); + return (apicid < 255); } extern void default_setup_apic_routing(void); diff --git a/arch/x86/include/asm/x2apic.h b/arch/x86/include/asm/x2apic.h index 6bf5b8e..92e54ab 100644 --- a/arch/x86/include/asm/x2apic.h +++ b/arch/x86/include/asm/x2apic.h @@ -18,6 +18,11 @@ static const struct cpumask *x2apic_target_cpus(void) return cpu_online_mask; } +static int x2apic_apic_id_valid(int apicid) +{ + return 1; +} + static int x2apic_apic_id_registered(void) { return 1; diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index ce664f3..4b5059c 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -239,7 +239,7 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end) * to not preallocating memory for all NR_CPUS * when we use CPU hotplug. */ - if (!cpu_has_x2apic && (apic_id >= 0xff) && enabled) + if (!apic->apic_id_valid(apic_id) && enabled) printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); else acpi_register_lapic(apic_id, enabled); diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c index d9ea5f3..899803e 100644 --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c @@ -229,11 +229,10 @@ static int __init numachip_system_init(void) } early_initcall(numachip_system_init); -static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) +static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) { if (!strncmp(oem_id, "NUMASC", 6)) { numachip_system = 1; - setup_force_cpu_cap(X86_FEATURE_X2APIC); return 1; } diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index 9193713..48f3103 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c @@ -213,7 +213,7 @@ static struct apic apic_x2apic_cluster = { .name = "cluster x2apic", .probe = x2apic_cluster_probe, .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, - .apic_id_valid = default_apic_id_valid, + .apic_id_valid = x2apic_apic_id_valid, .apic_id_registered = x2apic_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index bcd1db6..8a778db 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c @@ -119,7 +119,7 @@ static struct apic apic_x2apic_phys = { .name = "physical x2apic", .probe = x2apic_phys_probe, .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, - .apic_id_valid = default_apic_id_valid, + .apic_id_valid = x2apic_apic_id_valid, .apic_id_registered = x2apic_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index fc47714..87bfa69 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c @@ -266,6 +266,11 @@ static void uv_send_IPI_all(int vector) uv_send_IPI_mask(cpu_online_mask, vector); } +static int uv_apic_id_valid(int apicid) +{ + return 1; +} + static int uv_apic_id_registered(void) { return 1; @@ -351,7 +356,7 @@ static struct apic __refdata apic_x2apic_uv_x = { .name = "UV large system", .probe = uv_probe, .acpi_madt_oem_check = uv_acpi_madt_oem_check, - .apic_id_valid = default_apic_id_valid, + .apic_id_valid = uv_apic_id_valid, .apic_id_registered = uv_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index 1c1c4f4..efb5b4b 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c @@ -70,7 +70,7 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) return; pxm = pa->proximity_domain; apic_id = pa->apic_id; - if (!cpu_has_x2apic && (apic_id >= 0xff)) { + if (!apic->apic_id_valid(apic_id)) { printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n", pxm, apic_id); return; -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH REPOST] Added separate apic_id_valid() functions for selected apic drivers. 2012-03-16 19:25 ` [PATCH REPOST] Added separate apic_id_valid() functions for selected apic drivers Steffen Persvold @ 2012-03-20 10:41 ` Steffen Persvold 2012-03-20 10:49 ` Ingo Molnar 2012-03-23 19:45 ` [tip:x86/urgent] x86/apic: Add " tip-bot for Steffen Persvold 1 sibling, 1 reply; 32+ messages in thread From: Steffen Persvold @ 2012-03-20 10:41 UTC (permalink / raw) To: Ingo Molnar Cc: Suresh Siddha, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, Yinghai Lu, Jack Steiner, linux-kernel, x86 On 3/16/2012 20:25, Steffen Persvold wrote: > As suggested by Suresh Siddha<suresh.b.siddha@intel.com> and Yinghai Lu<yinghai@kernel.org> : > > For x2apic pre-enabled systems, apic driver is set already early through early_acpi_boot_init()/early_acpi_process_madt()/acpi_parse_madt()/default_acpi_madt_oem_check() so that apic_id_valid() checking will be sufficient during MADT and SRAT prasing. For non- x2apic pre-enabled systems, all apic ids should be less than 255. > > This allows us to substitute the checks in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic() and arch/x86/mm/srat.c::acpi_numa_x2apic_affinity_init() with apic->apic_id_valid(). > > In addition we can avoid feigning the x2apic cpu feature in the NumaChip apic code. > > The following apic drivers have separate apic_id_valid() functions which will accept x2apic type IDs : > > x2apic_phys > x2apic_cluster > x2apic_uv_x > apic_numachip > > Signed-off-by: Steffen Persvold<sp@numascale.com> Ingo, any comments on this approach ? It should cover both cases as suggested by Suresh and Yinghai. Kind regards, -- Steffen Persvold, Chief Architect NumaChip Numascale AS - www.numascale.com Tel: +47 92 49 25 54 Skype: spersvold > --- > arch/x86/include/asm/apic.h | 2 +- > arch/x86/include/asm/x2apic.h | 5 +++++ > arch/x86/kernel/acpi/boot.c | 2 +- > arch/x86/kernel/apic/apic_numachip.c | 3 +-- > arch/x86/kernel/apic/x2apic_cluster.c | 2 +- > arch/x86/kernel/apic/x2apic_phys.c | 2 +- > arch/x86/kernel/apic/x2apic_uv_x.c | 7 ++++++- > arch/x86/mm/srat.c | 2 +- > 8 files changed, 17 insertions(+), 8 deletions(-) > > diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h > index a9371c9..d3eaac4 100644 > --- a/arch/x86/include/asm/apic.h > +++ b/arch/x86/include/asm/apic.h > @@ -535,7 +535,7 @@ static inline unsigned int read_apic_id(void) > > static inline int default_apic_id_valid(int apicid) > { > - return x2apic_mode || (apicid< 255); > + return (apicid< 255); > } > > extern void default_setup_apic_routing(void); > diff --git a/arch/x86/include/asm/x2apic.h b/arch/x86/include/asm/x2apic.h > index 6bf5b8e..92e54ab 100644 > --- a/arch/x86/include/asm/x2apic.h > +++ b/arch/x86/include/asm/x2apic.h > @@ -18,6 +18,11 @@ static const struct cpumask *x2apic_target_cpus(void) > return cpu_online_mask; > } > > +static int x2apic_apic_id_valid(int apicid) > +{ > + return 1; > +} > + > static int x2apic_apic_id_registered(void) > { > return 1; > diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c > index ce664f3..4b5059c 100644 > --- a/arch/x86/kernel/acpi/boot.c > +++ b/arch/x86/kernel/acpi/boot.c > @@ -239,7 +239,7 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end) > * to not preallocating memory for all NR_CPUS > * when we use CPU hotplug. > */ > - if (!cpu_has_x2apic&& (apic_id>= 0xff)&& enabled) > + if (!apic->apic_id_valid(apic_id)&& enabled) > printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); > else > acpi_register_lapic(apic_id, enabled); > diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c > index d9ea5f3..899803e 100644 > --- a/arch/x86/kernel/apic/apic_numachip.c > +++ b/arch/x86/kernel/apic/apic_numachip.c > @@ -229,11 +229,10 @@ static int __init numachip_system_init(void) > } > early_initcall(numachip_system_init); > > -static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) > +static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) > { > if (!strncmp(oem_id, "NUMASC", 6)) { > numachip_system = 1; > - setup_force_cpu_cap(X86_FEATURE_X2APIC); > return 1; > } > > diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c > index 9193713..48f3103 100644 > --- a/arch/x86/kernel/apic/x2apic_cluster.c > +++ b/arch/x86/kernel/apic/x2apic_cluster.c > @@ -213,7 +213,7 @@ static struct apic apic_x2apic_cluster = { > .name = "cluster x2apic", > .probe = x2apic_cluster_probe, > .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, > - .apic_id_valid = default_apic_id_valid, > + .apic_id_valid = x2apic_apic_id_valid, > .apic_id_registered = x2apic_apic_id_registered, > > .irq_delivery_mode = dest_LowestPrio, > diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c > index bcd1db6..8a778db 100644 > --- a/arch/x86/kernel/apic/x2apic_phys.c > +++ b/arch/x86/kernel/apic/x2apic_phys.c > @@ -119,7 +119,7 @@ static struct apic apic_x2apic_phys = { > .name = "physical x2apic", > .probe = x2apic_phys_probe, > .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, > - .apic_id_valid = default_apic_id_valid, > + .apic_id_valid = x2apic_apic_id_valid, > .apic_id_registered = x2apic_apic_id_registered, > > .irq_delivery_mode = dest_Fixed, > diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c > index fc47714..87bfa69 100644 > --- a/arch/x86/kernel/apic/x2apic_uv_x.c > +++ b/arch/x86/kernel/apic/x2apic_uv_x.c > @@ -266,6 +266,11 @@ static void uv_send_IPI_all(int vector) > uv_send_IPI_mask(cpu_online_mask, vector); > } > > +static int uv_apic_id_valid(int apicid) > +{ > + return 1; > +} > + > static int uv_apic_id_registered(void) > { > return 1; > @@ -351,7 +356,7 @@ static struct apic __refdata apic_x2apic_uv_x = { > .name = "UV large system", > .probe = uv_probe, > .acpi_madt_oem_check = uv_acpi_madt_oem_check, > - .apic_id_valid = default_apic_id_valid, > + .apic_id_valid = uv_apic_id_valid, > .apic_id_registered = uv_apic_id_registered, > > .irq_delivery_mode = dest_Fixed, > diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c > index 1c1c4f4..efb5b4b 100644 > --- a/arch/x86/mm/srat.c > +++ b/arch/x86/mm/srat.c > @@ -70,7 +70,7 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) > return; > pxm = pa->proximity_domain; > apic_id = pa->apic_id; > - if (!cpu_has_x2apic&& (apic_id>= 0xff)) { > + if (!apic->apic_id_valid(apic_id)) { > printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n", > pxm, apic_id); > return; ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH REPOST] Added separate apic_id_valid() functions for selected apic drivers. 2012-03-20 10:41 ` Steffen Persvold @ 2012-03-20 10:49 ` Ingo Molnar 0 siblings, 0 replies; 32+ messages in thread From: Ingo Molnar @ 2012-03-20 10:49 UTC (permalink / raw) To: Steffen Persvold Cc: Ingo Molnar, Suresh Siddha, Thomas Gleixner, H. Peter Anvin, Daniel J Blueman, Yinghai Lu, Jack Steiner, linux-kernel, x86 * Steffen Persvold <sp@numascale.com> wrote: > Ingo, any comments on this approach ? It should cover both > cases as suggested by Suresh and Yinghai. Looks good in principle, but we are in the v3.4 merge window right now - new patches will have to wait a bit. Thanks, Ingo ^ permalink raw reply [flat|nested] 32+ messages in thread
* [tip:x86/urgent] x86/apic: Add separate apic_id_valid() functions for selected apic drivers 2012-03-16 19:25 ` [PATCH REPOST] Added separate apic_id_valid() functions for selected apic drivers Steffen Persvold 2012-03-20 10:41 ` Steffen Persvold @ 2012-03-23 19:45 ` tip-bot for Steffen Persvold 1 sibling, 0 replies; 32+ messages in thread From: tip-bot for Steffen Persvold @ 2012-03-23 19:45 UTC (permalink / raw) To: linux-tip-commits Cc: linux-kernel, hpa, mingo, yinghai, sp, steiner, suresh.b.siddha, tglx, daniel Commit-ID: b7157acf429e6aef690646ba964b9ebd25049ec2 Gitweb: http://git.kernel.org/tip/b7157acf429e6aef690646ba964b9ebd25049ec2 Author: Steffen Persvold <sp@numascale.com> AuthorDate: Fri, 16 Mar 2012 20:25:35 +0100 Committer: Ingo Molnar <mingo@kernel.org> CommitDate: Fri, 23 Mar 2012 13:28:43 +0100 x86/apic: Add separate apic_id_valid() functions for selected apic drivers As suggested by Suresh Siddha and Yinghai Lu: For x2apic pre-enabled systems, apic driver is set already early through early_acpi_boot_init()/early_acpi_process_madt()/ acpi_parse_madt()/default_acpi_madt_oem_check() path so that apic_id_valid() checking will be sufficient during MADT and SRAT parsing. For non-x2apic pre-enabled systems, all apic ids should be less than 255. This allows us to substitute the checks in arch/x86/kernel/acpi/boot.c::acpi_parse_x2apic() and arch/x86/mm/srat.c::acpi_numa_x2apic_affinity_init() with apic->apic_id_valid(). In addition we can avoid feigning the x2apic cpu feature in the NumaChip apic code. The following apic drivers have separate apic_id_valid() functions which will accept x2apic type IDs : x2apic_phys x2apic_cluster x2apic_uv_x apic_numachip Signed-off-by: Steffen Persvold <sp@numascale.com> Cc: Suresh Siddha <suresh.b.siddha@intel.com> Cc: Daniel J Blueman <daniel@numascale-asia.com> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Jack Steiner <steiner@sgi.com> Link: http://lkml.kernel.org/r/1331925935-13372-1-git-send-email-sp@numascale.com Signed-off-by: Ingo Molnar <mingo@kernel.org> --- arch/x86/include/asm/apic.h | 2 +- arch/x86/include/asm/x2apic.h | 5 +++++ arch/x86/kernel/acpi/boot.c | 2 +- arch/x86/kernel/apic/apic_numachip.c | 3 +-- arch/x86/kernel/apic/x2apic_cluster.c | 2 +- arch/x86/kernel/apic/x2apic_phys.c | 2 +- arch/x86/kernel/apic/x2apic_uv_x.c | 7 ++++++- arch/x86/mm/srat.c | 2 +- 8 files changed, 17 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index a9371c9..d3eaac4 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -535,7 +535,7 @@ static inline unsigned int read_apic_id(void) static inline int default_apic_id_valid(int apicid) { - return x2apic_mode || (apicid < 255); + return (apicid < 255); } extern void default_setup_apic_routing(void); diff --git a/arch/x86/include/asm/x2apic.h b/arch/x86/include/asm/x2apic.h index 6bf5b8e..92e54ab 100644 --- a/arch/x86/include/asm/x2apic.h +++ b/arch/x86/include/asm/x2apic.h @@ -18,6 +18,11 @@ static const struct cpumask *x2apic_target_cpus(void) return cpu_online_mask; } +static int x2apic_apic_id_valid(int apicid) +{ + return 1; +} + static int x2apic_apic_id_registered(void) { return 1; diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 406ed77..0f42c2f 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -239,7 +239,7 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end) * to not preallocating memory for all NR_CPUS * when we use CPU hotplug. */ - if (!cpu_has_x2apic && (apic_id >= 0xff) && enabled) + if (!apic->apic_id_valid(apic_id) && enabled) printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); else acpi_register_lapic(apic_id, enabled); diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c index d9ea5f3..899803e 100644 --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c @@ -229,11 +229,10 @@ static int __init numachip_system_init(void) } early_initcall(numachip_system_init); -static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) +static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) { if (!strncmp(oem_id, "NUMASC", 6)) { numachip_system = 1; - setup_force_cpu_cap(X86_FEATURE_X2APIC); return 1; } diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index 9193713..48f3103 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c @@ -213,7 +213,7 @@ static struct apic apic_x2apic_cluster = { .name = "cluster x2apic", .probe = x2apic_cluster_probe, .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, - .apic_id_valid = default_apic_id_valid, + .apic_id_valid = x2apic_apic_id_valid, .apic_id_registered = x2apic_apic_id_registered, .irq_delivery_mode = dest_LowestPrio, diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index bcd1db6..8a778db 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c @@ -119,7 +119,7 @@ static struct apic apic_x2apic_phys = { .name = "physical x2apic", .probe = x2apic_phys_probe, .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, - .apic_id_valid = default_apic_id_valid, + .apic_id_valid = x2apic_apic_id_valid, .apic_id_registered = x2apic_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index fc47714..87bfa69 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c @@ -266,6 +266,11 @@ static void uv_send_IPI_all(int vector) uv_send_IPI_mask(cpu_online_mask, vector); } +static int uv_apic_id_valid(int apicid) +{ + return 1; +} + static int uv_apic_id_registered(void) { return 1; @@ -351,7 +356,7 @@ static struct apic __refdata apic_x2apic_uv_x = { .name = "UV large system", .probe = uv_probe, .acpi_madt_oem_check = uv_acpi_madt_oem_check, - .apic_id_valid = default_apic_id_valid, + .apic_id_valid = uv_apic_id_valid, .apic_id_registered = uv_apic_id_registered, .irq_delivery_mode = dest_Fixed, diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index 1c1c4f4..efb5b4b 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c @@ -70,7 +70,7 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) return; pxm = pa->proximity_domain; apic_id = pa->apic_id; - if (!cpu_has_x2apic && (apic_id >= 0xff)) { + if (!apic->apic_id_valid(apic_id)) { printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n", pxm, apic_id); return; ^ permalink raw reply related [flat|nested] 32+ messages in thread
end of thread, other threads:[~2012-03-23 19:46 UTC | newest] Thread overview: 32+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-03-13 9:29 x2APIC and many-APIC systems Daniel J Blueman 2012-03-13 22:58 ` Yinghai Lu 2012-03-13 23:16 ` Suresh Siddha 2012-03-14 7:17 ` [PATCH] Move APIC ID validity check into platform APIC code Daniel J Blueman 2012-03-14 11:27 ` [tip:x86/platform] x86/platform: " tip-bot for Daniel J Blueman 2012-03-14 17:58 ` [PATCH] " Yinghai Lu 2012-03-14 20:18 ` Steffen Persvold 2012-03-14 23:19 ` Yinghai Lu 2012-03-15 18:03 ` [PATCH] Use x2apic_supported() in the default_apic_id_valid() function Steffen Persvold 2012-03-15 20:23 ` Yinghai Lu 2012-03-15 21:21 ` Suresh Siddha 2012-03-15 22:34 ` Steffen Persvold 2012-03-15 22:58 ` Steffen Persvold 2012-03-15 23:04 ` Suresh Siddha 2012-03-15 23:17 ` Steffen Persvold 2012-03-15 23:33 ` Steffen Persvold 2012-03-15 23:44 ` Steffen Persvold 2012-03-16 0:07 ` [PATCH] Added separate apic_id_valid() functions for selected apic drivers Steffen Persvold 2012-03-16 0:13 ` Suresh Siddha 2012-03-16 0:57 ` Yinghai Lu 2012-03-16 6:45 ` Steffen Persvold 2012-03-16 2:08 ` [PATCH] Use x2apic_supported() in the default_apic_id_valid() function Yinghai Lu 2012-03-16 3:03 ` Yinghai Lu 2012-03-16 4:19 ` Yinghai Lu 2012-03-16 6:56 ` Steffen Persvold 2012-03-16 16:57 ` Yinghai Lu 2012-03-16 18:01 ` Suresh Siddha 2012-03-16 19:10 ` Yinghai Lu 2012-03-16 19:25 ` [PATCH REPOST] Added separate apic_id_valid() functions for selected apic drivers Steffen Persvold 2012-03-20 10:41 ` Steffen Persvold 2012-03-20 10:49 ` Ingo Molnar 2012-03-23 19:45 ` [tip:x86/urgent] x86/apic: Add " tip-bot for Steffen Persvold
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox