mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Krzysztof Helt <krzysztof.h1@wp.pl>,
	hpa@zytor.com, linux-kernel@vger.kernel.org,
	Ingo Molnar <mingo@elte.hu>,
	Jeremy Fitzhardinge <jeremy@goop.org>
Subject: Re: [PATCH] x86: fdiv bug detection fix
Date: Fri, 1 Aug 2008 00:11:45 +0200	[thread overview]
Message-ID: <20080731221145.GD615@1wt.eu> (raw)
In-Reply-To: <20080731144920.0016e02d.akpm@linux-foundation.org>

On Thu, Jul 31, 2008 at 02:49:20PM -0700, Andrew Morton wrote:
> On Thu, 31 Jul 2008 23:43:44 +0200
> Krzysztof Helt <krzysztof.h1@wp.pl> wrote:
> 
> > From: Krzysztof Helt <krzysztof.h1@wp.pl>
> > 
> > The fdiv detection code writes s32 integer into
> > the boot_cpu_data.fdiv_bug. 
> > However, the boot_cpu_data.fdiv_bug is only char (s8)
> > field so the detection overwrites already set fields for
> > other bugs, e.g. the f00f bug field.
> > 
> > Use local s32 variable to receive result.
> > 
> > Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> > ---
> > 
> > This is a partial fix to Bugzilla #9928  - fixes wrong 
> > information about the f00f bug (tested) and probably
> > for coma bug (I have no cpu to test this).
> > 
> > diff -urp linux-alsa/arch/x86/kernel/cpu/bugs.c linux-new/arch/x86/kernel/cpu/bugs.c
> > --- linux-alsa/arch/x86/kernel/cpu/bugs.c	2008-07-31 12:40:31.000000000 +0200
> > +++ linux-new/arch/x86/kernel/cpu/bugs.c	2008-07-31 23:24:07.722657435 +0200
> > @@ -50,6 +50,8 @@ static double __initdata y = 3145727.0;
> >   */
> >  static void __init check_fpu(void)
> >  {
> > +	s32 fdiv_bug;
> > +
> >  	if (!boot_cpu_data.hard_math) {
> >  #ifndef CONFIG_MATH_EMULATION
> >  		printk(KERN_EMERG "No coprocessor found and no math emulation present.\n");
> > @@ -74,8 +76,10 @@ static void __init check_fpu(void)
> >  		"fistpl %0\n\t"
> >  		"fwait\n\t"
> >  		"fninit"
> > -		: "=m" (*&boot_cpu_data.fdiv_bug)
> > +		: "=m" (*&fdiv_bug)
> >  		: "m" (*&x), "m" (*&y));
> > +
> > +	boot_cpu_data.fdiv_bug = fdiv_bug;
> >  	if (boot_cpu_data.fdiv_bug)
> >  		printk("Hmm, FPU with FDIV bug.\n");
> >  }
> 
> hm, the code seems to have been that way for quite some time.

Indeed! since boot_cpu_data.fdiv_bug was declared as an int in 2.4, I
think it might have changed when a lot of code was moved from asm/*.h
to arch/*.c.

> I wonder why nobody noticed this before.

For the same reason those bugs were noticed very late in the products'
lifetime I guess : because unless someone actively plays with them on
your machine, you hardly trigger them by accident.

Willy


  parent reply	other threads:[~2008-07-31 22:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-31 21:43 Krzysztof Helt
2008-07-31 21:49 ` Andrew Morton
2008-07-31 22:04   ` Jeremy Fitzhardinge
2008-07-31 22:11   ` Willy Tarreau [this message]
2008-07-31 21:57 ` 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=20080731221145.GD615@1wt.eu \
    --to=w@1wt.eu \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=krzysztof.h1@wp.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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

all inboxes | Powered by JetHome®