public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
To: Peter Bergner <bergner@linux.ibm.com>
Cc: Dmitry Selyutin <ghostmansd@gmail.com>,
	Alan Modra <amodra@gmail.com>,
	binutils@sourceware.org,  Paul Mackerras <paulus@ozlabs.org>,
	Alain Williams <addw@phcomp.co.uk>
Subject: Re: Plugin-based opcode table
Date: Sun, 29 May 2022 10:13:06 +0100	[thread overview]
Message-ID: <CAPweEDyv4T8S7m+1KjJcX8nE9EkyL_HhLAYjLoDyTDkpHXAeqQ@mail.gmail.com> (raw)
In-Reply-To: <17f6beb2-db1a-0bec-b022-168373c3921b@linux.ibm.com>

On Sun, May 29, 2022 at 3:30 AM Peter Bergner <bergner@linux.ibm.com> wrote:

> I'm just catching up on my email backlog after being on vacation last
> week,

nice. i mean the vacation :)

> but I agree with everything Alan said and also agree with how
> you're going about things.

appreciated the reassurance.  i'm not going to get over being
nervous about adding to EXT01 (25% of v3.1 prefix space),
and to EXT019, 005 and 004, before all these have been
approved by the OPF ISA Working Group.

certainly, the 005 and 022 (sandbox) opcodes will *not* be
permanently in the places we'll initially submit them in.  004 we can
make a good case for madded and divmod2du [0] staying where
proposed.

still, the good news is that people can go "oh, er, so that's what
the Libre-SOC team plans to propose to add to Power ISA,
i didn't quite have time to work it out before".

> That said, I assume your -mlibresoc flag enables more than just the
> PPC_OPCODE_SVP64 flag, since there is a lot of "base" POWER instructions
> like addi, etc. that I'm sure your cpu implements.

yes, we aim for the SFFS (Scalar Fixed Floating Point Subset) subset,
described right at the very beginning of the Power ISA Spec (page viii)
and have confirmed with Mendy that it's fine to add whatever you like:
we therefore choose to add BE, AMO, TLBIE and a RADIX MMU in
order to run scalar Linux. following microwatt, basically [1]

keenly aware that a corresponding revival of runtime capability detection
is needed in glibc6 there (removed a few years ago because noone was
using it, because there was only POWER8/POWER9) but one step at
a time.

> If for some reason,
> one of those "base" instructions enabled by -mlibresoc isn't implemented
> by your cpu or conflicts in some way with your new instructions, you
> can add the PPC_OPCODE_SVP64 to the deprecated field for the problematic
> instruction to disable it when using -mlibresoc.

fortunately as an entirely from-scratch design with a focus on mass-volume
general-purpose compute we have no legacy instructions to support.

> For example, POWER9 uses all the flags POWER8 enables plus PPC_OPCODE_POWER9.
> However, the "lxvx" instruction changed between POWER8 (where it was an
> extended mnemonic for lxvd2x) and POWER9 where is became a real instruction
> with a different opcode than lxvd2x (I'm ignoring that doing that was
> a very bad idea!).

yowser that would have been painful. and a costly mistake that won't go
away for at least another decade [i'm aware that IBM still gets 3rd parties
asking to license POWER8, *for new designs*]

>  How that was solved, was adding PPC_OPCODE_POWER9
> to the old lxvx instruction's deprecated field to disable that on POWER9
> and later cpus.  POWER9 and later cpus get the new lxvx instruction,
> because we enable it with the PPC_OPCODE_POWER9.

ok. so this is good to know, because you know what it costs to have to
support a conflicting opcode, long-term.

now imagine that a binary program needs *both* the old *and* the
new behaviour of lxvx, in the same binary - in public usage. part
of upstream binutils, part of upstream glibc6, and so on.

a solution here is to set the PCR bit that flips back to POWER8
compatibility. if that's protected it would be necessary to have a
kernel syscall call to flip back and forth. performance would
suck, but at least runtime binary compatibility would be achieved
and people don't scream [except to hoot somewhat in derision
at such a terrible hack, but hey].

now imagine - even worse - that there's no PCR register bit that
can be deployed to flip back and forth between POWER8 and POWER9
compatiblity.

now imagine that this happens on two or more high-profile public uses of
the Sandbox (EXT022).  the spec said it was "perfectly ok". page xii

    "Facilities described in proposals that are not adopted
    into the architecture may be implemented as Custom Extensions
    using the architecture sandbox"

this is the nightmare scenario that i'd like to see avoided [understatement]

we've another meeting coming up, wed 01jun2022, i have an idea to
put in a proposal for some "pre-reservations" of opcode space as ISA
RFCs. my biggest concern is that there's no two-way communications
path to the IBM Engineers submitting instructions for future IBM
POWER 11/12 designs. we have no idea - at all - whether there's
already a conflict.

l.

[0] https://libre-soc.org/openpower/sv/biginteger/
[1] https://shenki.github.io/boot-linux-on-microwatt/

  reply	other threads:[~2022-05-29  9:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17 12:37 Dmitry Selyutin
2022-05-17 14:01 ` lkcl
2022-05-23 12:59   ` Alan Modra
2022-05-23 13:06     ` Dmitry Selyutin
2022-05-24  5:41       ` Alan Modra
2022-05-24 22:11         ` Dmitry Selyutin
2022-05-29  2:30       ` Peter Bergner
2022-05-29  9:13         ` Luke Kenneth Casson Leighton [this message]
2022-05-30 23:55           ` Paul Mackerras
2022-05-31  4:06             ` lkcl

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=CAPweEDyv4T8S7m+1KjJcX8nE9EkyL_HhLAYjLoDyTDkpHXAeqQ@mail.gmail.com \
    --to=lkcl@lkcl.net \
    --cc=addw@phcomp.co.uk \
    --cc=amodra@gmail.com \
    --cc=bergner@linux.ibm.com \
    --cc=binutils@sourceware.org \
    --cc=ghostmansd@gmail.com \
    --cc=paulus@ozlabs.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 read-only IMAP folder(s) and NNTP newsgroup(s).