* [PATCH 01/15] x86, apic: Don't write io_apic ID if it is not changed
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 1:02 ` [PATCH 02/15] x86, apic: Fix lapic mapping with construct ISA and visws mptable path Yinghai Lu
` (13 subsequent siblings)
14 siblings, 0 replies; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
For 32bit mptable path, setup_ids_from_mpc() always write io apic id
register, even there is no change needed.
So try to do that when they are different bewteen reading out and mptable
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/apic/io_apic.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index ce3c6fb..0579b3b 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2006,7 +2006,6 @@ void __init setup_ioapic_ids_from_mpc(void)
physids_or(phys_id_present_map, phys_id_present_map, tmp);
}
-
/*
* We need to adjust the IRQ routing table
* if the ID changed.
@@ -2018,9 +2017,12 @@ void __init setup_ioapic_ids_from_mpc(void)
= mp_ioapics[apic_id].apicid;
/*
- * Read the right value from the MPC table and
- * write it into the ID register.
+ * Update the ID register according to the right value from
+ * the MPC table if they are different.
*/
+ if (mp_ioapics[apic_id].apicid == reg_00.bits.ID)
+ continue;
+
apic_printk(APIC_VERBOSE, KERN_INFO
"...changing IO-APIC physical APIC ID to %d ...",
mp_ioapics[apic_id].apicid);
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH 02/15] x86, apic: Fix lapic mapping with construct ISA and visws mptable path
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
2010-10-24 1:02 ` [PATCH 01/15] x86, apic: Don't write io_apic ID if it is not changed Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 9:47 ` Thomas Gleixner
2010-10-24 1:02 ` [PATCH 03/15] x86, apic: Merge two register_lapic_address() Yinghai Lu
` (12 subsequent siblings)
14 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
Do need to set lapic mapping for them
in arch/x86/kernel/visws_quirks.c:
we only have visws_find_smp_config() to set mp_lapic_addr to APIC_DEFAULT_PHYS_BASE
visws_get_smp_config() is nop call.
default_get_smp_config/check_physptr/smp_read_mpc is not called in the path.
So smp_register_lapic_address() is not called, and lapic is not mapped.
in arch/x86/kernel/mpparse.c
if mpf->feature1 != 0, it will go through contruct_default_ISA_mptable instead
of check_phystr path, so smp_register_lapic_address is not called.
Those pathes all have smp_found_config set.
So need to remove !smp_found_config checking
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/apic/apic.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 4638396..193e407 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1677,7 +1677,7 @@ void __init init_apic_mappings(void)
* acpi lapic path already maps that address in
* acpi_register_lapic_address()
*/
- if (!acpi_lapic && !smp_found_config)
+ if (!acpi_lapic)
set_fixmap_nocache(FIX_APIC_BASE, apic_phys);
apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n",
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 02/15] x86, apic: Fix lapic mapping with construct ISA and visws mptable path
2010-10-24 1:02 ` [PATCH 02/15] x86, apic: Fix lapic mapping with construct ISA and visws mptable path Yinghai Lu
@ 2010-10-24 9:47 ` Thomas Gleixner
0 siblings, 0 replies; 32+ messages in thread
From: Thomas Gleixner @ 2010-10-24 9:47 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, H. Peter Anvin, Andrew Morton, Len Brown,
linux-kernel
On Sat, 23 Oct 2010, Yinghai Lu wrote:
> Do need to set lapic mapping for them
>
> in arch/x86/kernel/visws_quirks.c:
> we only have visws_find_smp_config() to set mp_lapic_addr to APIC_DEFAULT_PHYS_BASE
> visws_get_smp_config() is nop call.
> default_get_smp_config/check_physptr/smp_read_mpc is not called in the path.
> So smp_register_lapic_address() is not called, and lapic is not mapped.
-ENOPARSE. visws maps the APIC itself already in cobalt_init()
> in arch/x86/kernel/mpparse.c
> if mpf->feature1 != 0, it will go through contruct_default_ISA_mptable instead
> of check_phystr path, so smp_register_lapic_address is not called.
>
> Those pathes all have smp_found_config set.
>
> So need to remove !smp_found_config checking
Need ? You can, because the check is redundant if I understand the
above correctly.
Thanks,
tglx
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
> arch/x86/kernel/apic/apic.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
> index 4638396..193e407 100644
> --- a/arch/x86/kernel/apic/apic.c
> +++ b/arch/x86/kernel/apic/apic.c
> @@ -1677,7 +1677,7 @@ void __init init_apic_mappings(void)
> * acpi lapic path already maps that address in
> * acpi_register_lapic_address()
> */
> - if (!acpi_lapic && !smp_found_config)
> + if (!acpi_lapic)
> set_fixmap_nocache(FIX_APIC_BASE, apic_phys);
>
> apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n",
> --
> 1.7.1
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 03/15] x86, apic: Merge two register_lapic_address()
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
2010-10-24 1:02 ` [PATCH 01/15] x86, apic: Don't write io_apic ID if it is not changed Yinghai Lu
2010-10-24 1:02 ` [PATCH 02/15] x86, apic: Fix lapic mapping with construct ISA and visws mptable path Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 9:49 ` Thomas Gleixner
2010-10-24 1:02 ` [PATCH 04/15] x86, apic: Remove early_init_lapic_mapping Yinghai Lu
` (11 subsequent siblings)
14 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
They are the same, move it to apic.c
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/include/asm/apic.h | 1 +
arch/x86/kernel/acpi/boot.c | 16 ++--------------
arch/x86/kernel/apic/apic.c | 12 ++++++++++++
arch/x86/kernel/mpparse.c | 12 ------------
4 files changed, 15 insertions(+), 26 deletions(-)
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index ad50aaa..dcc5f48 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -234,6 +234,7 @@ extern void init_bsp_APIC(void);
extern void setup_local_APIC(void);
extern void end_local_APIC_setup(void);
extern void init_apic_mappings(void);
+void smp_register_lapic_address(unsigned long address);
extern void setup_boot_APIC_clock(void);
extern void setup_secondary_APIC_clock(void);
extern int APIC_init_uniprocessor(void);
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index c05872a..f9f1bc5 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -820,18 +820,6 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
* returns 0 on success, < 0 on error
*/
-static void __init acpi_register_lapic_address(unsigned long address)
-{
- mp_lapic_addr = address;
-
- set_fixmap_nocache(FIX_APIC_BASE, address);
- if (boot_cpu_physical_apicid == -1U) {
- boot_cpu_physical_apicid = read_apic_id();
- apic_version[boot_cpu_physical_apicid] =
- GET_APIC_VERSION(apic_read(APIC_LVR));
- }
-}
-
static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
{
int count;
@@ -853,7 +841,7 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
return count;
}
- acpi_register_lapic_address(acpi_lapic_addr);
+ smp_register_lapic_address(acpi_lapic_addr);
return count;
}
@@ -880,7 +868,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
return count;
}
- acpi_register_lapic_address(acpi_lapic_addr);
+ smp_register_lapic_address(acpi_lapic_addr);
count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC,
acpi_parse_sapic, MAX_APICS);
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 193e407..4827c17 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1703,6 +1703,18 @@ void __init init_apic_mappings(void)
}
}
+void __init smp_register_lapic_address(unsigned long address)
+{
+ mp_lapic_addr = address;
+
+ set_fixmap_nocache(FIX_APIC_BASE, address);
+ if (boot_cpu_physical_apicid == -1U) {
+ boot_cpu_physical_apicid = read_apic_id();
+ apic_version[boot_cpu_physical_apicid] =
+ GET_APIC_VERSION(apic_read(APIC_LVR));
+ }
+}
+
/*
* This initializes the IO-APIC and APIC hardware if this is
* a UP kernel.
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 9af64d9..1fefb7f 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -275,18 +275,6 @@ static void __init smp_dump_mptable(struct mpc_table *mpc, unsigned char *mpt)
void __init default_smp_read_mpc_oem(struct mpc_table *mpc) { }
-static void __init smp_register_lapic_address(unsigned long address)
-{
- mp_lapic_addr = address;
-
- set_fixmap_nocache(FIX_APIC_BASE, address);
- if (boot_cpu_physical_apicid == -1U) {
- boot_cpu_physical_apicid = read_apic_id();
- apic_version[boot_cpu_physical_apicid] =
- GET_APIC_VERSION(apic_read(APIC_LVR));
- }
-}
-
static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
{
char str[16];
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 03/15] x86, apic: Merge two register_lapic_address()
2010-10-24 1:02 ` [PATCH 03/15] x86, apic: Merge two register_lapic_address() Yinghai Lu
@ 2010-10-24 9:49 ` Thomas Gleixner
0 siblings, 0 replies; 32+ messages in thread
From: Thomas Gleixner @ 2010-10-24 9:49 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, H. Peter Anvin, Andrew Morton, Len Brown,
linux-kernel
On Sat, 23 Oct 2010, Yinghai Lu wrote:
> They are the same, move it to apic.c
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
> arch/x86/include/asm/apic.h | 1 +
> arch/x86/kernel/acpi/boot.c | 16 ++--------------
> arch/x86/kernel/apic/apic.c | 12 ++++++++++++
> arch/x86/kernel/mpparse.c | 12 ------------
> 4 files changed, 15 insertions(+), 26 deletions(-)
>
> diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
> index ad50aaa..dcc5f48 100644
> --- a/arch/x86/include/asm/apic.h
> +++ b/arch/x86/include/asm/apic.h
> @@ -234,6 +234,7 @@ extern void init_bsp_APIC(void);
> extern void setup_local_APIC(void);
> extern void end_local_APIC_setup(void);
> extern void init_apic_mappings(void);
> +void smp_register_lapic_address(unsigned long address);
And why must this be restricted to smp ?
Thanks,
tglx
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 04/15] x86, apic: Remove early_init_lapic_mapping
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
` (2 preceding siblings ...)
2010-10-24 1:02 ` [PATCH 03/15] x86, apic: Merge two register_lapic_address() Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 9:53 ` Thomas Gleixner
2010-10-24 1:02 ` [PATCH 05/15] x86: Call smp_register_lapic_address for contruct_default mptable path Yinghai Lu
` (10 subsequent siblings)
14 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
It is almost the same as smp_register_lapic_addr()
Just need to make smp_read_mpc() call smp_register_lapic_addr when early==1.
also add printing out in smp_register_lapic_address()
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/include/asm/apic.h | 1 -
arch/x86/kernel/apic/apic.c | 24 ++----------------------
arch/x86/kernel/mpparse.c | 8 ++------
arch/x86/mm/k8topology_64.c | 1 -
4 files changed, 4 insertions(+), 30 deletions(-)
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index dcc5f48..69879dd 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -245,7 +245,6 @@ extern int apic_force_enable(void);
* On 32bit this is mach-xxx local
*/
#ifdef CONFIG_X86_64
-extern void early_init_lapic_mapping(void);
extern int apic_is_clustered_box(void);
#else
static inline int apic_is_clustered_box(void)
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 4827c17..05b8bf7 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1631,28 +1631,6 @@ no_apic:
}
#endif
-#ifdef CONFIG_X86_64
-void __init early_init_lapic_mapping(void)
-{
- /*
- * If no local APIC can be found then go out
- * : it means there is no mpatable and MADT
- */
- if (!smp_found_config)
- return;
-
- set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
- apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n",
- APIC_BASE, mp_lapic_addr);
-
- /*
- * Fetch the APIC ID of the BSP in case we have a
- * default configuration (or the MP table is broken).
- */
- boot_cpu_physical_apicid = read_apic_id();
-}
-#endif
-
/**
* init_apic_mappings - initialize APIC mappings
*/
@@ -1708,6 +1686,8 @@ void __init smp_register_lapic_address(unsigned long address)
mp_lapic_addr = address;
set_fixmap_nocache(FIX_APIC_BASE, address);
+ apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n",
+ APIC_BASE, mp_lapic_addr);
if (boot_cpu_physical_apicid == -1U) {
boot_cpu_physical_apicid = read_apic_id();
apic_version[boot_cpu_physical_apicid] =
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 1fefb7f..a550315 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -289,17 +289,13 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
#ifdef CONFIG_X86_32
generic_mps_oem_check(mpc, oem, str);
#endif
- /* save the local APIC address, it might be non-default */
+ /* Initialize the lapic mapping */
if (!acpi_lapic)
- mp_lapic_addr = mpc->lapic;
+ smp_register_lapic_address(mpc->lapic);
if (early)
return 1;
- /* Initialize the lapic mapping */
- if (!acpi_lapic)
- smp_register_lapic_address(mpc->lapic);
-
if (mpc->oemptr)
x86_init.mpparse.smp_read_mpc_oem(mpc);
diff --git a/arch/x86/mm/k8topology_64.c b/arch/x86/mm/k8topology_64.c
index 804a3b6..446bae2 100644
--- a/arch/x86/mm/k8topology_64.c
+++ b/arch/x86/mm/k8topology_64.c
@@ -66,7 +66,6 @@ static __init void early_get_boot_cpu_id(void)
if (smp_found_config)
early_get_smp_config();
#endif
- early_init_lapic_mapping();
}
int __init k8_get_nodes(struct bootnode *physnodes)
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 04/15] x86, apic: Remove early_init_lapic_mapping
2010-10-24 1:02 ` [PATCH 04/15] x86, apic: Remove early_init_lapic_mapping Yinghai Lu
@ 2010-10-24 9:53 ` Thomas Gleixner
0 siblings, 0 replies; 32+ messages in thread
From: Thomas Gleixner @ 2010-10-24 9:53 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, H. Peter Anvin, Andrew Morton, Len Brown,
linux-kernel
On Sat, 23 Oct 2010, Yinghai Lu wrote:
> It is almost the same as smp_register_lapic_addr()
>
> Just need to make smp_read_mpc() call smp_register_lapic_addr when early==1.
> @@ -289,17 +289,13 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
> #ifdef CONFIG_X86_32
> generic_mps_oem_check(mpc, oem, str);
> #endif
> - /* save the local APIC address, it might be non-default */
> + /* Initialize the lapic mapping */
> if (!acpi_lapic)
> - mp_lapic_addr = mpc->lapic;
> + smp_register_lapic_address(mpc->lapic);
How is this restricted to early == 1 ? It's called unconditionally
which is nonsense.
Thanks,
tglx
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 05/15] x86: Call smp_register_lapic_address for contruct_default mptable path
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
` (3 preceding siblings ...)
2010-10-24 1:02 ` [PATCH 04/15] x86, apic: Remove early_init_lapic_mapping Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 1:02 ` [PATCH 06/15] x86, apic: Use smp_register_lapic_address in init_apic_mapping Yinghai Lu
` (9 subsequent siblings)
14 siblings, 0 replies; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
It already finds smp config, make it like other find_smp_config path
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/mpparse.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index a550315..7b72904 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -481,7 +481,7 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
/*
* local APIC has default address
*/
- mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
+ smp_register_lapic_address(APIC_DEFAULT_PHYS_BASE);
/*
* 2 CPUs, numbered 0 & 1.
@@ -617,7 +617,7 @@ void __init default_get_smp_config(unsigned int early)
/*
* local APIC has default address
*/
- mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
+ smp_register_lapic_address(APIC_DEFAULT_PHYS_BASE);
return;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH 06/15] x86, apic: Use smp_register_lapic_address in init_apic_mapping
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
` (4 preceding siblings ...)
2010-10-24 1:02 ` [PATCH 05/15] x86: Call smp_register_lapic_address for contruct_default mptable path Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 1:02 ` [PATCH 07/15] x86, sfi: Use smp_register_lapic_address() Yinghai Lu
` (8 subsequent siblings)
14 siblings, 0 replies; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
So if set_fixmap_nocache is not called, don't print out anything
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/apic/apic.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 05b8bf7..a5ce130 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1656,10 +1656,7 @@ void __init init_apic_mappings(void)
* acpi_register_lapic_address()
*/
if (!acpi_lapic)
- set_fixmap_nocache(FIX_APIC_BASE, apic_phys);
-
- apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n",
- APIC_BASE, apic_phys);
+ smp_register_lapic_address(apic_phys);
}
/*
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH 07/15] x86, sfi: Use smp_register_lapic_address()
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
` (5 preceding siblings ...)
2010-10-24 1:02 ` [PATCH 06/15] x86, apic: Use smp_register_lapic_address in init_apic_mapping Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 9:56 ` Thomas Gleixner
2010-10-24 1:02 ` [PATCH 08/15] x86, visws: Set_fixmap in find_smp_config Yinghai Lu
` (7 subsequent siblings)
14 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
kill mp_sfi_register_lapic_address, they are the same
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/sfi.c | 13 +------------
1 files changed, 1 insertions(+), 12 deletions(-)
diff --git a/arch/x86/kernel/sfi.c b/arch/x86/kernel/sfi.c
index dd4c281..4dc8065 100644
--- a/arch/x86/kernel/sfi.c
+++ b/arch/x86/kernel/sfi.c
@@ -34,17 +34,6 @@
#ifdef CONFIG_X86_LOCAL_APIC
static unsigned long sfi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
-static void __init mp_sfi_register_lapic_address(unsigned long address)
-{
- mp_lapic_addr = address;
-
- set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
- if (boot_cpu_physical_apicid == -1U)
- boot_cpu_physical_apicid = read_apic_id();
-
- pr_info("Boot CPU = %d\n", boot_cpu_physical_apicid);
-}
-
/* All CPUs enumerated by SFI must be present and enabled */
static void __cpuinit mp_sfi_register_lapic(u8 id)
{
@@ -110,7 +99,7 @@ static int __init sfi_parse_ioapic(struct sfi_table_header *table)
int __init sfi_platform_init(void)
{
#ifdef CONFIG_X86_LOCAL_APIC
- mp_sfi_register_lapic_address(sfi_lapic_addr);
+ smp_register_lapic_address(sfi_lapic_addr);
sfi_table_parse(SFI_SIG_CPUS, NULL, NULL, sfi_parse_cpus);
#endif
#ifdef CONFIG_X86_IO_APIC
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 07/15] x86, sfi: Use smp_register_lapic_address()
2010-10-24 1:02 ` [PATCH 07/15] x86, sfi: Use smp_register_lapic_address() Yinghai Lu
@ 2010-10-24 9:56 ` Thomas Gleixner
0 siblings, 0 replies; 32+ messages in thread
From: Thomas Gleixner @ 2010-10-24 9:56 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, H. Peter Anvin, Andrew Morton, Len Brown,
linux-kernel
On Sat, 23 Oct 2010, Yinghai Lu wrote:
> kill mp_sfi_register_lapic_address, they are the same
Except for the difference.
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
> arch/x86/kernel/sfi.c | 13 +------------
> 1 files changed, 1 insertions(+), 12 deletions(-)
>
> diff --git a/arch/x86/kernel/sfi.c b/arch/x86/kernel/sfi.c
> index dd4c281..4dc8065 100644
> --- a/arch/x86/kernel/sfi.c
> +++ b/arch/x86/kernel/sfi.c
> @@ -34,17 +34,6 @@
> #ifdef CONFIG_X86_LOCAL_APIC
> static unsigned long sfi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
>
> -static void __init mp_sfi_register_lapic_address(unsigned long address)
> -{
> - mp_lapic_addr = address;
> -
> - set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
> - if (boot_cpu_physical_apicid == -1U)
> - boot_cpu_physical_apicid = read_apic_id();
> -
> - pr_info("Boot CPU = %d\n", boot_cpu_physical_apicid);
That pr_info is not really important, but it makes the function
different in the first place.
> -}
> -
> /* All CPUs enumerated by SFI must be present and enabled */
> static void __cpuinit mp_sfi_register_lapic(u8 id)
> {
> @@ -110,7 +99,7 @@ static int __init sfi_parse_ioapic(struct sfi_table_header *table)
> int __init sfi_platform_init(void)
> {
> #ifdef CONFIG_X86_LOCAL_APIC
> - mp_sfi_register_lapic_address(sfi_lapic_addr);
> + smp_register_lapic_address(sfi_lapic_addr);
> sfi_table_parse(SFI_SIG_CPUS, NULL, NULL, sfi_parse_cpus);
> #endif
> #ifdef CONFIG_X86_IO_APIC
> --
> 1.7.1
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 08/15] x86, visws: Set_fixmap in find_smp_config
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
` (6 preceding siblings ...)
2010-10-24 1:02 ` [PATCH 07/15] x86, sfi: Use smp_register_lapic_address() Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 9:58 ` Thomas Gleixner
2010-10-24 1:02 ` [PATCH 09/15] x86: on !find_smp_config path use smp_register_lapic_address Yinghai Lu
` (6 subsequent siblings)
14 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/visws_quirks.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c
index 3371bd0..a70bc71 100644
--- a/arch/x86/kernel/visws_quirks.c
+++ b/arch/x86/kernel/visws_quirks.c
@@ -211,6 +211,7 @@ static void __init visws_find_smp_config(void)
MP_processor_info(mp++);
mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
+ set_fixmap(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE);
}
static void visws_trap_init(void);
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 08/15] x86, visws: Set_fixmap in find_smp_config
2010-10-24 1:02 ` [PATCH 08/15] x86, visws: Set_fixmap in find_smp_config Yinghai Lu
@ 2010-10-24 9:58 ` Thomas Gleixner
0 siblings, 0 replies; 32+ messages in thread
From: Thomas Gleixner @ 2010-10-24 9:58 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, H. Peter Anvin, Andrew Morton, Len Brown,
linux-kernel
On Sat, 23 Oct 2010, Yinghai Lu wrote:
-ENOREASON.
Also visws does it set already in cobalt_init(). So this is redundant
crap.
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
> arch/x86/kernel/visws_quirks.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c
> index 3371bd0..a70bc71 100644
> --- a/arch/x86/kernel/visws_quirks.c
> +++ b/arch/x86/kernel/visws_quirks.c
> @@ -211,6 +211,7 @@ static void __init visws_find_smp_config(void)
> MP_processor_info(mp++);
>
> mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
> + set_fixmap(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE);
> }
>
> static void visws_trap_init(void);
> --
> 1.7.1
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 09/15] x86: on !find_smp_config path use smp_register_lapic_address
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
` (7 preceding siblings ...)
2010-10-24 1:02 ` [PATCH 08/15] x86, visws: Set_fixmap in find_smp_config Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 10:01 ` Thomas Gleixner
2010-10-24 1:02 ` [PATCH 10/15] x86, apic: Set fixmap only one time Yinghai Lu
` (5 subsequent siblings)
14 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
So fixmap will be setup there.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/apic/apic.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index a5ce130..3a4e770 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1527,7 +1527,7 @@ static int __init detect_init_APIC(void)
return -1;
}
- mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
+ smp_register_lapic_address(APIC_DEFAULT_PHYS_BASE);
return 0;
}
#else
@@ -1535,6 +1535,7 @@ static int __init detect_init_APIC(void)
static int apic_verify(void)
{
u32 features, h, l;
+ unsigned long lapic_addr;
/*
* The APIC feature bit should now be enabled
@@ -1546,13 +1547,14 @@ static int apic_verify(void)
return -1;
}
set_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
- mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
+ lapic_addr = APIC_DEFAULT_PHYS_BASE;
/* The BIOS may have set up the APIC at some other address */
rdmsr(MSR_IA32_APICBASE, l, h);
if (l & MSR_IA32_APICBASE_ENABLE)
- mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
+ lapic_addr = l & MSR_IA32_APICBASE_BASE;
+ smp_register_lapic_address(lapic_addr);
pr_info("Found and enabled local APIC!\n");
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 09/15] x86: on !find_smp_config path use smp_register_lapic_address
2010-10-24 1:02 ` [PATCH 09/15] x86: on !find_smp_config path use smp_register_lapic_address Yinghai Lu
@ 2010-10-24 10:01 ` Thomas Gleixner
0 siblings, 0 replies; 32+ messages in thread
From: Thomas Gleixner @ 2010-10-24 10:01 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Ingo Molnar, H. Peter Anvin, Andrew Morton, Len Brown, LKML
On Sat, 23 Oct 2010, Yinghai Lu wrote:
> So fixmap will be setup there.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
> arch/x86/kernel/apic/apic.c | 8 +++++---
> 1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
> index a5ce130..3a4e770 100644
> --- a/arch/x86/kernel/apic/apic.c
> +++ b/arch/x86/kernel/apic/apic.c
> @@ -1527,7 +1527,7 @@ static int __init detect_init_APIC(void)
> return -1;
> }
>
> - mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
> + smp_register_lapic_address(APIC_DEFAULT_PHYS_BASE);
> return 0;
> }
> #else
> @@ -1535,6 +1535,7 @@ static int __init detect_init_APIC(void)
> static int apic_verify(void)
> {
> u32 features, h, l;
> + unsigned long lapic_addr;
Swap lines as we do anywhere else.
> /*
> * The APIC feature bit should now be enabled
> @@ -1546,13 +1547,14 @@ static int apic_verify(void)
> return -1;
> }
> set_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
> - mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
> + lapic_addr = APIC_DEFAULT_PHYS_BASE;
>
> /* The BIOS may have set up the APIC at some other address */
> rdmsr(MSR_IA32_APICBASE, l, h);
> if (l & MSR_IA32_APICBASE_ENABLE)
> - mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
> + lapic_addr = l & MSR_IA32_APICBASE_BASE;
>
> + smp_register_lapic_address(lapic_addr);
> pr_info("Found and enabled local APIC!\n");
> return 0;
> }
> --
> 1.7.1
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 10/15] x86, apic: Set fixmap only one time
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
` (8 preceding siblings ...)
2010-10-24 1:02 ` [PATCH 09/15] x86: on !find_smp_config path use smp_register_lapic_address Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 10:03 ` Thomas Gleixner
2010-10-24 1:02 ` [PATCH 11/15] x86, ioapic: Only print mapping for ioapic in right place Yinghai Lu
` (4 subsequent siblings)
14 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
Check if mp_lapic_addr is assigned or not.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/apic/apic.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 3a4e770..2cfa622 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1682,6 +1682,9 @@ void __init init_apic_mappings(void)
void __init smp_register_lapic_address(unsigned long address)
{
+ if (mp_lapic_addr)
+ return;
+
mp_lapic_addr = address;
set_fixmap_nocache(FIX_APIC_BASE, address);
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 10/15] x86, apic: Set fixmap only one time
2010-10-24 1:02 ` [PATCH 10/15] x86, apic: Set fixmap only one time Yinghai Lu
@ 2010-10-24 10:03 ` Thomas Gleixner
0 siblings, 0 replies; 32+ messages in thread
From: Thomas Gleixner @ 2010-10-24 10:03 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, H. Peter Anvin, Andrew Morton, Len Brown,
linux-kernel
On Sat, 23 Oct 2010, Yinghai Lu wrote:
> Check if mp_lapic_addr is assigned or not.
Why is it called twice in the first place ? Because you messed up that
other patch ?
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
> arch/x86/kernel/apic/apic.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
> index 3a4e770..2cfa622 100644
> --- a/arch/x86/kernel/apic/apic.c
> +++ b/arch/x86/kernel/apic/apic.c
> @@ -1682,6 +1682,9 @@ void __init init_apic_mappings(void)
>
> void __init smp_register_lapic_address(unsigned long address)
> {
> + if (mp_lapic_addr)
> + return;
> +
> mp_lapic_addr = address;
>
> set_fixmap_nocache(FIX_APIC_BASE, address);
> --
> 1.7.1
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 11/15] x86, ioapic: Only print mapping for ioapic in right place
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
` (9 preceding siblings ...)
2010-10-24 1:02 ` [PATCH 10/15] x86, apic: Set fixmap only one time Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-25 16:55 ` [PATCH] x86, ioapic: Add debug printing when mapping for ioapic Yinghai Lu
2010-10-24 1:02 ` [PATCH 12/15] x86, x2apic: Don't map lapic addr for preenabled x2apic Yinghai Lu
` (3 subsequent siblings)
14 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
When mapping does happen.
And only map ioapic address one time when mp_register_ioapic() is called.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/apic/io_apic.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 0579b3b..1853494 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3980,11 +3980,11 @@ fake_ioapic_page:
#endif
ioapic_phys = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
ioapic_phys = __pa(ioapic_phys);
+ set_fixmap_nocache(idx, ioapic_phys);
+ apic_printk(APIC_VERBOSE, "mapped IOAPIC to %08lx (%08lx)\n",
+ __fix_to_virt(idx) + (ioapic_phys & ~PAGE_MASK),
+ ioapic_phys);
}
- set_fixmap_nocache(idx, ioapic_phys);
- apic_printk(APIC_VERBOSE, "mapped IOAPIC to %08lx (%08lx)\n",
- __fix_to_virt(idx) + (ioapic_phys & ~PAGE_MASK),
- ioapic_phys);
idx++;
ioapic_res->start = ioapic_phys;
@@ -4068,6 +4068,9 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
mp_ioapics[idx].apicaddr = address;
set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
+ apic_printk(APIC_VERBOSE, "mapped IOAPIC to %08lx (%08x)\n",
+ __fix_to_virt(FIX_IO_APIC_BASE_0 + idx) + (address & ~PAGE_MASK),
+ address);
mp_ioapics[idx].apicid = io_apic_unique_id(id);
mp_ioapics[idx].apicver = io_apic_get_version(idx);
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH] x86, ioapic: Add debug printing when mapping for ioapic
2010-10-24 1:02 ` [PATCH 11/15] x86, ioapic: Only print mapping for ioapic in right place Yinghai Lu
@ 2010-10-25 16:55 ` Yinghai Lu
2010-10-25 16:59 ` [PATCH] x86, ioapic: Don't map ioapic regs two times Yinghai Lu
0 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-25 16:55 UTC (permalink / raw)
To: Thomas Gleixner, H. Peter Anvin; +Cc: Ingo Molnar, linux-kernel
It is in mp_register_ioapic().
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/apic/io_apic.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
Index: linux-2.6/arch/x86/kernel/apic/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6/arch/x86/kernel/apic/io_apic.c
@@ -4068,6 +4068,9 @@ void __init mp_register_ioapic(int id, u
mp_ioapics[idx].apicaddr = address;
set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
+ apic_printk(APIC_VERBOSE, "mapped IOAPIC to %08lx (%08x)\n",
+ __fix_to_virt(FIX_IO_APIC_BASE_0 + idx) + (address & ~PAGE_MASK),
+ address);
mp_ioapics[idx].apicid = io_apic_unique_id(id);
mp_ioapics[idx].apicver = io_apic_get_version(idx);
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH] x86, ioapic: Don't map ioapic regs two times
2010-10-25 16:55 ` [PATCH] x86, ioapic: Add debug printing when mapping for ioapic Yinghai Lu
@ 2010-10-25 16:59 ` Yinghai Lu
0 siblings, 0 replies; 32+ messages in thread
From: Yinghai Lu @ 2010-10-25 16:59 UTC (permalink / raw)
To: Thomas Gleixner, H. Peter Anvin; +Cc: Ingo Molnar, linux-kernel
Normal path: When mptable or madt is used, and ioapic address is correct,
We already set mapping in mp_register_ioapic().
So only set_fixmap for dummy case.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/apic/io_apic.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: linux-2.6/arch/x86/kernel/apic/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6/arch/x86/kernel/apic/io_apic.c
@@ -3980,11 +3980,11 @@ fake_ioapic_page:
#endif
ioapic_phys = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
ioapic_phys = __pa(ioapic_phys);
+ set_fixmap_nocache(idx, ioapic_phys);
+ apic_printk(APIC_VERBOSE, "mapped dummy IOAPIC to %08lx (%08lx)\n",
+ __fix_to_virt(idx) + (ioapic_phys & ~PAGE_MASK),
+ ioapic_phys);
}
- set_fixmap_nocache(idx, ioapic_phys);
- apic_printk(APIC_VERBOSE, "mapped IOAPIC to %08lx (%08lx)\n",
- __fix_to_virt(idx) + (ioapic_phys & ~PAGE_MASK),
- ioapic_phys);
idx++;
ioapic_res->start = ioapic_phys;
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 12/15] x86, x2apic: Don't map lapic addr for preenabled x2apic
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
` (10 preceding siblings ...)
2010-10-24 1:02 ` [PATCH 11/15] x86, ioapic: Only print mapping for ioapic in right place Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 1:02 ` [PATCH 13/15] x86, apic, acpi: Handle xapic/x2apic entries in MADT at same time Yinghai Lu
` (2 subsequent siblings)
14 siblings, 0 replies; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
If x2apic is reenabled, and used in kernel, We don't need to map that lapic
address. That mapping will never be used.
So just skip that in smp_register_lapic_address()
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/apic/apic.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 2cfa622..d286db1 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1687,9 +1687,11 @@ void __init smp_register_lapic_address(unsigned long address)
mp_lapic_addr = address;
- set_fixmap_nocache(FIX_APIC_BASE, address);
- apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n",
- APIC_BASE, mp_lapic_addr);
+ if (!x2apic_mode) {
+ set_fixmap_nocache(FIX_APIC_BASE, address);
+ apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n",
+ APIC_BASE, mp_lapic_addr);
+ }
if (boot_cpu_physical_apicid == -1U) {
boot_cpu_physical_apicid = read_apic_id();
apic_version[boot_cpu_physical_apicid] =
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH 13/15] x86, apic, acpi: Handle xapic/x2apic entries in MADT at same time
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
` (11 preceding siblings ...)
2010-10-24 1:02 ` [PATCH 12/15] x86, x2apic: Don't map lapic addr for preenabled x2apic Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 9:44 ` Thomas Gleixner
2010-10-24 1:02 ` [PATCH 14/15] acpi: Reverse uid and apic_id print out for x2apic Yinghai Lu
2010-10-24 1:02 ` [PATCH 15/15] x86: Disabling x2apic if nox2apic is specified Yinghai Lu
14 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
One system have mixing xapic and x2apic entries in MADT and SRAT.
Need to handle every entry in MADT at same time with xapic and x2apic.
so we can honor sequence in MADT.
We can use max_cpus= command line to use thread0 in every core,
because recent MADT always have all thread0 at first.
Also it could make the cpu to node mapping more sane.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/acpi/boot.c | 35 ++++++++++++++++++++-------
drivers/acpi/numa.c | 18 ++++++++++---
drivers/acpi/tables.c | 56 +++++++++++++++++++++++++++++++-----------
include/linux/acpi.h | 8 ++++++
4 files changed, 89 insertions(+), 28 deletions(-)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index f9f1bc5..8e13ec8 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -850,6 +850,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
{
int count;
int x2count = 0;
+ struct acpi_subtable_proc madt_proc;
if (!cpu_has_apic)
return -ENODEV;
@@ -874,10 +875,19 @@ static int __init acpi_parse_madt_lapic_entries(void)
acpi_parse_sapic, MAX_APICS);
if (!count) {
- x2count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC,
- acpi_parse_x2apic, MAX_APICS);
- count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC,
- acpi_parse_lapic, MAX_APICS);
+
+ memset(&madt_proc, 0, sizeof(madt_proc));
+ madt_proc.id[0] = ACPI_MADT_TYPE_LOCAL_APIC;
+ madt_proc.handler[0] = acpi_parse_lapic;
+ madt_proc.num++;
+ madt_proc.id[1] = ACPI_MADT_TYPE_LOCAL_X2APIC;
+ madt_proc.handler[1] = acpi_parse_x2apic;
+ madt_proc.num++;
+ acpi_table_parse_entries_x(ACPI_SIG_MADT,
+ sizeof(struct acpi_table_madt),
+ &madt_proc, MAX_APICS);
+ count = madt_proc.count[0];
+ x2count = madt_proc.count[1];
}
if (!count && !x2count) {
printk(KERN_ERR PREFIX "No LAPIC entries present\n");
@@ -889,11 +899,18 @@ static int __init acpi_parse_madt_lapic_entries(void)
return count;
}
- x2count =
- acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC_NMI,
- acpi_parse_x2apic_nmi, 0);
- count =
- acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0);
+ memset(&madt_proc, 0, sizeof(madt_proc));
+ madt_proc.id[0] = ACPI_MADT_TYPE_LOCAL_APIC_NMI;
+ madt_proc.handler[0] = acpi_parse_lapic_nmi;
+ madt_proc.num++;
+ madt_proc.id[1] = ACPI_MADT_TYPE_LOCAL_X2APIC_NMI;
+ madt_proc.handler[1] = acpi_parse_x2apic_nmi;
+ madt_proc.num++;
+ acpi_table_parse_entries_x(ACPI_SIG_MADT,
+ sizeof(struct acpi_table_madt),
+ &madt_proc, MAX_APICS);
+ count = madt_proc.count[0];
+ x2count = madt_proc.count[1];
if (count < 0 || x2count < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
/* TBD: Cleanup to allow fallback to MPS */
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 5718566..0891071 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -278,10 +278,20 @@ int __init acpi_numa_init(void)
/* SRAT: Static Resource Affinity Table */
if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
- acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY,
- acpi_parse_x2apic_affinity, nr_cpu_ids);
- acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
- acpi_parse_processor_affinity, nr_cpu_ids);
+ struct acpi_subtable_proc srat_proc;
+
+ memset(&srat_proc, 0, sizeof(srat_proc));
+ srat_proc.id[0] = ACPI_SRAT_TYPE_CPU_AFFINITY;
+ srat_proc.handler[0] = acpi_parse_processor_affinity;
+ srat_proc.num++;
+ srat_proc.id[1] = ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY;
+ srat_proc.handler[1] = acpi_parse_x2apic_affinity;
+ srat_proc.num++;
+
+ acpi_table_parse_entries_x(ACPI_SIG_SRAT,
+ sizeof(struct acpi_table_srat),
+ &srat_proc, nr_cpu_ids);
+
ret = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
acpi_parse_memory_affinity,
NR_NODE_MEMBLKS);
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index f336bca..3e4a60e 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -201,10 +201,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
int __init
-acpi_table_parse_entries(char *id,
+acpi_table_parse_entries_x(char *id,
unsigned long table_size,
- int entry_id,
- acpi_table_entry_handler handler,
+ struct acpi_subtable_proc *proc,
unsigned int max_entries)
{
struct acpi_table_header *table_header = NULL;
@@ -212,12 +211,12 @@ acpi_table_parse_entries(char *id,
unsigned int count = 0;
unsigned long table_end;
acpi_size tbl_size;
+ int i;
- if (acpi_disabled)
+ if (acpi_disabled) {
+ proc->count[0] = -ENODEV;
return -ENODEV;
-
- if (!handler)
- return -EINVAL;
+ }
if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
acpi_get_table_with_size(id, acpi_apic_instance, &table_header, &tbl_size);
@@ -226,6 +225,7 @@ acpi_table_parse_entries(char *id,
if (!table_header) {
printk(KERN_WARNING PREFIX "%4.4s not present\n", id);
+ proc->count[0] = -ENODEV;
return -ENODEV;
}
@@ -238,19 +238,25 @@ acpi_table_parse_entries(char *id,
while (((unsigned long)entry) + sizeof(struct acpi_subtable_header) <
table_end) {
- if (entry->type == entry_id
- && (!max_entries || count++ < max_entries))
- if (handler(entry, table_end)) {
- early_acpi_os_unmap_memory((char *)table_header, tbl_size);
- return -EINVAL;
- }
+ for (i = 0; i < proc->num; i++) {
+ if (entry->type != proc->id[i])
+ continue;
+ if (!max_entries || count++ < max_entries)
+ if (proc->handler[i](entry, table_end)) {
+ early_acpi_os_unmap_memory((char *)table_header, tbl_size);
+ proc->count[i] = -EINVAL;
+ return -EINVAL;
+ }
+ proc->count[i]++;
+ break;
+ }
entry = (struct acpi_subtable_header *)
((unsigned long)entry + entry->length);
}
if (max_entries && count > max_entries) {
- printk(KERN_WARNING PREFIX "[%4.4s:0x%02x] ignored %i entries of "
- "%i found\n", id, entry_id, count - max_entries, count);
+ printk(KERN_WARNING PREFIX "[%4.4s:0x%02x 0x%02x] ignored %i entries of "
+ "%i found\n", id, proc->id[0], proc->id[1], count - max_entries, count);
}
early_acpi_os_unmap_memory((char *)table_header, tbl_size);
@@ -258,6 +264,26 @@ acpi_table_parse_entries(char *id,
}
int __init
+acpi_table_parse_entries(char *id,
+ unsigned long table_size,
+ int entry_id,
+ acpi_table_entry_handler handler,
+ unsigned int max_entries)
+{
+ struct acpi_subtable_proc proc;
+
+ if (!handler)
+ return -EINVAL;
+
+ memset(&proc, 0, sizeof(proc));
+ proc.id[0] = entry_id;
+ proc.handler[0] = handler;
+ proc.num++;
+
+ return acpi_table_parse_entries_x(id, table_size, &proc, max_entries);
+}
+
+int __init
acpi_table_parse_madt(enum acpi_madt_type id,
acpi_table_entry_handler handler, unsigned int max_entries)
{
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index c227757..9c7cf47 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -76,6 +76,13 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table);
typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
+struct acpi_subtable_proc {
+ int id[2];
+ acpi_table_entry_handler handler[2];
+ int count[2];
+ int num;
+};
+
char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
void __acpi_unmap_table(char *map, unsigned long size);
int early_acpi_boot_init(void);
@@ -86,6 +93,7 @@ int acpi_numa_init (void);
int acpi_table_init (void);
int acpi_table_parse (char *id, acpi_table_handler handler);
+int acpi_table_parse_entries_x(char *id, unsigned long table_size, struct acpi_subtable_proc *proc, unsigned int max_entries);
int __init acpi_table_parse_entries(char *id, unsigned long table_size,
int entry_id, acpi_table_entry_handler handler, unsigned int max_entries);
int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries);
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 13/15] x86, apic, acpi: Handle xapic/x2apic entries in MADT at same time
2010-10-24 1:02 ` [PATCH 13/15] x86, apic, acpi: Handle xapic/x2apic entries in MADT at same time Yinghai Lu
@ 2010-10-24 9:44 ` Thomas Gleixner
0 siblings, 0 replies; 32+ messages in thread
From: Thomas Gleixner @ 2010-10-24 9:44 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, H. Peter Anvin, Andrew Morton, Len Brown,
linux-kernel
On Sat, 23 Oct 2010, Yinghai Lu wrote:
> One system have mixing xapic and x2apic entries in MADT and SRAT.
>
> Need to handle every entry in MADT at same time with xapic and x2apic.
> so we can honor sequence in MADT.
>
> We can use max_cpus= command line to use thread0 in every core,
> because recent MADT always have all thread0 at first.
That's a completely bogus argument. Just because you have access to
MADTs which have that first, does not prove anything.
These damned tables are not what we expect often enough, so we have to
deal with it and not making stupid assumptions which will blow up in
no time.
> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
> index f9f1bc5..8e13ec8 100644
> --- a/arch/x86/kernel/acpi/boot.c
> +++ b/arch/x86/kernel/acpi/boot.c
> @@ -850,6 +850,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
> {
> int count;
> int x2count = 0;
> + struct acpi_subtable_proc madt_proc;
You titled this patch series cleanup. So what about doing
struct acpi_subtable_proc madt_proc;
int count, x2count = 0;
instead of blindly slapping your new stuff in ?
> if (!cpu_has_apic)
> return -ENODEV;
> @@ -874,10 +875,19 @@ static int __init acpi_parse_madt_lapic_entries(void)
> acpi_parse_sapic, MAX_APICS);
>
> if (!count) {
> - x2count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC,
> - acpi_parse_x2apic, MAX_APICS);
> - count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC,
> - acpi_parse_lapic, MAX_APICS);
> +
> + memset(&madt_proc, 0, sizeof(madt_proc));
> + madt_proc.id[0] = ACPI_MADT_TYPE_LOCAL_APIC;
> + madt_proc.handler[0] = acpi_parse_lapic;
> + madt_proc.num++;
> + madt_proc.id[1] = ACPI_MADT_TYPE_LOCAL_X2APIC;
> + madt_proc.handler[1] = acpi_parse_x2apic;
> + madt_proc.num++;
> + acpi_table_parse_entries_x(ACPI_SIG_MADT,
What the hell is acpi_table_parse_entries_x?
I tell you: Just slapping an _x at an existing function name is
sloppy, lazy and disgusting CRAP. Period.
I just removed a bunch of these complete misnomers and you have been
told to use sensible function names several times before.
Don't do that ever again, really. It's just a prove of complete and
wilful ignorance of reviewers comments.
> + sizeof(struct acpi_table_madt),
> + &madt_proc, MAX_APICS);
> + count = madt_proc.count[0];
> + x2count = madt_proc.count[1];
> }
> if (!count && !x2count) {
Does anything check here for count < 0 or x2count < 0 ?
> diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
> index 5718566..0891071 100644
> --- a/drivers/acpi/numa.c
> +++ b/drivers/acpi/numa.c
> @@ -278,10 +278,20 @@ int __init acpi_numa_init(void)
>
> /* SRAT: Static Resource Affinity Table */
> if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
> - acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY,
> - acpi_parse_x2apic_affinity, nr_cpu_ids);
> - acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
> - acpi_parse_processor_affinity, nr_cpu_ids);
> + struct acpi_subtable_proc srat_proc;
> +
> + memset(&srat_proc, 0, sizeof(srat_proc));
> + srat_proc.id[0] = ACPI_SRAT_TYPE_CPU_AFFINITY;
> + srat_proc.handler[0] = acpi_parse_processor_affinity;
> + srat_proc.num++;
> + srat_proc.id[1] = ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY;
> + srat_proc.handler[1] = acpi_parse_x2apic_affinity;
> + srat_proc.num++;
> +
> + acpi_table_parse_entries_x(ACPI_SIG_SRAT,
> + sizeof(struct acpi_table_srat),
> + &srat_proc, nr_cpu_ids);
What happens with the return value of this function ?
> +
> ret = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
> acpi_parse_memory_affinity,
> NR_NODE_MEMBLKS);
> diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
> index f336bca..3e4a60e 100644
> --- a/drivers/acpi/tables.c
> +++ b/drivers/acpi/tables.c
> @@ -201,10 +201,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
>
>
> int __init
> -acpi_table_parse_entries(char *id,
> +acpi_table_parse_entries_x(char *id,
> unsigned long table_size,
> - int entry_id,
> - acpi_table_entry_handler handler,
> + struct acpi_subtable_proc *proc,
> unsigned int max_entries)
> {
> struct acpi_table_header *table_header = NULL;
> @@ -212,12 +211,12 @@ acpi_table_parse_entries(char *id,
> unsigned int count = 0;
> unsigned long table_end;
> acpi_size tbl_size;
> + int i;
>
> - if (acpi_disabled)
> + if (acpi_disabled) {
> + proc->count[0] = -ENODEV;
Why isn't it sufficient to return -ENODEV and check the return value
of the function ?
> return -ENODEV;
> -
> - if (!handler)
> - return -EINVAL;
Wat makes sure that all subtable entries have a handler set ?
> + }
>
> if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
> acpi_get_table_with_size(id, acpi_apic_instance, &table_header, &tbl_size);
> @@ -226,6 +225,7 @@ acpi_table_parse_entries(char *id,
>
> if (!table_header) {
> printk(KERN_WARNING PREFIX "%4.4s not present\n", id);
> + proc->count[0] = -ENODEV;
See above
> return -ENODEV;
> }
>
> @@ -238,19 +238,25 @@ acpi_table_parse_entries(char *id,
>
> while (((unsigned long)entry) + sizeof(struct acpi_subtable_header) <
> table_end) {
> - if (entry->type == entry_id
> - && (!max_entries || count++ < max_entries))
> - if (handler(entry, table_end)) {
> - early_acpi_os_unmap_memory((char *)table_header, tbl_size);
> - return -EINVAL;
> - }
> + for (i = 0; i < proc->num; i++) {
> + if (entry->type != proc->id[i])
> + continue;
> + if (!max_entries || count++ < max_entries)
> + if (proc->handler[i](entry, table_end)) {
> + early_acpi_os_unmap_memory((char *)table_header, tbl_size);
> + proc->count[i] = -EINVAL;
> + return -EINVAL;
See above
> + }
> + proc->count[i]++;
> + break;
> + }
>
> entry = (struct acpi_subtable_header *)
> ((unsigned long)entry + entry->length);
> }
> if (max_entries && count > max_entries) {
> - printk(KERN_WARNING PREFIX "[%4.4s:0x%02x] ignored %i entries of "
> - "%i found\n", id, entry_id, count - max_entries, count);
> + printk(KERN_WARNING PREFIX "[%4.4s:0x%02x 0x%02x] ignored %i entries of "
> + "%i found\n", id, proc->id[0], proc->id[1], count - max_entries, count);
> }
>
> early_acpi_os_unmap_memory((char *)table_header, tbl_size);
> @@ -258,6 +264,26 @@ acpi_table_parse_entries(char *id,
> }
>
> int __init
> +acpi_table_parse_entries(char *id,
> + unsigned long table_size,
> + int entry_id,
> + acpi_table_entry_handler handler,
> + unsigned int max_entries)
> +{
> + struct acpi_subtable_proc proc;
> +
> + if (!handler)
> + return -EINVAL;
> +
> + memset(&proc, 0, sizeof(proc));
> + proc.id[0] = entry_id;
> + proc.handler[0] = handler;
> + proc.num++;
> +
> + return acpi_table_parse_entries_x(id, table_size, &proc, max_entries);
> +}
And this needs to be split into two patches. One introducing the new
function and one making use of it.
Thanks,
tglx
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH 14/15] acpi: Reverse uid and apic_id print out for x2apic
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
` (12 preceding siblings ...)
2010-10-24 1:02 ` [PATCH 13/15] x86, apic, acpi: Handle xapic/x2apic entries in MADT at same time Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 1:02 ` [PATCH 15/15] x86: Disabling x2apic if nox2apic is specified Yinghai Lu
14 siblings, 0 replies; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
So make it have same sequence like old apic.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
drivers/acpi/tables.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 3e4a60e..4dffce0 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -67,8 +67,8 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
struct acpi_madt_local_x2apic *p =
(struct acpi_madt_local_x2apic *)header;
printk(KERN_INFO PREFIX
- "X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n",
- p->local_apic_id, p->uid,
+ "X2APIC (uid[0x%02x] apic_id[0x%02x] %s)\n",
+ p->uid, p->local_apic_id,
(p->lapic_flags & ACPI_MADT_ENABLED) ?
"enabled" : "disabled");
}
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH 15/15] x86: Disabling x2apic if nox2apic is specified
2010-10-24 1:02 [PATCH 00/15] x86: APIC related clean up Yinghai Lu
` (13 preceding siblings ...)
2010-10-24 1:02 ` [PATCH 14/15] acpi: Reverse uid and apic_id print out for x2apic Yinghai Lu
@ 2010-10-24 1:02 ` Yinghai Lu
2010-10-24 10:15 ` Thomas Gleixner
14 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 1:02 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Andrew Morton, Len Brown, linux-kernel, Yinghai Lu
For
1. x2apic preenabled system
2. first kernel have x2apic enabled, and try to boot second kernel with "nox2apic"
Will put back cpu with apic id < 255 into xapic mode, instead of panic.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/include/asm/apic.h | 6 ++++
arch/x86/include/asm/apicdef.h | 1 +
arch/x86/kernel/acpi/boot.c | 10 ++++++-
arch/x86/kernel/apic/apic.c | 54 +++++++++++++++++++++++++++++++--------
arch/x86/mm/srat_64.c | 12 ++++++++-
5 files changed, 69 insertions(+), 14 deletions(-)
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 69879dd..522f39b 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -176,6 +176,7 @@ static inline u64 native_x2apic_icr_read(void)
}
extern int x2apic_phys;
+extern int nox2apic;
extern void check_x2apic(void);
extern void enable_x2apic(void);
extern void x2apic_icr_write(u32 low, u32 id);
@@ -186,6 +187,10 @@ static inline int x2apic_enabled(void)
if (!cpu_has_x2apic)
return 0;
+ /* avoid to read msr */
+ if (nox2apic)
+ return 0;
+
rdmsr(MSR_IA32_APICBASE, msr, msr2);
if (msr & X2APIC_ENABLE)
return 1;
@@ -214,6 +219,7 @@ static inline void x2apic_force_phys(void)
#define x2apic_preenabled 0
#define x2apic_supported() 0
+#define nox2apic 1
#endif
extern void enable_IR_x2apic(void);
diff --git a/arch/x86/include/asm/apicdef.h b/arch/x86/include/asm/apicdef.h
index a859ca4..f28feba 100644
--- a/arch/x86/include/asm/apicdef.h
+++ b/arch/x86/include/asm/apicdef.h
@@ -141,6 +141,7 @@
#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
#define APIC_BASE_MSR 0x800
+#define XAPIC_ENABLE (1UL << 11)
#define X2APIC_ENABLE (1UL << 10)
#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 8e13ec8..5a4e67e 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -213,6 +213,8 @@ static int __init
acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
{
struct acpi_madt_local_x2apic *processor = NULL;
+ int apic_id;
+ u8 enabled;
processor = (struct acpi_madt_local_x2apic *)header;
@@ -221,6 +223,8 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
acpi_table_print_madt_entry(header);
+ apic_id = processor->local_apic_id;
+ enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
#ifdef CONFIG_X86_X2APIC
/*
* We need to register disabled CPU as well to permit
@@ -229,8 +233,10 @@ 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.
*/
- acpi_register_lapic(processor->local_apic_id, /* APIC ID */
- processor->lapic_flags & ACPI_MADT_ENABLED);
+ if (nox2apic && (apic_id >= 0xff) && enabled)
+ printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
+ else
+ acpi_register_lapic(apic_id, enabled);
#else
printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
#endif
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index d286db1..ebb13e8 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -138,15 +138,14 @@ int x2apic_mode;
#ifdef CONFIG_X86_X2APIC
/* x2apic enabled before OS handover */
static int x2apic_preenabled;
+int nox2apic;
static __init int setup_nox2apic(char *str)
{
- if (x2apic_enabled()) {
- pr_warning("Bios already enabled x2apic, "
- "can't enforce nox2apic");
- return 0;
- }
+ if (x2apic_enabled())
+ pr_warning("Bios already enabled x2apic, will disable it");
+
+ nox2apic = 1;
- setup_clear_cpu_cap(X86_FEATURE_X2APIC);
return 0;
}
early_param("nox2apic", setup_nox2apic);
@@ -1393,8 +1392,33 @@ void __cpuinit end_local_APIC_setup(void)
}
#ifdef CONFIG_X86_X2APIC
+
+static void disable_x2apic(void)
+{
+ int msr, msr2;
+
+ if (!cpu_has_x2apic)
+ return;
+
+ rdmsr(MSR_IA32_APICBASE, msr, msr2);
+ if (msr & X2APIC_ENABLE) {
+ pr_info("Disabling x2apic\n");
+ /*
+ * Need to disable xapic and x2apic at the same time at first
+ * then enable xapic
+ */
+ wrmsr(MSR_IA32_APICBASE, msr & ~(X2APIC_ENABLE | XAPIC_ENABLE),
+ 0);
+ wrmsr(MSR_IA32_APICBASE, msr & ~X2APIC_ENABLE, 0);
+ }
+}
void check_x2apic(void)
{
+ if (nox2apic) {
+ disable_x2apic();
+ return;
+ }
+
if (x2apic_enabled()) {
pr_info("x2apic enabled by BIOS, switching to x2apic ops\n");
x2apic_preenabled = x2apic_mode = 1;
@@ -1405,6 +1429,11 @@ void enable_x2apic(void)
{
int msr, msr2;
+ if (nox2apic) {
+ disable_x2apic();
+ return;
+ }
+
if (!x2apic_mode)
return;
@@ -1430,7 +1459,7 @@ int __init enable_IR(void)
return 0;
}
- if (enable_intr_remapping(x2apic_supported()))
+ if (enable_intr_remapping(x2apic_supported() && !nox2apic))
return 0;
pr_info("Enabled Interrupt-remapping\n");
@@ -1449,7 +1478,7 @@ void __init enable_IR_x2apic(void)
int dmar_table_init_ret;
dmar_table_init_ret = dmar_table_init();
- if (dmar_table_init_ret && !x2apic_supported())
+ if (dmar_table_init_ret && (!x2apic_supported() || nox2apic))
return;
ioapic_entries = alloc_ioapic_entries();
@@ -1473,12 +1502,15 @@ void __init enable_IR_x2apic(void)
else
ret = enable_IR();
+ if (nox2apic)
+ goto without_x2apic;
+
if (!ret) {
/* IR is required if there is APIC ID > 255 even when running
* under KVM
*/
if (max_physical_apicid > 255 || !kvm_para_available())
- goto nox2apic;
+ goto without_x2apic;
/*
* without IR all CPUs can be addressed by IOAPIC/MSI
* only in physical mode
@@ -1494,7 +1526,7 @@ void __init enable_IR_x2apic(void)
pr_info("Enabled x2apic\n");
}
-nox2apic:
+without_x2apic:
if (!ret) /* IR enabling failed */
restore_IO_APIC_setup(ioapic_entries);
legacy_pic->restore_mask();
@@ -1509,7 +1541,7 @@ out:
if (x2apic_preenabled)
panic("x2apic: enabled by BIOS but kernel init failed.");
- else if (cpu_has_x2apic)
+ else if (cpu_has_x2apic && !nox2apic)
pr_info("Not enabling x2apic, Intr-remapping init failed.\n");
}
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index a35cb9d..baa9eab 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -126,6 +126,13 @@ 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;
+#ifdef CONFIG_X86_X2APIC
+ if (nox2apic && (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);
@@ -133,12 +140,15 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
return;
}
- apic_id = pa->apic_id;
apicid_to_node[apic_id] = node;
node_set(node, cpu_nodes_parsed);
acpi_numa = 1;
printk(KERN_INFO "SRAT: PXM %u -> APIC 0x%04x -> Node %u\n",
pxm, apic_id, node);
+#else
+ printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n",
+ pxm, apic_id);
+#endif
}
/* Callback for Proximity Domain -> LAPIC mapping */
--
1.7.1
^ permalink raw reply related [flat|nested] 32+ messages in thread* Re: [PATCH 15/15] x86: Disabling x2apic if nox2apic is specified
2010-10-24 1:02 ` [PATCH 15/15] x86: Disabling x2apic if nox2apic is specified Yinghai Lu
@ 2010-10-24 10:15 ` Thomas Gleixner
2010-10-24 22:09 ` Yinghai Lu
0 siblings, 1 reply; 32+ messages in thread
From: Thomas Gleixner @ 2010-10-24 10:15 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, H. Peter Anvin, Andrew Morton, Len Brown,
linux-kernel
On Sat, 23 Oct 2010, Yinghai Lu wrote:
> For
> 1. x2apic preenabled system
> 2. first kernel have x2apic enabled, and try to boot second kernel with "nox2apic"
>
> Will put back cpu with apic id < 255 into xapic mode, instead of panic.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> ---
> arch/x86/include/asm/apic.h | 6 ++++
> arch/x86/include/asm/apicdef.h | 1 +
> arch/x86/kernel/acpi/boot.c | 10 ++++++-
> arch/x86/kernel/apic/apic.c | 54 +++++++++++++++++++++++++++++++--------
> arch/x86/mm/srat_64.c | 12 ++++++++-
> 5 files changed, 69 insertions(+), 14 deletions(-)
>
> diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
> index 69879dd..522f39b 100644
> --- a/arch/x86/include/asm/apic.h
> +++ b/arch/x86/include/asm/apic.h
> @@ -176,6 +176,7 @@ static inline u64 native_x2apic_icr_read(void)
> }
>
> extern int x2apic_phys;
> +extern int nox2apic;
Can you please use a sensible variable name like x2apic_disabled ?
> extern void check_x2apic(void);
> extern void enable_x2apic(void);
> extern void x2apic_icr_write(u32 low, u32 id);
> @@ -186,6 +187,10 @@ static inline int x2apic_enabled(void)
> if (!cpu_has_x2apic)
> return 0;
>
> + /* avoid to read msr */
That comment is useless. I wish you would add comments to complex code
not to obvious one.
Also it can be folded into the above check
if (!cpu_has_x2apic || x2apic_disabled)
> + if (nox2apic)
> + return 0;
> +
> rdmsr(MSR_IA32_APICBASE, msr, msr2);
> if (msr & X2APIC_ENABLE)
> return 1;
> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
> index d286db1..ebb13e8 100644
> --- a/arch/x86/kernel/apic/apic.c
> +++ b/arch/x86/kernel/apic/apic.c
> @@ -138,15 +138,14 @@ int x2apic_mode;
> #ifdef CONFIG_X86_X2APIC
> /* x2apic enabled before OS handover */
> static int x2apic_preenabled;
> +int nox2apic;
> static __init int setup_nox2apic(char *str)
> {
> - if (x2apic_enabled()) {
> - pr_warning("Bios already enabled x2apic, "
> - "can't enforce nox2apic");
> - return 0;
> - }
> + if (x2apic_enabled())
> + pr_warning("Bios already enabled x2apic, will disable it");
> +
> + nox2apic = 1;
>
> - setup_clear_cpu_cap(X86_FEATURE_X2APIC);
Why is this removed ?
> return 0;
> }
> early_param("nox2apic", setup_nox2apic);
> @@ -1393,8 +1392,33 @@ void __cpuinit end_local_APIC_setup(void)
> }
>
> #ifdef CONFIG_X86_X2APIC
> +
> +static void disable_x2apic(void)
> +{
> + int msr, msr2;
> +
> + if (!cpu_has_x2apic)
> + return;
> +
> + rdmsr(MSR_IA32_APICBASE, msr, msr2);
> + if (msr & X2APIC_ENABLE) {
> + pr_info("Disabling x2apic\n");
> + /*
> + * Need to disable xapic and x2apic at the same time at first
> + * then enable xapic
> + */
> + wrmsr(MSR_IA32_APICBASE, msr & ~(X2APIC_ENABLE | XAPIC_ENABLE),
> + 0);
> + wrmsr(MSR_IA32_APICBASE, msr & ~X2APIC_ENABLE, 0);
> + }
> +}
> void check_x2apic(void)
> {
> + if (nox2apic) {
> + disable_x2apic();
> + return;
> + }
> +
> if (x2apic_enabled()) {
> pr_info("x2apic enabled by BIOS, switching to x2apic ops\n");
> x2apic_preenabled = x2apic_mode = 1;
> @@ -1405,6 +1429,11 @@ void enable_x2apic(void)
> {
> int msr, msr2;
>
> + if (nox2apic) {
> + disable_x2apic();
> + return;
> + }
> +
> if (!x2apic_mode)
> return;
>
> @@ -1430,7 +1459,7 @@ int __init enable_IR(void)
> return 0;
> }
>
> - if (enable_intr_remapping(x2apic_supported()))
> + if (enable_intr_remapping(x2apic_supported() && !nox2apic))
Do we really need all these extra checks ? Can't we simply make all
this one variable wich is set to 1 when x2apic is available and not
disabled on the kernel command line ?
> diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
> index a35cb9d..baa9eab 100644
> --- a/arch/x86/mm/srat_64.c
> +++ b/arch/x86/mm/srat_64.c
> @@ -126,6 +126,13 @@ 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;
> +#ifdef CONFIG_X86_X2APIC
Why conditional? No need to duplicate the printk. It just needs some
thought.
> + if (nox2apic && (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);
> @@ -133,12 +140,15 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
> return;
> }
>
> - apic_id = pa->apic_id;
> apicid_to_node[apic_id] = node;
> node_set(node, cpu_nodes_parsed);
> acpi_numa = 1;
> printk(KERN_INFO "SRAT: PXM %u -> APIC 0x%04x -> Node %u\n",
> pxm, apic_id, node);
> +#else
> + printk(KERN_INFO "SRAT: PXM %u -> X2APIC 0x%04x ignored\n",
> + pxm, apic_id);
> +#endif
> }
>
> /* Callback for Proximity Domain -> LAPIC mapping */
> --
> 1.7.1
>
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [PATCH 15/15] x86: Disabling x2apic if nox2apic is specified
2010-10-24 10:15 ` Thomas Gleixner
@ 2010-10-24 22:09 ` Yinghai Lu
2010-10-25 17:50 ` Suresh Siddha
0 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-24 22:09 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Ingo Molnar, H. Peter Anvin, Andrew Morton, Len Brown,
linux-kernel
On 10/24/2010 03:15 AM, Thomas Gleixner wrote:
>> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
>> index d286db1..ebb13e8 100644
>> --- a/arch/x86/kernel/apic/apic.c
>> +++ b/arch/x86/kernel/apic/apic.c
>> @@ -138,15 +138,14 @@ int x2apic_mode;
>> #ifdef CONFIG_X86_X2APIC
>> /* x2apic enabled before OS handover */
>> static int x2apic_preenabled;
>> +int nox2apic;
>> static __init int setup_nox2apic(char *str)
>> {
>> - if (x2apic_enabled()) {
>> - pr_warning("Bios already enabled x2apic, "
>> - "can't enforce nox2apic");
>> - return 0;
>> - }
>> + if (x2apic_enabled())
>> + pr_warning("Bios already enabled x2apic, will disable it");
>> +
>> + nox2apic = 1;
>>
>> - setup_clear_cpu_cap(X86_FEATURE_X2APIC);
>
> Why is this removed ?
>
need to check that bit with disable_x2apic.
+static void disable_x2apic(void)
+{
+ int msr, msr2;
+
+ if (!cpu_has_x2apic)
+ return;
other concern should be addressed. please check -v2.
Thanks
Yinghai
[PATCH -v2] x86: Disable x2apic if nox2apic is specified
For
1. x2apic preenabled system
2. first kernel have x2apic enabled, and try to kexec second kernel with "nox2apic"
Will put back cpu with apic id < 255 into xapic mode, instead of panic.
-v2: use x2apic_disabled instead of nox2apic, Suggested by Thomas
update x2apic_supported with x2apic_disabled, Suggested by Thomas
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/include/asm/apic.h | 6 +++--
arch/x86/include/asm/apicdef.h | 1
arch/x86/kernel/acpi/boot.c | 10 +++++++-
arch/x86/kernel/apic/apic.c | 46 ++++++++++++++++++++++++++++++++++-------
arch/x86/mm/srat_64.c | 7 +++++-
5 files changed, 58 insertions(+), 12 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
@@ -176,6 +176,7 @@ static inline u64 native_x2apic_icr_read
}
extern int x2apic_phys;
+extern int x2apic_disabled;
extern void check_x2apic(void);
extern void enable_x2apic(void);
extern void x2apic_icr_write(u32 low, u32 id);
@@ -183,7 +184,7 @@ static inline int x2apic_enabled(void)
{
int msr, msr2;
- if (!cpu_has_x2apic)
+ if (!cpu_has_x2apic || x2apic_disabled)
return 0;
rdmsr(MSR_IA32_APICBASE, msr, msr2);
@@ -192,7 +193,7 @@ static inline int x2apic_enabled(void)
return 0;
}
-#define x2apic_supported() (cpu_has_x2apic)
+#define x2apic_supported() (cpu_has_x2apic && !x2apic_disabled)
static inline void x2apic_force_phys(void)
{
x2apic_phys = 1;
@@ -214,6 +215,7 @@ static inline void x2apic_force_phys(voi
#define x2apic_preenabled 0
#define x2apic_supported() 0
+#define x2apic_disabled 1
#endif
extern void enable_IR_x2apic(void);
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
@@ -213,6 +213,8 @@ static int __init
acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
{
struct acpi_madt_local_x2apic *processor = NULL;
+ int apic_id;
+ u8 enabled;
processor = (struct acpi_madt_local_x2apic *)header;
@@ -221,6 +223,8 @@ acpi_parse_x2apic(struct acpi_subtable_h
acpi_table_print_madt_entry(header);
+ apic_id = processor->local_apic_id;
+ enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
#ifdef CONFIG_X86_X2APIC
/*
* We need to register disabled CPU as well to permit
@@ -229,8 +233,10 @@ acpi_parse_x2apic(struct acpi_subtable_h
* to not preallocating memory for all NR_CPUS
* when we use CPU hotplug.
*/
- acpi_register_lapic(processor->local_apic_id, /* APIC ID */
- processor->lapic_flags & ACPI_MADT_ENABLED);
+ if (x2apic_disabled && (apic_id >= 0xff) && enabled)
+ printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
+ else
+ acpi_register_lapic(apic_id, enabled);
#else
printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
#endif
Index: linux-2.6/arch/x86/kernel/apic/apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/apic.c
+++ linux-2.6/arch/x86/kernel/apic/apic.c
@@ -138,15 +138,14 @@ int x2apic_mode;
#ifdef CONFIG_X86_X2APIC
/* x2apic enabled before OS handover */
static int x2apic_preenabled;
+int x2apic_disabled;
static __init int setup_nox2apic(char *str)
{
- if (x2apic_enabled()) {
- pr_warning("Bios already enabled x2apic, "
- "can't enforce nox2apic");
- return 0;
- }
+ if (x2apic_enabled())
+ pr_warning("Bios already enabled x2apic, will disable it");
+
+ x2apic_disabled = 1;
- setup_clear_cpu_cap(X86_FEATURE_X2APIC);
return 0;
}
early_param("nox2apic", setup_nox2apic);
@@ -1393,8 +1392,33 @@ void __cpuinit end_local_APIC_setup(void
}
#ifdef CONFIG_X86_X2APIC
+
+static void disable_x2apic(void)
+{
+ int msr, msr2;
+
+ if (!cpu_has_x2apic)
+ return;
+
+ rdmsr(MSR_IA32_APICBASE, msr, msr2);
+ if (msr & X2APIC_ENABLE) {
+ pr_info("Disabling x2apic\n");
+ /*
+ * Need to disable xapic and x2apic at the same time at first
+ * then enable xapic
+ */
+ wrmsr(MSR_IA32_APICBASE, msr & ~(X2APIC_ENABLE | XAPIC_ENABLE),
+ 0);
+ wrmsr(MSR_IA32_APICBASE, msr & ~X2APIC_ENABLE, 0);
+ }
+}
void check_x2apic(void)
{
+ if (x2apic_disabled) {
+ disable_x2apic();
+ return;
+ }
+
if (x2apic_enabled()) {
pr_info("x2apic enabled by BIOS, switching to x2apic ops\n");
x2apic_preenabled = x2apic_mode = 1;
@@ -1405,6 +1429,11 @@ void enable_x2apic(void)
{
int msr, msr2;
+ if (x2apic_disabled) {
+ disable_x2apic();
+ return;
+ }
+
if (!x2apic_mode)
return;
@@ -1473,6 +1502,9 @@ void __init enable_IR_x2apic(void)
else
ret = enable_IR();
+ if (x2apic_disabled)
+ goto nox2apic;
+
if (!ret) {
/* IR is required if there is APIC ID > 255 even when running
* under KVM
@@ -1509,7 +1541,7 @@ out:
if (x2apic_preenabled)
panic("x2apic: enabled by BIOS but kernel init failed.");
- else if (cpu_has_x2apic)
+ else if (cpu_has_x2apic && !x2apic_disabled)
pr_info("Not enabling x2apic, Intr-remapping init failed.\n");
}
Index: linux-2.6/arch/x86/mm/srat_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/srat_64.c
+++ linux-2.6/arch/x86/mm/srat_64.c
@@ -126,6 +126,12 @@ acpi_numa_x2apic_affinity_init(struct ac
if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
return;
pxm = pa->proximity_domain;
+ apic_id = pa->apic_id;
+ if (x2apic_disabled && (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);
@@ -133,7 +139,6 @@ acpi_numa_x2apic_affinity_init(struct ac
return;
}
- apic_id = pa->apic_id;
apicid_to_node[apic_id] = node;
node_set(node, cpu_nodes_parsed);
acpi_numa = 1;
Index: linux-2.6/arch/x86/include/asm/apicdef.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/apicdef.h
+++ linux-2.6/arch/x86/include/asm/apicdef.h
@@ -141,6 +141,7 @@
#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
#define APIC_BASE_MSR 0x800
+#define XAPIC_ENABLE (1UL << 11)
#define X2APIC_ENABLE (1UL << 10)
#ifdef CONFIG_X86_32
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [PATCH 15/15] x86: Disabling x2apic if nox2apic is specified
2010-10-24 22:09 ` Yinghai Lu
@ 2010-10-25 17:50 ` Suresh Siddha
2010-10-27 6:27 ` [PATCH -v3] x86: Disable " Yinghai Lu
0 siblings, 1 reply; 32+ messages in thread
From: Suresh Siddha @ 2010-10-25 17:50 UTC (permalink / raw)
To: Yinghai Lu
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Andrew Morton,
Len Brown, linux-kernel@vger.kernel.org
On Sun, 2010-10-24 at 15:09 -0700, Yinghai Lu wrote:
> [PATCH -v2] x86: Disable x2apic if nox2apic is specified
>
> For
> 1. x2apic preenabled system
> 2. first kernel have x2apic enabled, and try to kexec second kernel with "nox2apic"
>
> Will put back cpu with apic id < 255 into xapic mode, instead of panic.
>
> -v2: use x2apic_disabled instead of nox2apic, Suggested by Thomas
> update x2apic_supported with x2apic_disabled, Suggested by Thomas
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Yinghai, Have you validated this patch on a system having apicid's > 255
and when the bios has enabled x2apic? When a bios enables x2apic
(typically when it finds processors with apic id's > 255), it also
enables interrupt-remapping before enabling x2apic in the bios.
So not sure what is the behavior with this patch(along with the nox2apic
boot option). Does the kernel boot with cpu's having < 255 apicid, and
also use the interrupt-remapping but with xapic mode?
Also, the boot cpu's apic id might be already > 8 bit, but by forcing to
use xapic, the lower 8 bit portion of it might conflict with another AP
(whose 32bit apic id value is < 255). So we need to be careful in this
case aswell. Have you validated this scenario aswell? May be we should
(or already does) skip that AP having the same 8bit apic id etc.
thanks,
suresh
> ---
> arch/x86/include/asm/apic.h | 6 +++--
> arch/x86/include/asm/apicdef.h | 1
> arch/x86/kernel/acpi/boot.c | 10 +++++++-
> arch/x86/kernel/apic/apic.c | 46 ++++++++++++++++++++++++++++++++++-------
> arch/x86/mm/srat_64.c | 7 +++++-
> 5 files changed, 58 insertions(+), 12 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
> @@ -176,6 +176,7 @@ static inline u64 native_x2apic_icr_read
> }
>
> extern int x2apic_phys;
> +extern int x2apic_disabled;
> extern void check_x2apic(void);
> extern void enable_x2apic(void);
> extern void x2apic_icr_write(u32 low, u32 id);
> @@ -183,7 +184,7 @@ static inline int x2apic_enabled(void)
> {
> int msr, msr2;
>
> - if (!cpu_has_x2apic)
> + if (!cpu_has_x2apic || x2apic_disabled)
> return 0;
>
> rdmsr(MSR_IA32_APICBASE, msr, msr2);
> @@ -192,7 +193,7 @@ static inline int x2apic_enabled(void)
> return 0;
> }
>
> -#define x2apic_supported() (cpu_has_x2apic)
> +#define x2apic_supported() (cpu_has_x2apic && !x2apic_disabled)
> static inline void x2apic_force_phys(void)
> {
> x2apic_phys = 1;
> @@ -214,6 +215,7 @@ static inline void x2apic_force_phys(voi
>
> #define x2apic_preenabled 0
> #define x2apic_supported() 0
> +#define x2apic_disabled 1
> #endif
>
> extern void enable_IR_x2apic(void);
> 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
> @@ -213,6 +213,8 @@ static int __init
> acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
> {
> struct acpi_madt_local_x2apic *processor = NULL;
> + int apic_id;
> + u8 enabled;
>
> processor = (struct acpi_madt_local_x2apic *)header;
>
> @@ -221,6 +223,8 @@ acpi_parse_x2apic(struct acpi_subtable_h
>
> acpi_table_print_madt_entry(header);
>
> + apic_id = processor->local_apic_id;
> + enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
> #ifdef CONFIG_X86_X2APIC
> /*
> * We need to register disabled CPU as well to permit
> @@ -229,8 +233,10 @@ acpi_parse_x2apic(struct acpi_subtable_h
> * to not preallocating memory for all NR_CPUS
> * when we use CPU hotplug.
> */
> - acpi_register_lapic(processor->local_apic_id, /* APIC ID */
> - processor->lapic_flags & ACPI_MADT_ENABLED);
> + if (x2apic_disabled && (apic_id >= 0xff) && enabled)
> + printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
> + else
> + acpi_register_lapic(apic_id, enabled);
> #else
> printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
> #endif
> Index: linux-2.6/arch/x86/kernel/apic/apic.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/apic/apic.c
> +++ linux-2.6/arch/x86/kernel/apic/apic.c
> @@ -138,15 +138,14 @@ int x2apic_mode;
> #ifdef CONFIG_X86_X2APIC
> /* x2apic enabled before OS handover */
> static int x2apic_preenabled;
> +int x2apic_disabled;
> static __init int setup_nox2apic(char *str)
> {
> - if (x2apic_enabled()) {
> - pr_warning("Bios already enabled x2apic, "
> - "can't enforce nox2apic");
> - return 0;
> - }
> + if (x2apic_enabled())
> + pr_warning("Bios already enabled x2apic, will disable it");
> +
> + x2apic_disabled = 1;
>
> - setup_clear_cpu_cap(X86_FEATURE_X2APIC);
> return 0;
> }
> early_param("nox2apic", setup_nox2apic);
> @@ -1393,8 +1392,33 @@ void __cpuinit end_local_APIC_setup(void
> }
>
> #ifdef CONFIG_X86_X2APIC
> +
> +static void disable_x2apic(void)
> +{
> + int msr, msr2;
> +
> + if (!cpu_has_x2apic)
> + return;
> +
> + rdmsr(MSR_IA32_APICBASE, msr, msr2);
> + if (msr & X2APIC_ENABLE) {
> + pr_info("Disabling x2apic\n");
> + /*
> + * Need to disable xapic and x2apic at the same time at first
> + * then enable xapic
> + */
> + wrmsr(MSR_IA32_APICBASE, msr & ~(X2APIC_ENABLE | XAPIC_ENABLE),
> + 0);
> + wrmsr(MSR_IA32_APICBASE, msr & ~X2APIC_ENABLE, 0);
> + }
> +}
> void check_x2apic(void)
> {
> + if (x2apic_disabled) {
> + disable_x2apic();
> + return;
> + }
> +
> if (x2apic_enabled()) {
> pr_info("x2apic enabled by BIOS, switching to x2apic ops\n");
> x2apic_preenabled = x2apic_mode = 1;
> @@ -1405,6 +1429,11 @@ void enable_x2apic(void)
> {
> int msr, msr2;
>
> + if (x2apic_disabled) {
> + disable_x2apic();
> + return;
> + }
> +
> if (!x2apic_mode)
> return;
>
> @@ -1473,6 +1502,9 @@ void __init enable_IR_x2apic(void)
> else
> ret = enable_IR();
>
> + if (x2apic_disabled)
> + goto nox2apic;
> +
> if (!ret) {
> /* IR is required if there is APIC ID > 255 even when running
> * under KVM
> @@ -1509,7 +1541,7 @@ out:
>
> if (x2apic_preenabled)
> panic("x2apic: enabled by BIOS but kernel init failed.");
> - else if (cpu_has_x2apic)
> + else if (cpu_has_x2apic && !x2apic_disabled)
> pr_info("Not enabling x2apic, Intr-remapping init failed.\n");
> }
>
> Index: linux-2.6/arch/x86/mm/srat_64.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/mm/srat_64.c
> +++ linux-2.6/arch/x86/mm/srat_64.c
> @@ -126,6 +126,12 @@ acpi_numa_x2apic_affinity_init(struct ac
> if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
> return;
> pxm = pa->proximity_domain;
> + apic_id = pa->apic_id;
> + if (x2apic_disabled && (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);
> @@ -133,7 +139,6 @@ acpi_numa_x2apic_affinity_init(struct ac
> return;
> }
>
> - apic_id = pa->apic_id;
> apicid_to_node[apic_id] = node;
> node_set(node, cpu_nodes_parsed);
> acpi_numa = 1;
> Index: linux-2.6/arch/x86/include/asm/apicdef.h
> ===================================================================
> --- linux-2.6.orig/arch/x86/include/asm/apicdef.h
> +++ linux-2.6/arch/x86/include/asm/apicdef.h
> @@ -141,6 +141,7 @@
>
> #define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
> #define APIC_BASE_MSR 0x800
> +#define XAPIC_ENABLE (1UL << 11)
> #define X2APIC_ENABLE (1UL << 10)
>
> #ifdef CONFIG_X86_32
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 32+ messages in thread* [PATCH -v3] x86: Disable x2apic if nox2apic is specified
2010-10-25 17:50 ` Suresh Siddha
@ 2010-10-27 6:27 ` Yinghai Lu
2010-10-29 5:53 ` Suresh Siddha
0 siblings, 1 reply; 32+ messages in thread
From: Yinghai Lu @ 2010-10-27 6:27 UTC (permalink / raw)
To: Suresh Siddha, Thomas Gleixner, H. Peter Anvin
Cc: Ingo Molnar, Andrew Morton, Len Brown,
linux-kernel@vger.kernel.org
For
1. x2apic preenabled system
2. first kernel have x2apic enabled, and try to kexec second kernel with "nox2apic"
Will put back cpu with apic id < 255 into xapic mode, instead of panic.
-v2: use x2apic_disabled instead of nox2apic, Suggested by Thomas
update x2apic_supported with x2apic_disabled, Suggested by Thomas
-v3: add checking for boot cpu apic id > 255. in that case will just panic
--- pointed out by Suresh.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/include/asm/apic.h | 6 +++-
arch/x86/include/asm/apicdef.h | 1
arch/x86/include/asm/processor.h | 1
arch/x86/kernel/acpi/boot.c | 10 ++++++-
arch/x86/kernel/apic/apic.c | 51 +++++++++++++++++++++++++++++++++------
arch/x86/kernel/cpu/topology.c | 21 ++++++++++++++++
arch/x86/mm/srat_64.c | 7 ++++-
7 files changed, 85 insertions(+), 12 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
@@ -176,6 +176,7 @@ static inline u64 native_x2apic_icr_read
}
extern int x2apic_phys;
+extern int x2apic_disabled;
extern void check_x2apic(void);
extern void enable_x2apic(void);
extern void x2apic_icr_write(u32 low, u32 id);
@@ -183,7 +184,7 @@ static inline int x2apic_enabled(void)
{
int msr, msr2;
- if (!cpu_has_x2apic)
+ if (!cpu_has_x2apic || x2apic_disabled)
return 0;
rdmsr(MSR_IA32_APICBASE, msr, msr2);
@@ -192,7 +193,7 @@ static inline int x2apic_enabled(void)
return 0;
}
-#define x2apic_supported() (cpu_has_x2apic)
+#define x2apic_supported() (cpu_has_x2apic && !x2apic_disabled)
static inline void x2apic_force_phys(void)
{
x2apic_phys = 1;
@@ -214,6 +215,7 @@ static inline void x2apic_force_phys(voi
#define x2apic_preenabled 0
#define x2apic_supported() 0
+#define x2apic_disabled 1
#endif
extern void enable_IR_x2apic(void);
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
@@ -213,6 +213,8 @@ static int __init
acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
{
struct acpi_madt_local_x2apic *processor = NULL;
+ int apic_id;
+ u8 enabled;
processor = (struct acpi_madt_local_x2apic *)header;
@@ -221,6 +223,8 @@ acpi_parse_x2apic(struct acpi_subtable_h
acpi_table_print_madt_entry(header);
+ apic_id = processor->local_apic_id;
+ enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
#ifdef CONFIG_X86_X2APIC
/*
* We need to register disabled CPU as well to permit
@@ -229,8 +233,10 @@ acpi_parse_x2apic(struct acpi_subtable_h
* to not preallocating memory for all NR_CPUS
* when we use CPU hotplug.
*/
- acpi_register_lapic(processor->local_apic_id, /* APIC ID */
- processor->lapic_flags & ACPI_MADT_ENABLED);
+ if (x2apic_disabled && (apic_id >= 0xff) && enabled)
+ printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
+ else
+ acpi_register_lapic(apic_id, enabled);
#else
printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
#endif
Index: linux-2.6/arch/x86/kernel/apic/apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/apic.c
+++ linux-2.6/arch/x86/kernel/apic/apic.c
@@ -138,15 +138,14 @@ int x2apic_mode;
#ifdef CONFIG_X86_X2APIC
/* x2apic enabled before OS handover */
static int x2apic_preenabled;
+int x2apic_disabled;
static __init int setup_nox2apic(char *str)
{
- if (x2apic_enabled()) {
- pr_warning("Bios already enabled x2apic, "
- "can't enforce nox2apic");
- return 0;
- }
+ if (x2apic_enabled())
+ pr_warning("Bios already enabled x2apic, will disable it");
+
+ x2apic_disabled = 1;
- setup_clear_cpu_cap(X86_FEATURE_X2APIC);
return 0;
}
early_param("nox2apic", setup_nox2apic);
@@ -1394,8 +1393,38 @@ void __cpuinit end_local_APIC_setup(void
}
#ifdef CONFIG_X86_X2APIC
+
+static void disable_x2apic(void)
+{
+ int msr, msr2;
+
+ if (!cpu_has_x2apic)
+ return;
+
+ rdmsr(MSR_IA32_APICBASE, msr, msr2);
+ if (msr & X2APIC_ENABLE) {
+ u32 x2apic_id = x2apic_cpuid_initial_apicid();
+
+ if (x2apic_id > 255)
+ panic("Can not disable x2apic, id: %08x\n", x2apic_id);
+
+ pr_info("Disabling x2apic\n");
+ /*
+ * Need to disable xapic and x2apic at the same time at first
+ * then enable xapic
+ */
+ wrmsr(MSR_IA32_APICBASE, msr & ~(X2APIC_ENABLE | XAPIC_ENABLE),
+ 0);
+ wrmsr(MSR_IA32_APICBASE, msr & ~X2APIC_ENABLE, 0);
+ }
+}
void check_x2apic(void)
{
+ if (x2apic_disabled) {
+ disable_x2apic();
+ return;
+ }
+
if (x2apic_enabled()) {
pr_info("x2apic enabled by BIOS, switching to x2apic ops\n");
x2apic_preenabled = x2apic_mode = 1;
@@ -1406,6 +1435,11 @@ void enable_x2apic(void)
{
int msr, msr2;
+ if (x2apic_disabled) {
+ disable_x2apic();
+ return;
+ }
+
if (!x2apic_mode)
return;
@@ -1474,6 +1508,9 @@ void __init enable_IR_x2apic(void)
else
ret = enable_IR();
+ if (x2apic_disabled)
+ goto nox2apic;
+
if (!ret) {
/* IR is required if there is APIC ID > 255 even when running
* under KVM
@@ -1510,7 +1547,7 @@ out:
if (x2apic_preenabled)
panic("x2apic: enabled by BIOS but kernel init failed.");
- else if (cpu_has_x2apic)
+ else if (cpu_has_x2apic && !x2apic_disabled)
pr_info("Not enabling x2apic, Intr-remapping init failed.\n");
}
Index: linux-2.6/arch/x86/mm/srat_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/srat_64.c
+++ linux-2.6/arch/x86/mm/srat_64.c
@@ -126,6 +126,12 @@ acpi_numa_x2apic_affinity_init(struct ac
if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
return;
pxm = pa->proximity_domain;
+ apic_id = pa->apic_id;
+ if (x2apic_disabled && (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);
@@ -133,7 +139,6 @@ acpi_numa_x2apic_affinity_init(struct ac
return;
}
- apic_id = pa->apic_id;
apicid_to_node[apic_id] = node;
node_set(node, cpu_nodes_parsed);
acpi_numa = 1;
Index: linux-2.6/arch/x86/include/asm/apicdef.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/apicdef.h
+++ linux-2.6/arch/x86/include/asm/apicdef.h
@@ -141,6 +141,7 @@
#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
#define APIC_BASE_MSR 0x800
+#define XAPIC_ENABLE (1UL << 11)
#define X2APIC_ENABLE (1UL << 10)
#ifdef CONFIG_X86_32
Index: linux-2.6/arch/x86/include/asm/processor.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/processor.h
+++ linux-2.6/arch/x86/include/asm/processor.h
@@ -172,6 +172,7 @@ extern void init_scattered_cpuid_feature
extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
extern unsigned short num_cache_leaves;
+u32 x2apic_cpuid_initial_apicid(void);
extern void detect_extended_topology(struct cpuinfo_x86 *c);
extern void detect_ht(struct cpuinfo_x86 *c);
Index: linux-2.6/arch/x86/kernel/cpu/topology.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/topology.c
+++ linux-2.6/arch/x86/kernel/cpu/topology.c
@@ -21,6 +21,27 @@
#define BITS_SHIFT_NEXT_LEVEL(eax) ((eax) & 0x1f)
#define LEVEL_MAX_SIBLINGS(ebx) ((ebx) & 0xffff)
+u32 x2apic_cpuid_initial_apicid(void)
+{
+ unsigned int eax, ebx, ecx, edx;
+
+ if (boot_cpu_data.cpuid_level < 0xb)
+ return 0;
+
+ cpuid_count(0xb, SMT_LEVEL, &eax, &ebx, &ecx, &edx);
+
+ /*
+ * check if the cpuid leaf 0xb is actually implemented.
+ */
+ if (ebx == 0 || (LEAFB_SUBTYPE(ecx) != SMT_TYPE))
+ return 0;
+
+ /*
+ * initial apic id, which also represents 32-bit extended x2apic id.
+ */
+ return edx;
+}
+
/*
* Check for extended topology enumeration cpuid leaf 0xb and if it
* exists, use it for populating initial_apicid and cpu topology
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [PATCH -v3] x86: Disable x2apic if nox2apic is specified
2010-10-27 6:27 ` [PATCH -v3] x86: Disable " Yinghai Lu
@ 2010-10-29 5:53 ` Suresh Siddha
2010-10-29 7:26 ` Yinghai Lu
0 siblings, 1 reply; 32+ messages in thread
From: Suresh Siddha @ 2010-10-29 5:53 UTC (permalink / raw)
To: Yinghai Lu
Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, Andrew Morton,
Len Brown, linux-kernel@vger.kernel.org
On Tue, 2010-10-26 at 23:27 -0700, Yinghai Lu wrote:
> For
> 1. x2apic preenabled system
> 2. first kernel have x2apic enabled, and try to kexec second kernel with "nox2apic"
>
> Will put back cpu with apic id < 255 into xapic mode, instead of panic.
>
> -v2: use x2apic_disabled instead of nox2apic, Suggested by Thomas
> update x2apic_supported with x2apic_disabled, Suggested by Thomas
>
> -v3: add checking for boot cpu apic id > 255. in that case will just panic
> --- pointed out by Suresh.
>
Can we please hold off in merging this patch for a bit? There are some
subtleties in going back to xapic when the platform/cpu's are in x2apic
mode. I will check and get back to you on this after KS.
thanks,
suresh
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH -v3] x86: Disable x2apic if nox2apic is specified
2010-10-29 5:53 ` Suresh Siddha
@ 2010-10-29 7:26 ` Yinghai Lu
0 siblings, 0 replies; 32+ messages in thread
From: Yinghai Lu @ 2010-10-29 7:26 UTC (permalink / raw)
To: Suresh Siddha
Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, Andrew Morton,
Len Brown, linux-kernel@vger.kernel.org
On 10/28/2010 10:53 PM, Suresh Siddha wrote:
> On Tue, 2010-10-26 at 23:27 -0700, Yinghai Lu wrote:
>> For
>> 1. x2apic preenabled system
>> 2. first kernel have x2apic enabled, and try to kexec second kernel with "nox2apic"
>>
>> Will put back cpu with apic id < 255 into xapic mode, instead of panic.
>>
>> -v2: use x2apic_disabled instead of nox2apic, Suggested by Thomas
>> update x2apic_supported with x2apic_disabled, Suggested by Thomas
>>
>> -v3: add checking for boot cpu apic id > 255. in that case will just panic
>> --- pointed out by Suresh.
>>
>
> Can we please hold off in merging this patch for a bit? There are some
> subtleties in going back to xapic when the platform/cpu's are in x2apic
> mode. I will check and get back to you on this after KS.
sure. take you time.
Yinghai
^ permalink raw reply [flat|nested] 32+ messages in thread