From: Nicholas Piggin <npiggin@gmail.com> Date: 2022-07-11 03:16:08
The wait instruction has a different encoding between BookE and BookS.
Add the BookS variant.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/include/asm/ppc-opcode.h | 3 +++
1 file changed, 3 insertions(+)
From: Nicholas Piggin <npiggin@gmail.com> Date: 2022-07-11 03:16:44
We want to move away from using SMT prioroty updates for cpu_relax, and
use a 'wait' instruction which is similar to x86. As well as being a
much better fit for what everybody else uses and tests with, priority
nops are stateful which is nasty (interrupts have to consider they might
be taken at a different priority), and they're expensive to execute,
similar to a mtSPR which can effect other threads in the pipe.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Unfortunately qemu TCG does not emulate pause_short properly and will
cause hangs. I have a patch for it but not merged yet. But if we tune
qspinlock code it would be best to do it with this patch.
---
arch/powerpc/include/asm/processor.h | 30 +++++++++++++++++++----
arch/powerpc/include/asm/vdso/processor.h | 10 +++++++-
2 files changed, 34 insertions(+), 6 deletions(-)
The embedded extensions are no longer part of the PowerPC architecture,
so wouldn't it be a better way forward to rename the existing one,
instead? A bit more work now, but less in the future :-)
Segher
The embedded extensions are no longer part of the PowerPC architecture,
so wouldn't it be a better way forward to rename the existing one,
instead? A bit more work now, but less in the future :-)
And I actually misremembered this too, was off digging and asking
about it, but the change isn't strictly BookE vs BookS, but rather
the wait opcode was changed in ISA v3.0, which is a bit of an
unfortunate landmine.
It seems apparently POWER8 implemented a non-architected instruction
'waitasec' that uses this opcode, then I suppose it was decided to
continue with that opcode in v3.0 when BookE was dropped, for reasons.
Maybe it was more widely used?
In any case, I will rename it. Precedent is divided. We have
PPC_RAW_TLBIEL_v205 for older tlbiel, and PPC_ISA_3_0_INVALIDATE_ERAT
for a new ERAT invalidation instruction. I guess making the older
instruction the exceptional case ends up being better in the long
term.
Thanks,
Nick
On Wed, Jul 20, 2022 at 07:54:54PM +1000, Nicholas Piggin wrote:
Excerpts from Segher Boessenkool's message of July 13, 2022 2:29 am:
quoted
The embedded extensions are no longer part of the PowerPC architecture,
so wouldn't it be a better way forward to rename the existing one,
instead? A bit more work now, but less in the future :-)
And I actually misremembered this too, was off digging and asking
about it, but the change isn't strictly BookE vs BookS, but rather
the wait opcode was changed in ISA v3.0, which is a bit of an
unfortunate landmine.
The current wait opcode is *new* in 3.0, but it has the same mnemonic
as the old one, more formally.
It seems apparently POWER8 implemented a non-architected instruction
'waitasec' that uses this opcode, then I suppose it was decided to
continue with that opcode in v3.0 when BookE was dropped, for reasons.
The (newer) wait instruction is 0/30 while the old one is 1/30
(secondary opcodes 30 resp. 62), although 0/30 stayed open; maybe there
is more history there already? Curious.
In any case, I will rename it. Precedent is divided. We have
PPC_RAW_TLBIEL_v205 for older tlbiel, and PPC_ISA_3_0_INVALIDATE_ERAT
for a new ERAT invalidation instruction. I guess making the older
instruction the exceptional case ends up being better in the long
term.
Yeah exactly, it's better if the simpler name is the one that newer
code should use: more readable, more writable, and importantly less
room for mistakes :-)
Thanks,
Segher