Ralf Baechle wrote:
> On Thu, Aug 16, 2001 at 12:56:52PM +0900, Atsushi Nemoto wrote:
>
> > >>>>> On Mon, 13 Aug 2001 10:34:46 -0700 (PDT), Wayne Gowcher
> > >>>>> <wgowcher@yahoo.com> said:
> > wgowcher> a 23 % reduction in the Floating Point Index benchmark
> >
> > Current CVS kernel uses FPU emulator unconditionally. If one floating
> > point intruction causes a 'Unimplemented' exception (denormalized
> > result, etc.) following floating point instructions are also handle by
> > FPU emulator (not only the instruction which raise the exception).
> >
> > I do not know this is really desired behavior, but here is a patch to
> > change this. If Unimplemented exception had been occured during the
> > benchmark, aplying this patch may result better performance.
>
> This is a know problem with the emulator. It may be used to keep the
> emulator in kernel for a long time or even maliciously to keep the
> CPU in the kernel for an unbounded time.
>
> Here's my suggested fix:
>
> Index: arch/mips/math-emu/cp1emu.c
> ===================================================================
> RCS file: /home/pub/cvs/linux/arch/mips/math-emu/cp1emu.c,v
> retrieving revision 1.7
> diff -u -r1.7 cp1emu.c
> --- arch/mips/math-emu/cp1emu.c 2001/08/02 21:55:26 1.7
> +++ arch/mips/math-emu/cp1emu.c 2001/08/16 09:06:55
> @@ -1672,6 +1672,9 @@
>
> oldepc = xcp->cp0_epc;
> do {
> + if (current->need_resched)
> + break;
> +
> prevepc = xcp->cp0_epc;
> insn = mips_get_word(xcp, REG_TO_VA(xcp->cp0_epc), &err);
> if (err) {
>
> Ralf
What is probably needed too, but I still think we need the check for real FPU,
so we only
emulate one instruction at a time, if we got a real FPU.
--
_ _ ____ ___ Carsten Langgaard Mailto:carstenl@mips.com
|\ /|||___)(___ MIPS Denmark Direct: +45 4486 5527
| \/ ||| ____) Lautrupvang 4B Switch: +45 4486 5555
TECHNOLOGIES 2750 Ballerup Fax...: +45 4486 5556
Denmark http://www.mips.com
|