All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Rich Felker <dalias@libc.org>
Cc: Andy Lutomirski <luto@kernel.org>,
	Linux MIPS Mailing List <linux-mips@linux-mips.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Paul Burton <paul.burton@imgtec.com>,
	David Daney <david.daney@cavium.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	Paul Burton <paul.burton@mips.com>,
	James Hogan <jhogan@kernel.org>
Subject: Re: Fixing MIPS delay slot emulation weakness?
Date: Mon, 17 Dec 2018 01:55:28 +0000 (GMT)	[thread overview]
Message-ID: <alpine.LFD.2.21.1812170106120.11202@eddie.linux-mips.org> (raw)
In-Reply-To: <20181217005915.GH23599@brightrain.aerifal.cx>

On Sun, 16 Dec 2018, Rich Felker wrote:

> So in theory it's possible that there's a cpu model with fancy new
> core instructions but no fpu. In this case, you would need the
> capability to emulate or execute-out-of-line these instructions. But I
> have no idea if such cpu models actually exist. If not, the concern
> can probably be ignored and it suffices to emulate just the parts of
> the base ISA that are valid in delay slots.

 What do you call "a cpu model with fancy new core instructions"?

 We've gone through 4 legacy MIPS base ISA revisions (I to IV) and then 4 
modern ones that matter (R1 to R5; R4 was left out and R6 actually does 
not have FPU branch delay slots), plus a bunch of ASEs (Application 
Specific Extensions), such as DSP, MDMX, MIPS-3D, MSA, etc., each defining 
further instructions.  And then the microMIPS R3 and R5 ISAs (R6 uses a 
different instruction encoding and does not have delay slots at all).  
The MIPS16 ISA does not count however, even though it has delay slots and 
we support it, because it does not have FPU instructions, let alone ones 
that require delay slot emulation.

 Some of the ASEs do not matter, e.g. we don't support MDMX in Linux as it 
has user state we don't handle with context switches, and MIPS-3D and MSA 
both imply an FPU, so software making use of them won't run with our FPU 
emulation anyway as these ASEs' instructions are not emulated.  Anything 
else is potentially required.

 As to actual implementations I believe all the Cavium Octeon line CPUs 
(David, please correct me if I am wrong) have no FPU and they have vendor 
extensions beyond the base ISA + ASE instruction set.  Arguably you could 
say that their additional instructions should not be scheduled into FPU 
branch delay slots then, however the toolchain will happily do that, as I 
wrote before.

 I don't fully remember what the situation is WRT NetLogic/Broadcom XLR 
and XLP chips.  They do have vendor extensions, though IIRC they do have 
an FPU too.

 But then we have the "nofpu" kernel parameter anyway, which forces FPU 
emulation for any hardware, so we need to emulate delay slots in that mode 
with any hardware.

 I'm afraid the problem is complex to solve overall, which is why we still 
have issues, 18 years on from the inclusion of the FPU emulator:

commit 4c55adaa6d06e5533aebaceea7640ecf10952231
Author: Ralf Baechle <ralf@linux-mips.org>
Date:   Sat Nov 25 04:49:46 2000 +0000

    Kernel FPU emulator, chain saw edition.

(in the LMO GIT repo) and I think actually running the delay-slot 
instruction (with a possible exception for things like ADDIUPC) rather 
than interpreting it is the only feasible solution.

 I'm not involved with MIPS architecture development anymore though and at 
this point I only care about the few legacy platforms I have been taking 
care of since forever, such as the DECstation port, for which our current 
emulation solution suffices, so I am not going to commit myself to making 
any inventions in this area.  I hope my input is valuable though and will 
help someone working on this.

  Maciej

  reply	other threads:[~2018-12-17  1:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-15 19:19 Fixing MIPS delay slot emulation weakness? Andy Lutomirski
2018-12-15 21:26 ` Paul Burton
2018-12-16 18:11   ` Rich Felker
2018-12-16 18:55   ` Andy Lutomirski
2018-12-15 22:50 ` Rich Felker
2018-12-16  2:15   ` Maciej W. Rozycki
2018-12-16  2:32     ` Rich Felker
2018-12-16 13:50       ` Maciej W. Rozycki
2018-12-16 18:13         ` Rich Felker
2018-12-16 18:59           ` Andy Lutomirski
2018-12-16 19:45             ` Maciej W. Rozycki
2018-12-17  0:59             ` Rich Felker
2018-12-17  1:55               ` Maciej W. Rozycki [this message]
2018-12-18  1:13                 ` Aaro Koskinen
2018-12-19  4:32 ` Paul Burton
2018-12-19 21:12   ` Hugh Dickins
2018-12-20 17:56     ` Paul Burton
2018-12-20 17:45 ` [PATCH] MIPS: math-emu: Write-protect delay slot emulation pages Paul Burton
     [not found]   ` <20181220192616.42976218FE@mail.kernel.org>
2018-12-21 21:16     ` Paul Burton
2018-12-22 19:16       ` Sasha Levin
2018-12-23 16:16   ` Paul Burton

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=alpine.LFD.2.21.1812170106120.11202@eddie.linux-mips.org \
    --to=macro@linux-mips.org \
    --cc=dalias@libc.org \
    --cc=david.daney@cavium.com \
    --cc=jhogan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=luto@kernel.org \
    --cc=paul.burton@imgtec.com \
    --cc=paul.burton@mips.com \
    --cc=ralf@linux-mips.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.