From: Rusty Russell <rusty@rustcorp.com.au>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>, Hugh Dickins <hugh@veritas.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: linux-next: parsing mem=700M broken
Date: Thu, 25 Dec 2008 22:10:35 +1030 [thread overview]
Message-ID: <200812252210.36367.rusty@rustcorp.com.au> (raw)
In-Reply-To: <4951EE20.5080004@kernel.org>
On Wednesday 24 December 2008 18:39:04 Yinghai Lu wrote:
> for cpu caps on boot cpu setup still need
OK, how about these? I cleaned up description a little, and put
it in own function.
Subject: [PATCH] x86: clean up setup_clear/force_cpu_cap handling
From: Yinghai Lu <yinghai.lu@kernel.org>
Impact: fix and cleanup
setup_force_cpu_cap() only has one user (xen) but it should not reuse
cleared_cpu_cpus. It will have problems for smp.
Need to have cpu_cpus_set array too, and need to combine it before
we AND into boot_cpu_data.x86_capability.
Signed-off-by: Yinghai Lu <yinghai.lu@kernel.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
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(-)
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -188,11 +188,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)
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -130,7 +130,8 @@ extern struct cpuinfo_x86 new_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);
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -219,7 +219,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. */
@@ -512,6 +513,16 @@ static void __cpuinit identify_cpu_witho
#endif
}
+static void __cpuinit override_capabilities(u32 x86_capability[])
+{
+ unsigned int i;
+
+ for (i = 0; i < NCAPINTS; i++) {
+ x86_capability[i] &= ~cpu_caps_cleared[i];
+ x86_capability[i] |= cpu_caps_set[i];
+ }
+}
+
/*
* Do minimum CPU detection early.
* Fields really needed: vendor, cpuid_level, family, model, mask,
@@ -703,6 +714,9 @@ static void __cpuinit identify_cpu(struc
detect_ht(c);
#endif
+ /* Command-line override before we AND into smp all cpus cap. */
+ override_capabilities(c->x86_capability);
+
/*
* On SMP, boot_cpu_data holds the common feature set between
* all CPUs; so make sure that we indicate which features are
@@ -714,10 +728,6 @@ static void __cpuinit identify_cpu(struc
for (i = 0; i < NCAPINTS; i++)
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. */
Subject: x86: override_capabilities in early_identify_cpu
From: Rusty Russell <rusty@rustcorp.com.au>
Impact: future-proof
This does nothing at the moment, but once early_param() are parsed before
setup_arch, it will ensure we respect commandline overrides on the boot
cpu's capabilities.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Yinghai Lu <yinghai.lu@kernel.org>
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -559,6 +559,8 @@ static void __init early_identify_cpu(st
if (this_cpu->c_early_init)
this_cpu->c_early_init(c);
+
+ override_capabilities(c->x86_capability);
validate_pat_support(c);
next prev parent reply other threads:[~2008-12-25 11:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-23 3:06 linux-next: parsing mem=700M broken Hugh Dickins
2008-12-23 5:52 ` Yinghai Lu
2008-12-23 14:33 ` Ingo Molnar
2008-12-24 7:38 ` Rusty Russell
2008-12-24 8:09 ` Yinghai Lu
2008-12-24 23:09 ` Yinghai Lu
2008-12-25 11:40 ` Rusty Russell [this message]
2008-12-25 22:46 ` Yinghai Lu
2008-12-24 12:30 ` Ingo Oeser
2008-12-25 5:50 ` Rusty Russell
2008-12-24 14:44 ` Hugh Dickins
2008-12-25 3:28 ` Rusty Russell
2008-12-27 13:12 ` Rusty Russell
2008-12-28 0:43 ` Hugh Dickins
2008-12-28 2:07 ` Yinghai Lu
2009-01-01 3:42 ` Rusty Russell
2008-12-25 12:17 ` [RFC] boot parameter handling cleanup II Rusty Russell
2008-12-25 12:20 ` [RFC PATCH] param: start_kernel_with_args() Rusty Russell
2008-12-27 10:14 ` [RFC] boot parameter handling cleanup II Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200812252210.36367.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=akpm@linux-foundation.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=sfr@canb.auug.org.au \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox