Skip to content

KVM: VMX: Unify L1D flush for L1TF

Sean Christopherson kvm lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest4 patches 17 repliesIn review

Changes in v3 from the cover letter

- Put the "raw" variant in KVM, dress it up with KVM's "request" terminology, and add a comment explaining why _KVM_ knows its usage doesn't need to disable virtualization.
- Add the prep patches.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4KVM: VMX: Flush CPU buffers as needed if L1D cache flush is skippedarch/x86/kvm/vmx/vmx.c+7 -513 replies
2/4KVM: VMX: Bundle all L1 data cache flush mitigation code togetherarch/x86/kvm/vmx/vmx.c+88 -881 reply
3/4KVM: VMX: Disable L1TF L1 data cache flush if CONFIG_CPU_MITIGATIONS=narch/x86/include/asm/hardirq.h arch/x86/kvm/vmx/vmx.c+46 -142 replies
4/4KVM: x86: Unify L1TF flushing under per-CPU variablearch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c arch/x86/kvm/vmx/nested.c +3 more+24 -231 reply

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchBrendan Jackman
1/4R-b
2/4R-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/4] KVM: VMX: Unify L1D flush for L1TF

Unify the L1D cache flushing done to mitigate L1TF under the per-CPU variable, as the per-vCPU variable has been superfluous for quite some time.

Patch 1 fixes a bug (I think it's a bug?) I found when poking around the code. If L1D flushes are conditional and KVM skips an L1D flush on VM-Enter, then arguably KVM should flush CPU buffers based on other mitigations.

Patches 2-3 bury the L1TF L1D flushing under CONFIG_CPU_MITIGATIONS, partly because it's absurd that KVM doesn't honor CONFIG_CPU_MITIGATIONS for that case, partly because it simplifies unifying the tracking code (helps obviate the need for a stub).

Patch 4 is Brendan's patch and the main goal of the mini-series.

v3:
- Put the "raw" variant in KVM, dress it up with KVM's "request" terminology, and add a comment explaining why _KVM_ knows its usage doesn't need to disable virtualization.
- Add the prep patches.

v2:
- https://lore.kernel.org/all/[email protected]
- Moved the bit back to irq_stat
- Fixed DEBUG_PREEMPT issues by adding a _raw variant

v1: https://lore.kernel.org/r/[email protected]

Brendan Jackman (1):
KVM: x86: Unify L1TF flushing under per-CPU variable

Sean Christopherson (3):
KVM: VMX: Flush CPU buffers as needed if L1D cache flush is skipped
KVM: VMX: Bundle all L1 data cache flush mitigation code together
KVM: VMX: Disable L1TF L1 data cache flush if CONFIG_CPU_MITIGATIONS=n

 arch/x86/include/asm/hardirq.h  |   4 +-
 arch/x86/include/asm/kvm_host.h |   3 -
 arch/x86/kvm/mmu/mmu.c          |   2 +-
 arch/x86/kvm/vmx/nested.c       |   2 +-
 arch/x86/kvm/vmx/vmx.c          | 222 ++++++++++++++++++--------------
 arch/x86/kvm/x86.c              |   6 +-
 arch/x86/kvm/x86.h              |  14 ++
 7 files changed, 144 insertions(+), 109 deletions(-)

base-commit: f222788458c8a7753d43befef2769cd282dc008e

Signature · 1 line
2.51.0.858.gf9c4a03a3a-goog