login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
November
»
12
Re: [PATCH UPDATED 4/9] x86: Initialize 32bit logical apicid mapping early during boot
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Yinghai Lu
Subject:
Re: [PATCH UPDATED 4/9] x86: Initialize 32bit logical apicid mapping early during boot
Date: Friday, November 12, 2010 - 2:58 am
On 11/12/2010 01:38 AM, Tejun Heo wrote:
quoted text
> On x86_32, non-standard logical apicid mapping can be used by > different NUMA setups and the mapping is queried while bringing up > each CPU using apic->cpu_to_logical_apicid() to build > cpu_2_logical_apicid[] array. The logical apicid is then used to > deliver IPIs and determine NUMA configuration. > > Unfortunately, initializing at SMP bring up is too late for percpu > setup making static percpu variables setup w/o considering NUMA. This > also is different from how x86_64 is configured making the code > difficult to follow and maintain. > > This patch updates logical apicid mapping handling such that, > > * early_percpu variable x86_cpu_to_logical_apicid replaces > cpu_2_logical_apicid[]. > > * apic->cpu_to_logical_apicid() is called once during get_smp_config() > and the output is recorded in x86_cpu_to_logical_apicid. > > * apic->cpu_to_logical_apicid() is allowed to return BAD_APICID if it > can't determine the value that early during boot. In this case, the > mapping will be initialized during SMP bring up by reading APIC LDR > as before. > > - Brian Gerst spotted that setup_per_cpu_areas() was not copying the > early x86_cpu_to_logical_apicid to the permanent percpu area and > es7000_32 is using per_cpu() instead of early_per_cpu(), which in > itself is not incorrect as they're never used before setup_per_cpu() > but still confusing. Both updated. > > Signed-off-by: Tejun Heo <tj@kernel.org> > Cc: Brian Gerst <brgerst@gmail.com> > --- > Updated as per Brian's comment. The rest of the patchset apply okay > on top of this change. The git tree is updated accordingly. > > Thanks. > > arch/x86/include/asm/apic.h | 18 +++++++++++++----- > arch/x86/include/asm/smp.h | 3 +++ > arch/x86/kernel/apic/apic.c | 36 ++++++++++++++++++++++++++++-------- > arch/x86/kernel/apic/bigsmp_32.c | 26 ++++++++++++++------------ > arch/x86/kernel/apic/es7000_32.c | 27 ++++++++++----------------- > arch/x86/kernel/apic/ipi.c | 8 ++++---- > arch/x86/kernel/apic/numaq_32.c | 15 +++++++-------- > arch/x86/kernel/apic/summit_32.c | 36 ++++++++++++++++-------------------- > arch/x86/kernel/setup_percpu.c | 7 +++++++ > arch/x86/kernel/smpboot.c | 10 +++------- > 10 files changed, 105 insertions(+), 81 deletions(-) > > Index: work/arch/x86/kernel/apic/apic.c > =================================================================== > --- work.orig/arch/x86/kernel/apic/apic.c > +++ work/arch/x86/kernel/apic/apic.c > @@ -1202,6 +1207,7 @@ static void __cpuinit lapic_setup_esr(vo > */ > void __cpuinit setup_local_APIC(void) > { > + int cpu = smp_processor_id(); > unsigned int value, queued; > int i, j, acked = 0; > unsigned long long tsc = 0, ntsc; > @@ -1343,21 +1362,19 @@ void __cpuinit setup_local_APIC(void) > * TODO: set up through-local-APIC from through-I/O-APIC? --macro > */ > value = apic_read(APIC_LVT0) & APIC_LVT_MASKED; > - if (!smp_processor_id() && (pic_mode || !value)) { > + if (!cpu && (pic_mode || !value)) { > value = APIC_DM_EXTINT; > - apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n", > - smp_processor_id()); > + apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n", cpu); > } else { > value = APIC_DM_EXTINT | APIC_LVT_MASKED; > - apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", > - smp_processor_id()); > + apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", cpu); > } > apic_write(APIC_LVT0, value); > > /* > * only the BP should see the LINT1 NMI signal, obviously. > */ > - if (!smp_processor_id()) > + if (!cpu) > value = APIC_DM_NMI; > else > value = APIC_DM_NMI | APIC_LVT_MASKED; > @@ -1369,7 +1386,7 @@ void __cpuinit setup_local_APIC(void) > > #ifdef CONFIG_X86_MCE_INTEL > /* Recheck CMCI information after local APIC is up on CPU #0 */ > - if (smp_processor_id() == 0) > + if (cpu == 0) > cmci_recheck(); > #endif > }
those replacing smp_processor_id() with cpu should be in another patch. Thanks Yinghai --
unsubscribe notice
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/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCHSET RFC] x86: unify x86_32 and 64 NUMA init paths
, Tejun Heo
, (Thu Nov 11, 4:02 am)
[PATCH 3/9] x86: Make default_send_IPI_mask_sequence/allbu ...
, Tejun Heo
, (Thu Nov 11, 4:02 am)
[PATCH 4/9] x86: Initialize 32bit logical apicid mapping e ...
, Tejun Heo
, (Thu Nov 11, 4:02 am)
[PATCH 5/9] x86: Replace apic->apicid_to_node() with ->num ...
, Tejun Heo
, (Thu Nov 11, 4:02 am)
[PATCH 6/9] x86: Unify cpu/apicid <-> NUMA node mapping be ...
, Tejun Heo
, (Thu Nov 11, 4:02 am)
[PATCH 7/9] x86: Unify CPU -> NUMA node mapping between 32 ...
, Tejun Heo
, (Thu Nov 11, 4:02 am)
[PATCH 8/9] x86: Unify node_to_cpumask_map handling betwee ...
, Tejun Heo
, (Thu Nov 11, 4:02 am)
[PATCH 9/9] x86: Unify NUMA initialization between 32 and ...
, Tejun Heo
, (Thu Nov 11, 4:02 am)
Re: [PATCH 5/9] x86: Replace apic->apicid_to_node() with - ...
, Pekka Enberg
, (Thu Nov 11, 4:37 am)
Re: [PATCH 6/9] x86: Unify cpu/apicid <-> NUMA node mappin ...
, Pekka Enberg
, (Thu Nov 11, 5:01 am)
Re: [PATCH 3/9] x86: Make default_send_IPI_mask_sequence/a ...
, Pekka Enberg
, (Thu Nov 11, 5:02 am)
Re: [PATCH 9/9] x86: Unify NUMA initialization between 32 ...
, Pekka Enberg
, (Thu Nov 11, 5:09 am)
Re: [PATCH 8/9] x86: Unify node_to_cpumask_map handling be ...
, Pekka Enberg
, (Thu Nov 11, 5:11 am)
Re: [PATCH 3/9] x86: Make default_send_IPI_mask_sequence/a ...
, Cyrill Gorcunov
, (Thu Nov 11, 9:18 am)
[PATCH UPDATED 3/9] x86: Make default_send_IPI_mask_sequen ...
, Tejun Heo
, (Thu Nov 11, 10:34 am)
Re: [PATCH UPDATED 3/9] x86: Make default_send_IPI_mask_se ...
, Cyrill Gorcunov
, (Thu Nov 11, 10:52 am)
Re: [PATCH 4/9] x86: Initialize 32bit logical apicid mappi ...
, Brian Gerst
, (Thu Nov 11, 6:54 pm)
[PATCH UPDATED 4/9] x86: Initialize 32bit logical apicid m ...
, Tejun Heo
, (Fri Nov 12, 2:38 am)
Re: [PATCH UPDATED 4/9] x86: Initialize 32bit logical apic ...
, Yinghai Lu
, (Fri Nov 12, 2:58 am)
Re: [PATCH UPDATED 4/9] x86: Initialize 32bit logical apic ...
, Tejun Heo
, (Fri Nov 12, 3:22 am)
[PATCH 3.5/9] x86: Use local variable to cache smp_process ...
, Tejun Heo
, (Fri Nov 12, 3:32 am)
[PATCH 4/9 UPDATED-1] x86: Initialize 32bit logical apicid ...
, Tejun Heo
, (Fri Nov 12, 3:33 am)
Re: [PATCH 4/9 UPDATED-1] x86: Initialize 32bit logical ap ...
, Ingo Molnar
, (Thu Nov 18, 1:30 am)
Re: [PATCH 4/9 UPDATED-1] x86: Initialize 32bit logical ap ...
, Tejun Heo
, (Thu Nov 18, 1:39 am)
Re: [PATCH 4/9 UPDATED-1] x86: Initialize 32bit logical ap ...
, Ingo Molnar
, (Thu Nov 18, 1:42 am)