KVM: PPC: Book3S HV P9: entry/exit optimisations

Started by Nicholas Piggin on Jul 26, 2021 · 77 messages from 7 authors · Last reply Aug 14, 2021

Series

55 patches, 28 files

+2,194 −1,424

Subsystems (4)

Show 1 more

Maintainers (3)

STALE1930d SUPERSEDED

Status: Superseded by v4 (posted 2021-11-23). [go to v4]

Revision v1 (4 revisions archived).

Revisions (4)
  1. v1 current
  2. v2 [diff against previous]
  3. v3 [diff against previous]
  4. v4 [diff against previous]

page 2 of 2 · open the first message on its own page

  1. [PATCH v1 01/55] KVM: PPC: Book3S HV: Remove TM emulation from POWER7/8 path
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  2. [PATCH v1 02/55] KVM: PPC: Book3S HV P9: Fixes for TM softpatch interrupt
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  3. [PATCH v1 03/55] KVM: PPC: Book3S HV: Sanitise vcpu registers in nested path
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  4. [PATCH v1 04/55] KVM: PPC: Book3S HV: Stop forwarding all HFUs to L1
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  5. [PATCH v1 05/55] KVM: PPC: Book3S HV Nested: Reflect guest PMU in-use to L0 when guest SPRs are live
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  6. [PATCH v1 06/55] powerpc/64s: Remove WORT SPR from POWER9/10
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  7. [PATCH v1 07/55] KMV: PPC: Book3S HV P9: Use set_dec to set decrementer to host
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  8. [PATCH v1 08/55] KVM: PPC: Book3S HV P9: Use host timer accounting to avoid decrementer read
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  9. [PATCH v1 09/55] KVM: PPC: Book3S HV P9: Use large decrementer for HDEC
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  10. [PATCH v1 10/55] KVM: PPC: Book3S HV P9: Reduce mftb per guest entry/exit
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  11. [PATCH v1 11/55] powerpc/time: add API for KVM to re-arm the host timer/decrementer
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  12. [PATCH v1 12/55] KVM: PPC: Book3S HV: POWER10 enable HAIL when running radix guests
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  13. [PATCH v1 13/55] powerpc/64s: Keep AMOR SPR a constant ~0 at runtime
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  14. [PATCH v1 14/55] KVM: PPC: Book3S HV: Don't always save PMU for guest capable of nesting
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  15. [PATCH v1 15/55] powerpc/64s: Always set PMU control registers to frozen/disabled when not in use
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  16. [PATCH v1 16/55] powerpc/64s: Implement PMU override command line option
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  17. [PATCH v1 17/55] KVM: PPC: Book3S HV P9: Implement PMU save/restore in C
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  18. [PATCH v1 18/55] KVM: PPC: Book3S HV P9: Factor PMU save/load into context switch functions
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  19. [PATCH v1 19/55] KVM: PPC: Book3S HV P9: Demand fault PMU SPRs when marked not inuse
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  20. [PATCH v1 20/55] KVM: PPC: Book3S HV P9: Factor out yield_count increment
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  21. [PATCH v1 21/55] KVM: PPC: Book3S HV: CTRL SPR does not require read-modify-write
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  22. [PATCH v1 22/55] KVM: PPC: Book3S HV P9: Move SPRG restore to restore_p9_host_os_sprs
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  23. [PATCH v1 23/55] KVM: PPC: Book3S HV P9: Reduce mtmsrd instructions required to save host SPRs
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  24. [PATCH v1 24/55] KVM: PPC: Book3S HV P9: Improve mtmsrd scheduling by delaying MSR[EE] disable
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  25. [PATCH v1 25/55] KVM: PPC: Book3S HV P9: Add kvmppc_stop_thread to match kvmppc_start_thread
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  26. [PATCH v1 26/55] KVM: PPC: Book3S HV: Change dec_expires to be relative to guest timebase
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  27. [PATCH v1 27/55] KVM: PPC: Book3S HV P9: Move TB updates
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  28. [PATCH v1 28/55] KVM: PPC: Book3S HV P9: Optimise timebase reads
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  29. [PATCH v1 29/55] KVM: PPC: Book3S HV P9: Avoid SPR scoreboard stalls
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  30. [PATCH v1 30/55] KVM: PPC: Book3S HV P9: Only execute mtSPR if the value changed
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  31. [PATCH v1 31/55] KVM: PPC: Book3S HV P9: Juggle SPR switching around
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  32. [PATCH v1 32/55] KVM: PPC: Book3S HV P9: Move vcpu register save/restore into functions
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  33. [PATCH v1 33/55] KVM: PPC: Book3S HV P9: Move host OS save/restore functions to built-in
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  34. [PATCH v1 34/55] KVM: PPC: Book3S HV P9: Move nested guest entry into its own function
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  35. [PATCH v1 35/55] KVM: PPC: Book3S HV P9: Move remaining SPR and MSR access into low level entry
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  36. [PATCH v1 36/55] KVM: PPC: Book3S HV P9: Implement TM fastpath for guest entry/exit
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  37. [PATCH v1 37/55] KVM: PPC: Book3S HV P9: Switch PMU to guest as late as possible
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  38. [PATCH v1 38/55] KVM: PPC: Book3S HV P9: Restrict DSISR canary workaround to processors that require it
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  39. [PATCH v1 39/55] KVM: PPC: Book3S HV P9: More SPR speed improvements
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  40. [PATCH v1 40/55] KVM: PPC: Book3S HV P9: Demand fault EBB facility registers
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  41. [PATCH v1 41/55] KVM: PPC: Book3S HV P9: Demand fault TM facility registers
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  42. [PATCH v1 42/55] KVM: PPC: Book3S HV P9: Use Linux SPR save/restore to manage some host SPRs
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  43. [PATCH v1 43/55] KVM: PPC: Book3S HV P9: Comment and fix MMU context switching code
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  44. [PATCH v1 44/55] KVM: PPC: Book3S HV P9: Test dawr_enabled() before saving host DAWR SPRs
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  45. [PATCH v1 45/55] KVM: PPC: Book3S HV P9: Don't restore PSSCR if not needed
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  46. [PATCH v1 46/55] KVM: PPC: Book3S HV P9: Avoid tlbsync sequence on radix guest exit
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  47. [PATCH v1 47/55] KVM: PPC: Book3S HV Nested: Avoid extra mftb() in nested entry
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  48. [PATCH v1 48/55] KVM: PPC: Book3S HV P9: Improve mfmsr performance on entry
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  49. [PATCH v1 49/55] KVM: PPC: Book3S HV P9: Optimise hash guest SLB saving
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  50. [PATCH v1 50/55] KVM: PPC: Book3S HV P9: Add unlikely annotation for !mmu_ready
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  51. [PATCH v1 51/55] KVM: PPC: Book3S HV P9: Avoid cpu_in_guest atomics on entry and exit
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  52. [PATCH v1 52/55] KVM: PPC: Book3S HV P9: Remove most of the vcore logic
    Revisions and related patches
    Revisions (4)
    1. v1 current
    2. v2 [diff against previous]
    3. v3 [diff against previous]
    4. v4 [diff against previous]
  53. [PATCH v1 53/55] KVM: PPC: Book3S HV P9: Tidy kvmppc_create_dtl_entry
    Revisions and related patches
    Revisions (3)
    1. v1 current
    2. v2 [diff against previous]
    3. v4 [diff against previous]
  54. [PATCH v1 54/55] KVM: PPC: Book3S HV P9: Stop using vc->dpdes
    Revisions and related patches
    Revisions (2)
    1. v1 current
    2. v2 [diff against previous]
  55. [PATCH v1 55/55] KVM: PPC: Book3S HV P9: Remove subcore HMI handling
    Revisions and related patches
    Revisions (2)
    1. v1 current
    2. v2 [diff against previous]

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

