* Undefined behaviour with get_cpu_vendor
@ 2005-08-17 9:54 Christian Ehrhardt
2005-08-17 10:21 ` Andreas Schwab
2005-08-17 11:50 ` Andi Kleen
0 siblings, 2 replies; 4+ messages in thread
From: Christian Ehrhardt @ 2005-08-17 9:54 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel
Hi,
Your Patch at (URL wrapped)
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git; \
a=commit;h=99c6e60afff8a7bc6121aeb847dab27c556cf0c9
introduced an additional Parameter (int early) to get_cpu_vendor.
However, the same function is called in arch/i386/kernel/apic.c (via
an explicit extern declaration that doesn't have the new early parameter.
I don't know if this can cause actual problems but I think something like
the patch below is needed for correctness.
regards Christian
--- arch/i386/kernel/apic.c 2005-03-26 04:28:38.000000000 +0100
+++ arch/i386/kernel/apic.c.new 2005-08-17 11:54:48.070499352 +0200
@@ -703,14 +703,14 @@
static int __init detect_init_APIC (void)
{
u32 h, l, features;
- extern void get_cpu_vendor(struct cpuinfo_x86*);
+ extern void get_cpu_vendor(struct cpuinfo_x86*, int);
/* Disabled by kernel option? */
if (enable_local_apic < 0)
return -1;
/* Workaround for us being called before identify_cpu(). */
- get_cpu_vendor(&boot_cpu_data);
+ get_cpu_vendor(&boot_cpu_data, 1);
switch (boot_cpu_data.x86_vendor) {
case X86_VENDOR_AMD:
--
THAT'S ALL FOLKS!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Undefined behaviour with get_cpu_vendor
2005-08-17 9:54 Undefined behaviour with get_cpu_vendor Christian Ehrhardt
@ 2005-08-17 10:21 ` Andreas Schwab
2005-08-17 11:50 ` Andi Kleen
1 sibling, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2005-08-17 10:21 UTC (permalink / raw)
To: Christian Ehrhardt; +Cc: Andi Kleen, linux-kernel
Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de> writes:
> --- arch/i386/kernel/apic.c 2005-03-26 04:28:38.000000000 +0100
> +++ arch/i386/kernel/apic.c.new 2005-08-17 11:54:48.070499352 +0200
> @@ -703,14 +703,14 @@
> static int __init detect_init_APIC (void)
> {
> u32 h, l, features;
> - extern void get_cpu_vendor(struct cpuinfo_x86*);
> + extern void get_cpu_vendor(struct cpuinfo_x86*, int);
Move the declaration to a header and include that here.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Undefined behaviour with get_cpu_vendor
2005-08-17 9:54 Undefined behaviour with get_cpu_vendor Christian Ehrhardt
2005-08-17 10:21 ` Andreas Schwab
@ 2005-08-17 11:50 ` Andi Kleen
2005-08-17 20:08 ` Horst von Brand
1 sibling, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2005-08-17 11:50 UTC (permalink / raw)
To: Christian Ehrhardt; +Cc: Andi Kleen, linux-kernel, akpm
On Wed, Aug 17, 2005 at 11:54:23AM +0200, Christian Ehrhardt wrote:
>
> Hi,
>
> Your Patch at (URL wrapped)
>
> http://www.kernel.org/git/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git; \
> a=commit;h=99c6e60afff8a7bc6121aeb847dab27c556cf0c9
>
> introduced an additional Parameter (int early) to get_cpu_vendor.
> However, the same function is called in arch/i386/kernel/apic.c (via
> an explicit extern declaration that doesn't have the new early parameter.
Sigh. All people adding externs like this should be ...
But it won't change anything - the only difference with
the flag being 0 is to read less fields, but since the function
has been called earlier and the data has not changed
the output is always the same.
Anyways, the correct change is to just remove this call because it's
not needed anymore because of the early CPU detection.
> I don't know if this can cause actual problems but I think something like
> the patch below is needed for correctness.
It's not needed for correctness.
-Andi
Remove obsolete get_cpu_vendor call.
Since early CPU identify is in this information is already available
Signed-off-by: Andi Kleen <ak@suse.de>
Index: linux-2.6.13-rc6-misc/arch/i386/kernel/apic.c
===================================================================
--- linux-2.6.13-rc6-misc.orig/arch/i386/kernel/apic.c
+++ linux-2.6.13-rc6-misc/arch/i386/kernel/apic.c
@@ -726,15 +726,11 @@ __setup("apic=", apic_set_verbosity);
static int __init detect_init_APIC (void)
{
u32 h, l, features;
- extern void get_cpu_vendor(struct cpuinfo_x86*);
/* Disabled by kernel option? */
if (enable_local_apic < 0)
return -1;
- /* Workaround for us being called before identify_cpu(). */
- get_cpu_vendor(&boot_cpu_data);
-
switch (boot_cpu_data.x86_vendor) {
case X86_VENDOR_AMD:
if ((boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model > 1) ||
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Undefined behaviour with get_cpu_vendor
2005-08-17 11:50 ` Andi Kleen
@ 2005-08-17 20:08 ` Horst von Brand
0 siblings, 0 replies; 4+ messages in thread
From: Horst von Brand @ 2005-08-17 20:08 UTC (permalink / raw)
To: Andi Kleen; +Cc: Christian Ehrhardt, linux-kernel, akpm
Andi Kleen <ak@suse.de> wrote:
> On Wed, Aug 17, 2005 at 11:54:23AM +0200, Christian Ehrhardt wrote:
> > Your Patch at (URL wrapped)
> >
> > http://www.kernel.org/git/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git; \
> > a=commit;h=99c6e60afff8a7bc6121aeb847dab27c556cf0c9
> >
> > introduced an additional Parameter (int early) to get_cpu_vendor.
> > However, the same function is called in arch/i386/kernel/apic.c (via
> > an explicit extern declaration that doesn't have the new early parameter.
>
> Sigh. All people adding externs like this should be ...
>
> But it won't change anything - the only difference with
> the flag being 0 is to read less fields, but since the function
> has been called earlier and the data has not changed
> the output is always the same.
I'm not so sure that "argument not explicitly given" will always turn out
zero... more like "random" memory contents.
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-08-17 20:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-17 9:54 Undefined behaviour with get_cpu_vendor Christian Ehrhardt
2005-08-17 10:21 ` Andreas Schwab
2005-08-17 11:50 ` Andi Kleen
2005-08-17 20:08 ` Horst von Brand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®