[GIT PULL] Please pull powerpc/linux.git powerpc-5.14-3 tag

2021-07-25 Thread Michael Ellerman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi Linus, Please pull some more powerpc fixes for 5.14: The following changes since commit e73f0f0ee7541171d89f2e2491130c7771ba58d3: Linux 5.14-rc1 (2021-07-11 15:07:40 -0700) are available in the git repository at: https://git.kernel.org/pu

[PATCH] powerpc/xmon: use ARRAY_SIZE

2021-07-25 Thread Jason Wang
The ARRAY_SIZE is the macro definition of sizeof(a)/sizeof(a[0]) and it is more compact and formal to get a array size. Signed-off-by: Jason Wang --- arch/powerpc/xmon/ppc-opc.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/po

Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.14-3 tag

2021-07-25 Thread pr-tracker-bot
The pull request you sent on Mon, 26 Jul 2021 00:20:47 +1000: > https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git > tags/powerpc-5.14-3 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/3c0ce1497a449b0d150b455628947152c5f6216a Thank you! -- Deet-doot-d

Re: [PATCH v4 04/10] net/ps3_gelic: Add new macro BUG_ON_DEBUG

2021-07-25 Thread Christophe Leroy
Geoff Levand a écrit : Add a new preprocessor macro BUG_ON_DEBUG, that expands to BUG_ON when the preprocessor macro DEBUG is defined, or to WARN_ON when DEBUG is not defined. Also, replace all occurrences of BUG_ON with BUG_ON_DEBUG. Why is BUG_ON() needed at all if WARN_ON() is enough ? Y

Re: [PATCH v4 08/10] net/ps3_gelic: Rename no to descr_count

2021-07-25 Thread Christophe Leroy
Geoff Levand a écrit : In an effort to make the PS3 gelic driver easier to maintain, rename the gelic_card_init_chain parameter 'no' to 'descr_count'. Not sure you really need a so long name. 'count' should be good enough. Read https://www.kernel.org/doc/html/latest/process/coding-style.html

Re: [PATCH v4 09/10] net/ps3_gelic: Add new routine gelic_work_to_card

2021-07-25 Thread Christophe Leroy
Geoff Levand a écrit : Add new helper routine gelic_work_to_card that converts a work_struct to a gelic_card. Adding a function is it really needed as it is used only once ? Christophe Signed-off-by: Geoff Levand --- drivers/net/ethernet/toshiba/ps3_gelic_net.c | 8 ++-- 1 file chan

Re: [PATCH v4 10/10] net/ps3_gelic: Fix DMA mapping problems

2021-07-25 Thread Christophe Leroy
Geoff Levand a écrit : Fixes several DMA mapping problems with the PS3's gelic network driver: * Change from checking the return value of dma_map_single to using the dma_mapping_error routine. * Use the correct buffer length when mapping the RX skb. * Improved error checking and debug lo

Re: [PATCH v4 1/2] KVM: PPC: Book3S HV: Sanitise vcpu registers in nested path

2021-07-25 Thread Nicholas Piggin
Excerpts from Fabiano Rosas's message of July 23, 2021 8:12 am: > As one of the arguments of the H_ENTER_NESTED hypercall, the nested > hypervisor (L1) prepares a structure containing the values of various > hypervisor-privileged registers with which it wants the nested guest > (L2) to run. Since t

[powerpc:fixes-test] BUILD SUCCESS d9c57d3ed52a92536f5fa59dc5ccdd58b4875076

2021-07-25 Thread kernel test robot
allyesconfig i386 randconfig-c001-20210725 i386 randconfig-c001-20210726 arm pxa_defconfig armspear6xx_defconfig mips mtx1_defconfig powerpc cm5200_defconfig

[powerpc:merge] BUILD SUCCESS e4277861b65960a264040663ac44c0b946ab402b

2021-07-25 Thread kernel test robot
config arm allmodconfig i386 randconfig-c001-20210725 i386 randconfig-c001-20210726 m68k hp300_defconfig sh kfr2r09_defconfig m68k sun3x_defconfig armmvebu_v7_defconf

Re: [PATCH v5 1/6] powerpc/pseries: rename min_common_depth to primary_domain_index

