From: Jamie Lokier <jamie@shareable.org>
To: Brian Gerst <bgerst@didntduck.org>
Cc: Kathy Frazier <kfrazier@mdc-dayton.com>, Andi Kleen <ak@muc.de>,
linux-kernel@vger.kernel.org
Subject: Re: Interrupt doesn't make it to the 8259 on a ASUS P4PE mobo
Date: Tue, 15 Jul 2003 18:43:37 +0100 [thread overview]
Message-ID: <20030715174337.GC1491@mail.jlokier.co.uk> (raw)
In-Reply-To: <3F14348B.4050606@didntduck.org>
Brian Gerst wrote:
> >>>dmatimer.expires = jiffies + 0.5*HZ;
> >>
> >>That's a serious bug. You cannot use floating point in the kernel.
> >>It will corrupt the FP state of the user process.
> >
> >HZ on the INTEL platform is 100, so this should simply add 50 to the
> >current
> >value of jiffies. Besides, assigning the value to the unsigned int field
> >(expires) will truncate it to an integer anyway.
>
> Use HZ/2 instead. GCC doesn't optimize floating point constants to the
> same degree it does integers, because it doesn't know what mode
> (rounding, precision) the FPU is in.
Optimising this to an integer add of 50 would be incorrect anyway.
Think about jiffies == 0xfffffffe.
The first statement is equivalent to:
dmatimer.expires = (unsigned long) ((double) + 50)
and would set dmatimer.expires to 0xffffffff.
Whereas the HZ/2 form is correct!
Have a nice day,
-- Jamie
next prev parent reply other threads:[~2003-07-15 17:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <m3el0stw23.fsf@averell.firstfloor.org>
2003-07-15 16:14 ` Interrupt doesn't make it to the 8259 on a ASUS P4PE mobo Kathy Frazier
2003-07-15 15:31 ` Richard B. Johnson
2003-07-15 15:58 ` SCSI ATA driver in 2.4.22 ? Jeff Mock
2003-07-15 16:14 ` Jeff Garzik
2003-07-15 17:06 ` Interrupt doesn't make it to the 8259 on a ASUS P4PE mobo Brian Gerst
2003-07-15 17:43 ` Jamie Lokier [this message]
2003-07-15 17:59 ` Luciano Miguel Ferreira Rocha
2003-07-15 18:24 ` Brian Gerst
2003-07-15 18:44 ` Alan Cox
2003-07-15 19:44 ` Jamie Lokier
2003-07-20 21:04 ` Riley Williams
2003-07-20 22:25 ` Jeremy Fitzhardinge
[not found] <Pine.LNX.4.53.0307141833190.4354@chaos>
2003-07-15 16:52 ` Kathy Frazier
2003-07-14 21:35 Kathy Frazier
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=20030715174337.GC1491@mail.jlokier.co.uk \
--to=jamie@shareable.org \
--cc=ak@muc.de \
--cc=bgerst@didntduck.org \
--cc=kfrazier@mdc-dayton.com \
--cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).