Message details and related content
Excerpts from Athira Rajeev's message of August 9, 2021 1:03 pm:
quoted
On 26-Jul-2021, at 9:19 AM, Nicholas Piggin [off-list ref] wrote:
quoted
+static void freeze_pmu(unsigned long mmcr0, unsigned long mmcra)
+{
+	if (!(mmcr0 & MMCR0_FC))
+		goto do_freeze;
+	if (mmcra & MMCRA_SAMPLE_ENABLE)
+		goto do_freeze;
+	if (cpu_has_feature(CPU_FTR_ARCH_31)) {
+		if (!(mmcr0 & MMCR0_PMCCEXT))
+			goto do_freeze;
+		if (!(mmcra & MMCRA_BHRB_DISABLE))
+			goto do_freeze;
+	}
+	return;
+
+do_freeze:
+	mmcr0 = MMCR0_FC;
+	mmcra = 0;
+	if (cpu_has_feature(CPU_FTR_ARCH_31)) {
+		mmcr0 |= MMCR0_PMCCEXT;
+		mmcra = MMCRA_BHRB_DISABLE;
+	}
+
+	mtspr(SPRN_MMCR0, mmcr0);
+	mtspr(SPRN_MMCRA, mmcra);
+	isync();
+}
+
Hi Nick,

After feezing pmu, do we need to clear “pmcregs_in_use” as well?
Not until we save the values out of the registers. pmcregs_in_use = 0 
means our hypervisor is free to clear our PMU register contents.
Also can’t we unconditionally do the MMCR0/MMCRA/ freeze settings in here ? do we need the if conditions for FC/PMCCEXT/BHRB ?
I think it's possible, but pretty minimal advantage. I would prefer to 
set them the way perf does for now. If we can move this code into perf/
it should become easier for you to tweak things.

Thanks,
Nick

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

Message details and related content
On 13-Aug-2021, at 9:54 AM, Nicholas Piggin [off-list ref] wrote:

Excerpts from Athira Rajeev's message of August 9, 2021 1:03 pm:
quoted
quoted
On 26-Jul-2021, at 9:19 AM, Nicholas Piggin [off-list ref] wrote:
quoted
quoted
+static void freeze_pmu(unsigned long mmcr0, unsigned long mmcra)
+{
+	if (!(mmcr0 & MMCR0_FC))
+		goto do_freeze;
+	if (mmcra & MMCRA_SAMPLE_ENABLE)
+		goto do_freeze;
+	if (cpu_has_feature(CPU_FTR_ARCH_31)) {
+		if (!(mmcr0 & MMCR0_PMCCEXT))
+			goto do_freeze;
+		if (!(mmcra & MMCRA_BHRB_DISABLE))
+			goto do_freeze;
+	}
+	return;
+
+do_freeze:
+	mmcr0 = MMCR0_FC;
+	mmcra = 0;
+	if (cpu_has_feature(CPU_FTR_ARCH_31)) {
+		mmcr0 |= MMCR0_PMCCEXT;
+		mmcra = MMCRA_BHRB_DISABLE;
+	}
+
+	mtspr(SPRN_MMCR0, mmcr0);
+	mtspr(SPRN_MMCRA, mmcra);
+	isync();
+}
+
Hi Nick,

After feezing pmu, do we need to clear “pmcregs_in_use” as well?
Not until we save the values out of the registers. pmcregs_in_use = 0 

6 more quoted lines

Sure Nick, 

Other changes looks good to me.

Reviewed-by: Athira Rajeev <redacted>

Thanks
Athira
If we can move this code into perf/
it should become easier for you to tweak things.

Thanks,
Nick

Previous page

Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help