2021-07-25 Thread David Gibson
On Thu, Jul 22, 2021 at 10:47:49AM +0530, Aneesh Kumar K.V wrote: > On 7/22/21 8:06 AM, David Gibson wrote: > > On Thu, Jul 22, 2021 at 11:59:15AM +1000, David Gibson wrote: > > > On Mon, Jun 28, 2021 at 08:41:12PM +0530, Aneesh Kumar K.V wrote: > > > > No functional change in this patch. > > > >

Re: [PATCH v5 5/6] powerpc/pseries: Add a helper for form1 cpu distance

2021-07-25 Thread David Gibson
On Thu, Jul 22, 2021 at 12:39:27PM +0530, Aneesh Kumar K.V wrote: > David Gibson writes: > > > On Mon, Jun 28, 2021 at 08:41:16PM +0530, Aneesh Kumar K.V wrote: > >> This helper is only used with the dispatch trace log collection. > >> A later patch will add Form2 affinity support and this change

Re: [PATCH v5 4/6] powerpc/pseries: Consolidate different NUMA distance update code paths

2021-07-25 Thread David Gibson
On Thu, Jul 22, 2021 at 12:37:46PM +0530, Aneesh Kumar K.V wrote: > David Gibson writes: > > > On Mon, Jun 28, 2021 at 08:41:15PM +0530, Aneesh Kumar K.V wrote: > >> The associativity details of the newly added resourced are collected from > >> the hypervisor via "ibm,configure-connector" rtas ca

Re: [PATCH v5 6/6] powerpc/pseries: Add support for FORM2 associativity

2021-07-25 Thread David Gibson
On Thu, Jul 22, 2021 at 01:04:42PM +0530, Aneesh Kumar K.V wrote: > David Gibson writes: > > > On Mon, Jun 28, 2021 at 08:41:17PM +0530, Aneesh Kumar K.V wrote: > >> PAPR interface currently supports two different ways of communicating > >> resource > >> grouping details to the OS. These are ref

[PATCH 1/2] powerpc/64s: POWER9 DD2.3 CPU feature flag fixes

2021-07-25 Thread Nicholas Piggin
DD2.3 missed out on getting its feature flag bits. This meant when booting with dt-cpu-ftrs, CPU_FTR_P9_TM_HV_ASSIST is missing (unless the firmware contains it, which mine does not seem to). And when booting without, CPU_FTR_P9_TM_XER_SO_BUG is set. In practice this doesn't make any difference t

[PATCH 2/2] powerpc/64s: Rename CPU_FTR_POWER9_DD2_1 to CPU_FTR_P9_STOP_FIXED

2021-07-25 Thread Nicholas Piggin
CPU feature flags work best when they are named for behaviour, not for the CPU variant that first introduced them. Later revisions might also contain the behaviour, for example. It's confusing for a POWER9 DD2.2 to have CPU_FTR_POWER9_DD2_1, but it's not confusing if DD2.1 and DD2.2 both have CPU_F

[PATCH v1 00/55] KVM: PPC: Book3S HV P9: entry/exit optimisations

2021-07-25 Thread Nicholas Piggin
This reduces radix guest full entry/exit latency on POWER9 and POWER10 by almost 2x. Nested HV guests should see smaller improvements in their L1 entry/exit, but this is also combined with most L0 speedups also applying to nested entry. nginx localhost throughput test in a SMP nested guest is impr

[PATCH v1 01/55] KVM: PPC: Book3S HV: Remove TM emulation from POWER7/8 path

2021-07-25 Thread Nicholas Piggin
TM fake-suspend emulation is only used by POWER9. Remove it from the old code path. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 42 - 1 file changed, 42 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm

[PATCH v1 02/55] KVM: PPC: Book3S HV P9: Fixes for TM softpatch interrupt

2021-07-25 Thread Nicholas Piggin
The softpatch interrupt sets HSRR0 to the faulting instruction +4, so it should subtract 4 for the faulting instruction address. Also have it emulate and deliver HFAC interrupts correctly, which is important for nested HV and facility demand-faulting in future. Signed-off-by: Nicholas Piggin ---

[PATCH v1 03/55] KVM: PPC: Book3S HV: Sanitise vcpu registers in nested path

