From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] arm: vfp: Raising SIGFPE on invalid floating point operation
Date: Fri, 3 Feb 2012 14:06:21 +0000 [thread overview]
Message-ID: <20120203140621.GK889@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20267.57822.537801.969721@pilspetsen.it.uu.se>
On Fri, Feb 03, 2012 at 02:32:14PM +0100, Mikael Pettersson wrote:
> No, a SIGFPE delivered at the wrong point in time with the wrong
> context in its sigframe is MUCH worse than not getting a SIGFPE
> at all. (And likewise for all other trap signals, SEGV, ILL, etc.)
If your FP is pipelined, then you won't get a SIGFPE for a div0 situation
as soon as the instruction appears in the program. Think about what's
happening.
1. The FP hardware may be occupied with a computation.
2. The program issues the divide instruction, the FP hardware accepts
this. Meanwhile, the integer part of the core continues processing
instructions.
3. The FP hardware completes its computation, and gets to execute the
divide instruction.
4. The FP hardware discovers a divide-by-zero situation, and flags it
in its status register.
At this point, there's no way for the FP hardware to flag that situation
to the integer core (there's no interrupt.) The failure gets flagged
when the program executes the next FP instruction, and is raised by the
FP hardware refusing to accept that instruction with an exception status.
The kernel can't back-track the execution path to find out where the
divide instruction was, and the hardware doesn't tell you what address
the instruction was (the FP hardware effectively just gets to listen to
the integer core's instruction stream when the integer core sees a
'co-processor' instruction.)
The only way FP would be able to abort a divide-by-zero immediately is
if it halted the integer core while it started the divide operation,
preventing it from running integer computations in parallel with the FP
hardware.
WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Mikael Pettersson <mikpe@it.uu.se>
Cc: Kautuk Consul <consul.kautuk@gmail.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
"Mohd. Faris" <mohdfarisq2010@gmail.com>
Subject: Re: [PATCH 1/1] arm: vfp: Raising SIGFPE on invalid floating point operation
Date: Fri, 3 Feb 2012 14:06:21 +0000 [thread overview]
Message-ID: <20120203140621.GK889@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20267.57822.537801.969721@pilspetsen.it.uu.se>
On Fri, Feb 03, 2012 at 02:32:14PM +0100, Mikael Pettersson wrote:
> No, a SIGFPE delivered at the wrong point in time with the wrong
> context in its sigframe is MUCH worse than not getting a SIGFPE
> at all. (And likewise for all other trap signals, SEGV, ILL, etc.)
If your FP is pipelined, then you won't get a SIGFPE for a div0 situation
as soon as the instruction appears in the program. Think about what's
happening.
1. The FP hardware may be occupied with a computation.
2. The program issues the divide instruction, the FP hardware accepts
this. Meanwhile, the integer part of the core continues processing
instructions.
3. The FP hardware completes its computation, and gets to execute the
divide instruction.
4. The FP hardware discovers a divide-by-zero situation, and flags it
in its status register.
At this point, there's no way for the FP hardware to flag that situation
to the integer core (there's no interrupt.) The failure gets flagged
when the program executes the next FP instruction, and is raised by the
FP hardware refusing to accept that instruction with an exception status.
The kernel can't back-track the execution path to find out where the
divide instruction was, and the hardware doesn't tell you what address
the instruction was (the FP hardware effectively just gets to listen to
the integer core's instruction stream when the integer core sees a
'co-processor' instruction.)
The only way FP would be able to abort a divide-by-zero immediately is
if it halted the integer core while it started the divide operation,
preventing it from running integer computations in parallel with the FP
hardware.
next prev parent reply other threads:[~2012-02-03 14:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-03 8:36 [PATCH 1/1] arm: vfp: Raising SIGFPE on invalid floating point operation Kautuk Consul
2012-02-03 8:36 ` Kautuk Consul
2012-02-03 13:27 ` Dave Martin
2012-02-03 13:27 ` Dave Martin
2012-02-03 14:37 ` Kautuk Consul
2012-02-03 14:37 ` Kautuk Consul
2012-02-03 15:11 ` Russell King - ARM Linux
2012-02-03 15:11 ` Russell King - ARM Linux
2012-02-03 14:45 ` Mikael Pettersson
2012-02-03 14:45 ` Mikael Pettersson
2012-02-03 13:32 ` Mikael Pettersson
2012-02-03 13:32 ` Mikael Pettersson
2012-02-03 14:06 ` Russell King - ARM Linux [this message]
2012-02-03 14:06 ` Russell King - ARM Linux
2012-02-03 14:41 ` Mikael Pettersson
2012-02-03 14:41 ` Mikael Pettersson
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=20120203140621.GK889@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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 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.