* [PATCH] x86: clean up setup_clear/force_cpu_cap handling
@ 2008-12-23 7:32 Yinghai Lu
2008-12-27 10:22 ` Ingo Molnar
0 siblings, 1 reply; 5+ messages in thread
From: Yinghai Lu @ 2008-12-23 7:32 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
Jeremy Fitzhardinge
Cc: linux-kernel
Impact: fix and cleanup
setup_force_cpu_cap() only have one user xen
but it should not reuse cleared_cpu_cpus. it will have problem
for smp.
need to have cpu_cpus_set array too.
also need to setup handling before all cpus cap AND
Signed-off-by: Yinghai Lu <yinghai.lu@kernel.org>
---
arch/x86/include/asm/cpufeature.h | 4 ++--
arch/x86/include/asm/processor.h | 3 ++-
arch/x86/kernel/cpu/common.c | 17 ++++++++++++-----
3 files changed, 16 insertions(+), 8 deletions(-)
Index: linux-2.6/arch/x86/include/asm/cpufeature.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/cpufeature.h
+++ linux-2.6/arch/x86/include/asm/cpufeature.h
@@ -190,11 +190,11 @@ extern const char * const x86_power_flag
#define clear_cpu_cap(c, bit) clear_bit(bit, (unsigned long *)((c)->x86_capability))
#define setup_clear_cpu_cap(bit) do { \
clear_cpu_cap(&boot_cpu_data, bit); \
- set_bit(bit, (unsigned long *)cleared_cpu_caps); \
+ set_bit(bit, (unsigned long *)cpu_caps_cleared); \
} while (0)
#define setup_force_cpu_cap(bit) do { \
set_cpu_cap(&boot_cpu_data, bit); \
- clear_bit(bit, (unsigned long *)cleared_cpu_caps); \
+ set_bit(bit, (unsigned long *)cpu_caps_set); \
} while (0)
#define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU)
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
@@ -134,7 +134,8 @@ extern struct cpuinfo_x86 boot_cpu_data;
extern struct cpuinfo_x86 new_cpu_data;
extern struct tss_struct doublefault_tss;
-extern __u32 cleared_cpu_caps[NCAPINTS];
+extern __u32 cpu_caps_cleared[NCAPINTS];
+extern __u32 cpu_caps_set[NCAPINTS];
#ifdef CONFIG_SMP
DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info);
Index: linux-2.6/arch/x86/kernel/cpu/common.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/common.c
+++ linux-2.6/arch/x86/kernel/cpu/common.c
@@ -221,7 +221,8 @@ static char __cpuinit *table_lookup_mode
return NULL; /* Not found */
}
-__u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata;
+__u32 cpu_caps_cleared[NCAPINTS] __cpuinitdata;
+__u32 cpu_caps_set[NCAPINTS] __cpuinitdata;
/* Current gdt points %fs at the "master" per-cpu area: after this,
* it's on the real one. */
@@ -706,6 +707,16 @@ static void __cpuinit identify_cpu(struc
#endif
init_hypervisor(c);
+
+ /*
+ * Clear/Set all flags overriden by options, need do it
+ * before following smp all cpus cap AND.
+ */
+ for (i = 0; i < NCAPINTS; i++) {
+ c->x86_capability[i] &= ~cpu_caps_cleared[i];
+ c->x86_capability[i] |= cpu_caps_set[i];
+ }
+
/*
* On SMP, boot_cpu_data holds the common feature set between
* all CPUs; so make sure that we indicate which features are
@@ -718,10 +729,6 @@ static void __cpuinit identify_cpu(struc
boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
}
- /* Clear all flags overriden by options */
- for (i = 0; i < NCAPINTS; i++)
- c->x86_capability[i] &= ~cleared_cpu_caps[i];
-
#ifdef CONFIG_X86_MCE
/* Init Machine Check Exception if available. */
mcheck_init(c);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: clean up setup_clear/force_cpu_cap handling
2008-12-23 7:32 [PATCH] x86: clean up setup_clear/force_cpu_cap handling Yinghai Lu
@ 2008-12-27 10:22 ` Ingo Molnar
2008-12-27 20:49 ` Yinghai Lu
2008-12-28 9:38 ` Rusty Russell
0 siblings, 2 replies; 5+ messages in thread
From: Ingo Molnar @ 2008-12-27 10:22 UTC (permalink / raw)
To: Yinghai Lu, Rusty Russell
Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton,
Jeremy Fitzhardinge, linux-kernel
* Yinghai Lu <yinghai@kernel.org> wrote:
> Impact: fix and cleanup
>
> setup_force_cpu_cap() only have one user xen
> but it should not reuse cleared_cpu_cpus. it will have problem
> for smp.
>
> need to have cpu_cpus_set array too.
> also need to setup handling before all cpus cap AND
>
> Signed-off-by: Yinghai Lu <yinghai.lu@kernel.org>
>
> ---
> arch/x86/include/asm/cpufeature.h | 4 ++--
> arch/x86/include/asm/processor.h | 3 ++-
> arch/x86/kernel/cpu/common.c | 17 ++++++++++++-----
> 3 files changed, 16 insertions(+), 8 deletions(-)
Rusty, you'll carry this patch in your linux-2.6-boot-params.git tree,
right? Merging this in the x86 tree would just needlessly complicate your
logistics, right?
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: clean up setup_clear/force_cpu_cap handling
2008-12-27 10:22 ` Ingo Molnar
@ 2008-12-27 20:49 ` Yinghai Lu
2008-12-28 9:38 ` Rusty Russell
1 sibling, 0 replies; 5+ messages in thread
From: Yinghai Lu @ 2008-12-27 20:49 UTC (permalink / raw)
To: Ingo Molnar
Cc: Rusty Russell, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
Jeremy Fitzhardinge, linux-kernel
Ingo Molnar wrote:
> * Yinghai Lu <yinghai@kernel.org> wrote:
>
>> Impact: fix and cleanup
>>
>> setup_force_cpu_cap() only have one user xen
>> but it should not reuse cleared_cpu_cpus. it will have problem
>> for smp.
>>
>> need to have cpu_cpus_set array too.
>> also need to setup handling before all cpus cap AND
>>
>> Signed-off-by: Yinghai Lu <yinghai.lu@kernel.org>
>>
>> ---
>> arch/x86/include/asm/cpufeature.h | 4 ++--
>> arch/x86/include/asm/processor.h | 3 ++-
>> arch/x86/kernel/cpu/common.c | 17 ++++++++++++-----
>> 3 files changed, 16 insertions(+), 8 deletions(-)
>
> Rusty, you'll carry this patch in your linux-2.6-boot-params.git tree,
> right? Merging this in the x86 tree would just needlessly complicate your
> logistics, right?
Rusty polished this patch a little bit and put the updated one in his tree.
so you may need to pick up the updated one.
YH
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: clean up setup_clear/force_cpu_cap handling
2008-12-27 10:22 ` Ingo Molnar
2008-12-27 20:49 ` Yinghai Lu
@ 2008-12-28 9:38 ` Rusty Russell
2008-12-28 9:46 ` Ingo Molnar
1 sibling, 1 reply; 5+ messages in thread
From: Rusty Russell @ 2008-12-28 9:38 UTC (permalink / raw)
To: Ingo Molnar
Cc: Yinghai Lu, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
Jeremy Fitzhardinge, linux-kernel
On Saturday 27 December 2008 20:52:34 Ingo Molnar wrote:
>
> * Yinghai Lu <yinghai@kernel.org> wrote:
>
> > Impact: fix and cleanup
> >
> > setup_force_cpu_cap() only have one user xen
> > but it should not reuse cleared_cpu_cpus. it will have problem
> > for smp.
> >
> > need to have cpu_cpus_set array too.
> > also need to setup handling before all cpus cap AND
> >
> > Signed-off-by: Yinghai Lu <yinghai.lu@kernel.org>
> >
> > ---
> > arch/x86/include/asm/cpufeature.h | 4 ++--
> > arch/x86/include/asm/processor.h | 3 ++-
> > arch/x86/kernel/cpu/common.c | 17 ++++++++++++-----
> > 3 files changed, 16 insertions(+), 8 deletions(-)
>
> Rusty, you'll carry this patch in your linux-2.6-boot-params.git tree,
> right? Merging this in the x86 tree would just needlessly complicate your
> logistics, right?
Yep, if you're happy to ack, I'm happy to carry.
Cheers,
Rusty.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: clean up setup_clear/force_cpu_cap handling
2008-12-28 9:38 ` Rusty Russell
@ 2008-12-28 9:46 ` Ingo Molnar
0 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2008-12-28 9:46 UTC (permalink / raw)
To: Rusty Russell
Cc: Yinghai Lu, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
Jeremy Fitzhardinge, linux-kernel
* Rusty Russell <rusty@rustcorp.com.au> wrote:
> On Saturday 27 December 2008 20:52:34 Ingo Molnar wrote:
> >
> > * Yinghai Lu <yinghai@kernel.org> wrote:
> >
> > > Impact: fix and cleanup
> > >
> > > setup_force_cpu_cap() only have one user xen
> > > but it should not reuse cleared_cpu_cpus. it will have problem
> > > for smp.
> > >
> > > need to have cpu_cpus_set array too.
> > > also need to setup handling before all cpus cap AND
> > >
> > > Signed-off-by: Yinghai Lu <yinghai.lu@kernel.org>
> > >
> > > ---
> > > arch/x86/include/asm/cpufeature.h | 4 ++--
> > > arch/x86/include/asm/processor.h | 3 ++-
> > > arch/x86/kernel/cpu/common.c | 17 ++++++++++++-----
> > > 3 files changed, 16 insertions(+), 8 deletions(-)
> >
> > Rusty, you'll carry this patch in your linux-2.6-boot-params.git tree,
> > right? Merging this in the x86 tree would just needlessly complicate your
> > logistics, right?
>
> Yep, if you're happy to ack, I'm happy to carry.
yeah. And if it breaks, that's your fault ;-)
Acked-by: Ingo Molnar <mingo@elte.hu>
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-12-28 9:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-23 7:32 [PATCH] x86: clean up setup_clear/force_cpu_cap handling Yinghai Lu
2008-12-27 10:22 ` Ingo Molnar
2008-12-27 20:49 ` Yinghai Lu
2008-12-28 9:38 ` Rusty Russell
2008-12-28 9:46 ` Ingo Molnar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.