2021-07-25 Thread Nicholas Piggin
From: Fabiano Rosas As one of the arguments of the H_ENTER_NESTED hypercall, the nested hypervisor (L1) prepares a structure containing the values of various hypervisor-privileged registers with which it wants the nested guest (L2) to run. Since the nested HV runs in supervisor mode it needs the

[PATCH v1 04/55] KVM: PPC: Book3S HV: Stop forwarding all HFUs to L1

2021-07-25 Thread Nicholas Piggin
From: Fabiano Rosas If the nested hypervisor has no access to a facility because it has been disabled by the host, it should also not be able to see the Hypervisor Facility Unavailable that arises from one of its guests trying to access the facility. This patch turns a HFU that happened in L2 in

[PATCH v1 05/55] KVM: PPC: Book3S HV Nested: Reflect guest PMU in-use to L0 when guest SPRs are live

2021-07-25 Thread Nicholas Piggin
After the L1 saves its PMU SPRs but before loading the L2's PMU SPRs, switch the pmcregs_in_use field in the L1 lppaca to the value advertised by the L2 in its VPA. On the way out of the L2, set it back after saving the L2 PMU registers (if they were in-use). This transfers the PMU liveness indica

[PATCH v1 06/55] powerpc/64s: Remove WORT SPR from POWER9/10

2021-07-25 Thread Nicholas Piggin
This register is not architected and not implemented in POWER9 or 10, it just reads back zeroes for compatibility. -78 cycles (9255) cycles POWER9 virt-mode NULL hcall Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 3 --- arch/powerpc/plat

[PATCH v1 07/55] KMV: PPC: Book3S HV P9: Use set_dec to set decrementer to host

2021-07-25 Thread Nicholas Piggin
The host Linux timer code arms the decrementer with the value 'decrementers_next_tb - current_tb' using set_dec(), which stores val - 1 on Book3S-64, which is not quite the same as what KVM does to re-arm the host decrementer when exiting the guest. This shouldn't be a significant change, but it m

[PATCH v1 08/55] KVM: PPC: Book3S HV P9: Use host timer accounting to avoid decrementer read

2021-07-25 Thread Nicholas Piggin
There is no need to save away the host DEC value, as it is derived from the host timer subsystem which maintains the next timer time, so it can be restored from there. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/time.h | 5 + arch/powerpc/kernel/time.c | 1 + arch/powe

[PATCH v1 09/55] KVM: PPC: Book3S HV P9: Use large decrementer for HDEC

2021-07-25 Thread Nicholas Piggin
On processors that don't suppress the HDEC exceptions when LPCR[HDICE]=0, this could help reduce needless guest exits due to leftover exceptions on entering the guest. Reviewed-by: Alexey Kardashevskiy Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/time.h | 2 ++ arch/powerpc

[PATCH v1 10/55] KVM: PPC: Book3S HV P9: Reduce mftb per guest entry/exit

2021-07-25 Thread Nicholas Piggin
mftb is serialising (dispatch next-to-complete) so it is heavy weight for a mfspr. Avoid reading it multiple times in the entry or exit paths. A small number of cycles delay to timers is tolerable. -118 cycles (9137) POWER9 virt-mode NULL hcall Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas

[PATCH v1 11/55] powerpc/time: add API for KVM to re-arm the host timer/decrementer

2021-07-25 Thread Nicholas Piggin
Rather than have KVM look up the host timer and fiddle with the irq-work internal details, have the powerpc/time.c code provide a function for KVM to re-arm the Linux timer code when exiting a guest. This is implementation has an improvement over existing code of marking a decrementer interrupt as

[PATCH v1 12/55] KVM: PPC: Book3S HV: POWER10 enable HAIL when running radix guests

2021-07-25 Thread Nicholas Piggin
HV interrupts may be taken with the MMU enabled when radix guests are running. Enable LPCR[HAIL] on ISA v3.1 processors for radix guests. Make this depend on the host LPCR[HAIL] being enabled. Currently that is always enabled, but having this test means any issue that might require LPCR[HAIL] to be

[PATCH v1 13/55] powerpc/64s: Keep AMOR SPR a constant ~0 at runtime

2021-07-25 Thread Nicholas Piggin
This register controls supervisor SPR modifications, and as such is only relevant for KVM. KVM always sets AMOR to ~0 on guest entry, and never restores it coming back out to the host, so it can be kept constant and avoid the mtSPR in KVM guest entry. -21 cycles (9116) cycles POWER9 virt-mode NULL

[PATCH v1 14/55] KVM: PPC: Book3S HV: Don't always save PMU for guest capable of nesting

2021-07-25 Thread Nicholas Piggin
Revert the workaround added by commit 63279eeb7f93a ("KVM: PPC: Book3S HV: Always save guest pmu for guest capable of nesting"). Nested capable guests running with the earlier commit ("KVM: PPC: Book3S HV Nested: Indicate guest PMU in-use in VPA") will now indicate the PMU in-use status of their g

[PATCH v1 15/55] powerpc/64s: Always set PMU control registers to frozen/disabled when not in use

2021-07-25 Thread Nicholas Piggin
KVM PMU management code looks for particular frozen/disabled bits in the PMU registers so it knows whether it must clear them when coming out of a guest or not. Setting this up helps KVM make these optimisations without getting confused. Longer term the better approach might be to move guest/host P

[PATCH v1 16/55] powerpc/64s: Implement PMU override command line option

2021-07-25 Thread Nicholas Piggin
It can be useful in simulators (with very constrained environments) to allow some PMCs to run from boot so they can be sampled directly by a test harness, rather than having to run perf. A previous change freezes counters at boot by default, so provide a boot time option to un-freeze (plus a bit m

[PATCH v1 17/55] KVM: PPC: Book3S HV P9: Implement PMU save/restore in C

2021-07-25 Thread Nicholas Piggin
Implement the P9 path PMU save/restore code in C, and remove the POWER9/10 code from the P7/8 path assembly. -449 cycles (8533) POWER9 virt-mode NULL hcall Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/asm-prototypes.h | 5 - arch/powerpc/kvm/book3s_hv.c | 205 +

[PATCH v1 18/55] KVM: PPC: Book3S HV P9: Factor PMU save/load into context switch functions

2021-07-25 Thread Nicholas Piggin
Rather than guest/host save/retsore functions, implement context switch functions that take care of details like the VPA update for nested. The reason to split these kind of helpers into explicit save/load functions is mainly to schedule SPR access nicely, but PMU is a special case where the load

[PATCH v1 19/55] KVM: PPC: Book3S HV P9: Demand fault PMU SPRs when marked not inuse

2021-07-25 Thread Nicholas Piggin
The pmcregs_in_use field in the guest VPA can not be trusted to reflect what the guest is doing with PMU SPRs, so the PMU must always be managed (stopped) when exiting the guest, and SPR values set when entering the guest to ensure it can't cause a covert channel or otherwise cause other guests or

[PATCH v1 20/55] KVM: PPC: Book3S HV P9: Factor out yield_count increment

2021-07-25 Thread Nicholas Piggin
Factor duplicated code into a helper function. Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c in

[PATCH v1 21/55] KVM: PPC: Book3S HV: CTRL SPR does not require read-modify-write

2021-07-25 Thread Nicholas Piggin
Processors that support KVM HV do not require read-modify-write of the CTRL SPR to set/clear their thread's runlatch. Just write 1 or 0 to it. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c| 2 +- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 15 ++- 2 files

[PATCH v1 22/55] KVM: PPC: Book3S HV P9: Move SPRG restore to restore_p9_host_os_sprs

2021-07-25 Thread Nicholas Piggin
Move the SPR update into its relevant helper function. This will help with SPR scheduling improvements in later changes. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/pow

[PATCH v1 23/55] KVM: PPC: Book3S HV P9: Reduce mtmsrd instructions required to save host SPRs

2021-07-25 Thread Nicholas Piggin
This reduces the number of mtmsrd required to enable facility bits when saving/restoring registers, by having the KVM code set all bits up front rather than using individual facility functions that set their particular MSR bits. -42 cycles (7803) POWER9 virt-mode NULL hcall Signed-off-by: Nichola

[PATCH v1 24/55] KVM: PPC: Book3S HV P9: Improve mtmsrd scheduling by delaying MSR[EE] disable

2021-07-25 Thread Nicholas Piggin
Moving the mtmsrd after the host SPRs are saved and before the guest SPRs start to be loaded can prevent an SPR scoreboard stall (because the mtmsrd is L=1 type which does not cause context synchronisation. This is also now more convenient to combined with the mtmsrd L=0 instruction to enable faci

[PATCH v1 25/55] KVM: PPC: Book3S HV P9: Add kvmppc_stop_thread to match kvmppc_start_thread

2021-07-25 Thread Nicholas Piggin
Small cleanup makes it a bit easier to match up entry and exit operations. Reviewed-by: Fabiano Rosas Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/b

[PATCH v1 26/55] KVM: PPC: Book3S HV: Change dec_expires to be relative to guest timebase

2021-07-25 Thread Nicholas Piggin
Change dec_expires to be relative to the guest timebase, and allow it to be moved into low level P9 guest entry functions, to improve SPR access scheduling. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_book3s.h | 6 +++ arch/powerpc/include/asm/kvm_host.h | 2 +- arch/

[PATCH v1 27/55] KVM: PPC: Book3S HV P9: Move TB updates

2021-07-25 Thread Nicholas Piggin
Move the TB updates between saving and loading guest and host SPRs, to improve scheduling by keeping issue-NTC operations together as much as possible. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_p9_entry.c | 36 +-- 1 file changed, 18 insertions(+), 18

[PATCH v1 28/55] KVM: PPC: Book3S HV P9: Optimise timebase reads

2021-07-25 Thread Nicholas Piggin
Reduce the number of mfTB executed by passing the current timebase around entry and exit code rather than read it multiple times. -213 cycles (7578) POWER9 virt-mode NULL hcall Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_book3s_64.h | 2 +- arch/powerpc/kvm/book3s_hv.c

[PATCH v1 29/55] KVM: PPC: Book3S HV P9: Avoid SPR scoreboard stalls

2021-07-25 Thread Nicholas Piggin
Avoid interleaving mfSPR and mtSPR. -151 cycles (7427) POWER9 virt-mode NULL hcall Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 8 arch/powerpc/kvm/book3s_hv_p9_entry.c | 19 +++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --g

[PATCH v1 30/55] KVM: PPC: Book3S HV P9: Only execute mtSPR if the value changed

2021-07-25 Thread Nicholas Piggin
Keep better track of the current SPR value in places where they are to be loaded with a new context, to reduce expensive mtSPR operations. -73 cycles (7354) POWER9 virt-mode NULL hcall Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 64 ++-- 1 f

[PATCH v1 31/55] KVM: PPC: Book3S HV P9: Juggle SPR switching around

2021-07-25 Thread Nicholas Piggin
This juggles SPR switching on the entry and exit sides to be more symmetric, which makes the next refactoring patch possible with no functional change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch

[PATCH v1 32/55] KVM: PPC: Book3S HV P9: Move vcpu register save/restore into functions

2021-07-25 Thread Nicholas Piggin
This should be no functional difference but makes the caller easier to read. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 65 +++- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/

[PATCH v1 33/55] KVM: PPC: Book3S HV P9: Move host OS save/restore functions to built-in

2021-07-25 Thread Nicholas Piggin
Move the P9 guest/host register switching functions to the built-in P9 entry code, and export it for nested to use as well. This allows more flexibility in scheduling these supervisor privileged SPR accesses with the HV privileged and PR SPR accesses in the low level entry code. Signed-off-by: Ni

[PATCH v1 34/55] KVM: PPC: Book3S HV P9: Move nested guest entry into its own function

2021-07-25 Thread Nicholas Piggin
This is just refactoring. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 125 +++ 1 file changed, 67 insertions(+), 58 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 977712eb74e0..cb66c9534dbf 100644

[PATCH v1 35/55] KVM: PPC: Book3S HV P9: Move remaining SPR and MSR access into low level entry

2021-07-25 Thread Nicholas Piggin
Move register saving and loading from kvmhv_p9_guest_entry() into the HV and nested entry handlers. Accesses are scheduled to reduce mtSPR / mfSPR interleaving which reduces SPR scoreboard stalls. XXX +212 cycles here somewhere (7566), investigate POWER9 virt-mode NULL hcall Signed-off-by: Nich

[PATCH v1 36/55] KVM: PPC: Book3S HV P9: Implement TM fastpath for guest entry/exit

2021-07-25 Thread Nicholas Piggin
If TM is not active, only TM register state needs to be saved. -348 cycles (7218) POWER9 virt-mode NULL hcall Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_p9_entry.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kvm/bo

[PATCH v1 37/55] KVM: PPC: Book3S HV P9: Switch PMU to guest as late as possible

2021-07-25 Thread Nicholas Piggin
This moves PMU switch to guest as late as possible in entry, and switch back to host as early as possible at exit. This helps the host get the most perf coverage of KVM entry/exit code as possible. This is slightly suboptimal for SPR scheduling point of view when the PMU is enabled, but when perf

[PATCH v1 38/55] KVM: PPC: Book3S HV P9: Restrict DSISR canary workaround to processors that require it

2021-07-25 Thread Nicholas Piggin
Use CPU_FTR_P9_RADIX_PREFETCH_BUG for this, to test for DD2.1 and below processors. -43 cycles (7178) POWER9 virt-mode NULL hcall Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 3 ++- arch/powerpc/kvm/book3s_hv_p9_entry.c | 6 -- 2 files changed, 6 insertions(+),

[PATCH v1 39/55] KVM: PPC: Book3S HV P9: More SPR speed improvements

2021-07-25 Thread Nicholas Piggin
This avoids more scoreboard stalls and reduces mtSPRs. -193 cycles (6985) POWER9 virt-mode NULL hcall Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_p9_entry.c | 73 --- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/arch/powerpc/kvm/book3

[PATCH v1 40/55] KVM: PPC: Book3S HV P9: Demand fault EBB facility registers

2021-07-25 Thread Nicholas Piggin
Use HFSCR facility disabling to implement demand faulting for EBB, with a hysteresis counter similar to the load_fp etc counters in context switching that implement the equivalent demand faulting for userspace facilities. This speeds up guest entry/exit by avoiding the register save/restore when a

[PATCH v1 41/55] KVM: PPC: Book3S HV P9: Demand fault TM facility registers

2021-07-25 Thread Nicholas Piggin
Use HFSCR facility disabling to implement demand faulting for TM, with a hysteresis counter similar to the load_fp etc counters in context switching that implement the equivalent demand faulting for userspace facilities. This speeds up guest entry/exit by avoiding the register save/restore when a

[PATCH v1 42/55] KVM: PPC: Book3S HV P9: Use Linux SPR save/restore to manage some host SPRs

2021-07-25 Thread Nicholas Piggin
Linux implements SPR save/restore including storage space for registers in the task struct for process context switching. Make use of this similarly to the way we make use of the context switching fp/vec save restore. This improves code reuse, allows some stack space to be saved, and helps with av

[PATCH v1 43/55] KVM: PPC: Book3S HV P9: Comment and fix MMU context switching code

2021-07-25 Thread Nicholas Piggin
Tighten up partition switching code synchronisation and comments. In particular, hwsync ; isync is required after the last access that is performed in the context of a partition, before the partition is switched away from. -301 cycles (6319) POWER9 virt-mode NULL hcall Signed-off-by: Nicholas Pi

[PATCH v1 44/55] KVM: PPC: Book3S HV P9: Test dawr_enabled() before saving host DAWR SPRs

2021-07-25 Thread Nicholas Piggin
Some of the DAWR SPR access is already predicated on dawr_enabled(), apply this to the remainder of the accesses. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_p9_entry.c | 34 --- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/arch/powerp

[PATCH v1 45/55] KVM: PPC: Book3S HV P9: Don't restore PSSCR if not needed

2021-07-25 Thread Nicholas Piggin
This also moves the PSSCR update in nested entry to avoid a SPR scoreboard stall. -45 cycles (6276) POWER9 virt-mode NULL hcall Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 7 +-- arch/powerpc/kvm/book3s_hv_p9_entry.c | 26 +++--- 2 files c

[PATCH v1 46/55] KVM: PPC: Book3S HV P9: Avoid tlbsync sequence on radix guest exit

2021-07-25 Thread Nicholas Piggin
Use the existing TLB flushing logic to IPI the previous CPU and run the necessary barriers before running a guest vCPU on a new physical CPU, to do the necessary radix GTSE barriers for handling the case of an interrupted guest tlbie sequence. This results in more IPIs than the TLB flush logic req

[PATCH v1 47/55] KVM: PPC: Book3S HV Nested: Avoid extra mftb() in nested entry

2021-07-25 Thread Nicholas Piggin
mftb() is expensive and one can be avoided on nested guest dispatch. If the time checking code distinguishes between the L0 timer and the nested HV timer, then both can be tested in the same place with the same mftb() value. This also nicely illustrates the relationship between the L0 and nested

[PATCH v1 48/55] KVM: PPC: Book3S HV P9: Improve mfmsr performance on entry

2021-07-25 Thread Nicholas Piggin
Rearrange the MSR saving on entry so it does not follow the mtmsrd to disable interrupts, avoiding a possible RAW scoreboard stall. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/kvm_book3s_64.h | 2 + arch/powerpc/kvm/book3s_hv.c | 18 ++- arch/powerpc/kvm/book3s_h

[PATCH v1 49/55] KVM: PPC: Book3S HV P9: Optimise hash guest SLB saving

2021-07-25 Thread Nicholas Piggin
slbmfee/slbmfev instructions are very expensive, moreso than a regular mfspr instruction, so minimising them significantly improves hash guest exit performance. The slbmfev is only required if slbmfee found a valid SLB entry. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv_p9_entry

[PATCH v1 50/55] KVM: PPC: Book3S HV P9: Add unlikely annotation for !mmu_ready

2021-07-25 Thread Nicholas Piggin
The mmu will almost always be ready. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index ee4e38cf5df4..2bd000e2c269 100644 --- a/arch/powerpc/kvm/book

[PATCH v1 51/55] KVM: PPC: Book3S HV P9: Avoid cpu_in_guest atomics on entry and exit

2021-07-25 Thread Nicholas Piggin
cpu_in_guest is set to determine if a CPU needs to be IPI'ed to exit the guest and notice the need_tlb_flush bit. This can be implemented as a global per-CPU pointer to the currently running guest instead of per-guest cpumasks, saving 2 atomics per entry/exit. P7/8 doesn't require cpu_in_guest, no

[PATCH v1 52/55] KVM: PPC: Book3S HV P9: Remove most of the vcore logic

2021-07-25 Thread Nicholas Piggin
The P9 path always uses one vcpu per vcore, so none of the the vcore, locks, stolen time, blocking logic, shared waitq, etc., is required. Remove most of it. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 147 --- 1 file changed, 85 insertions(

[PATCH v1 53/55] KVM: PPC: Book3S HV P9: Tidy kvmppc_create_dtl_entry

2021-07-25 Thread Nicholas Piggin
This goes further to removing vcores from the P9 path. Also avoid the memset in favour of explicitly initialising all fields. Signed-off-by: Nicholas Piggin --- arch/powerpc/kvm/book3s_hv.c | 61 +--- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a

[PATCH v1 54/55] KVM: PPC: Book3S HV P9: Stop using vc->dpdes

2021-07-25 Thread Nicholas Piggin
The P9 path uses vc->dpdes only for msgsndp / SMT emulation. This adds an ordering requirement between vcpu->doorbell_request and vc->dpdes for no real benefit. Use vcpu->doorbell_request directly. XXX: verify msgsndp / DPDES emulation works properly. Signed-off-by: Nicholas Piggin --- arch/pow

[PATCH v1 55/55] KVM: PPC: Book3S HV P9: Remove subcore HMI handling

2021-07-25 Thread Nicholas Piggin
On POWER9 and newer, rather than the complex HMI synchronisation and subcore state, have each thread un-apply the guest TB offset before calling into the early HMI handler. This allows the subcore state to be avoided, including subcore enter / exit guest, which includes an expensive divide that sh

Re: [PATCH v1 23/55] KVM: PPC: Book3S HV P9: Reduce mtmsrd instructions required to save host SPRs

2021-07-25 Thread kernel test robot
Hi Nicholas, I love your patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v5.14-rc3 next-20210723] [cannot apply to powerpc/next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest