2023-10-27 20:49:44

by Sean Christopherson

[permalink] [raw]
Subject: [GIT PULL] KVM: x86 pull requests for 6.7

I know you said a cover letter isn't necessary, but sending everything all at
once helps me keep track of things, and git send-email replying to whatever
random pull request happens to come first alphabetically bugs me.

[GIT PULL] KVM: x86: APIC changes for 6.7
[GIT PULL] KVM: x86: Documentation updates for 6.7
[GIT PULL] KVM: x86: Misc changes for 6.7
[GIT PULL] KVM: x86: PMU change for 6.7
[GIT PULL] KVM: x86: SVM changes for 6.7
[GIT PULL] KVM: x86: Xen changes for 6.7

Don't get used to the low volume, the next few cycles are likely to be chonkers.
But, I have started using dedicated topic branches for larger series, e.g. for
guest_memfd and LAM support, and I'll send pull requests for such branches much
earlier in the cycle. So, in theory, the size of the pull requests that come in
just before the merge window will still be relatively small.

Speaking of pull requests coming in just before the merge window, I meant to get
these sent out earlier this week, but guest_memfd happened. At least it looks
like I'll still beat Oliver, which is all that matters :-)


2023-10-27 20:49:48

by Sean Christopherson

[permalink] [raw]
Subject: [GIT PULL] KVM: x86: APIC changes for 6.7

Two small APIC changes for 6.7, both specific to Intel's APICv.

The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:

Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-apic-6.7

for you to fetch changes up to 629d3698f6958ee6f8131ea324af794f973b12ac:

KVM: x86: Clear bit12 of ICR after APIC-write VM-exit (2023-09-28 10:42:16 -0700)

----------------------------------------------------------------
KVM x86 APIC changes for 6.7:

- Purge VMX's posted interrupt descriptor *before* loading APIC state when
handling KVM_SET_LAPIC. Purging the PID after loading APIC state results in
lost APIC timer IRQs as the APIC timer can be armed as part of loading APIC
state, i.e. can immediately pend an IRQ if the expiry is in the past.

- Clear the ICR.BUSY bit when handling trap-like x2APIC writes to suppress a
WARN due to KVM expecting the BUSY bit to be cleared when sending IPIs.

----------------------------------------------------------------
Haitao Shan (1):
KVM: x86: Fix lapic timer interrupt lost after loading a snapshot.

Tao Su (1):
KVM: x86: Clear bit12 of ICR after APIC-write VM-exit

arch/x86/include/asm/kvm-x86-ops.h | 1 +
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/kvm/lapic.c | 30 +++++++++++++++++-------------
arch/x86/kvm/vmx/vmx.c | 4 ++--
4 files changed, 21 insertions(+), 15 deletions(-)

2023-10-27 20:49:57

by Sean Christopherson

[permalink] [raw]
Subject: [GIT PULL] KVM: x86: Misc changes for 6.7

A truly miscellaneous collection of patches this time around. David M's PML
fix obviously belongs in the MMU pull request, but I applied it to the wrong
branch and didn't want to rebase for such a silly thing.

The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:

Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-misc-6.7

for you to fetch changes up to 2770d4722036d6bd24bcb78e9cd7f6e572077d03:

KVM: x86: Ignore MSR_AMD64_TW_CFG access (2023-10-19 10:55:14 -0700)

----------------------------------------------------------------
KVM x86 misc changes for 6.7:

- Add CONFIG_KVM_MAX_NR_VCPUS to allow supporting up to 4096 vCPUs without
forcing more common use cases to eat the extra memory overhead.

- Add IBPB and SBPB virtualization support.

- Fix a bug where restoring a vCPU snapshot that was taken within 1 second of
creating the original vCPU would cause KVM to try to synchronize the vCPU's
TSC and thus clobber the correct TSC being set by userspace.

- Compute guest wall clock using a single TSC read to avoid generating an
inaccurate time, e.g. if the vCPU is preempted between multiple TSC reads.

- "Virtualize" HWCR.TscFreqSel to make Linux guests happy, which complain
about a "Firmware Bug" if the bit isn't set for select F/M/S combos.

- Don't apply side effects to Hyper-V's synthetic timer on writes from
userspace to fix an issue where the auto-enable behavior can trigger
spurious interrupts, i.e. do auto-enabling only for guest writes.

- Remove an unnecessary kick of all vCPUs when synchronizing the dirty log
without PML enabled.

- Advertise "support" for non-serializing FS/GS base MSR writes as appropriate.

- Use octal notation for file permissions through KVM x86.

- Fix a handful of typo fixes and warts.

----------------------------------------------------------------
David Matlack (1):
KVM: x86/mmu: Stop kicking vCPUs to sync the dirty log when PML is disabled

David Woodhouse (1):
KVM: x86: Refine calculation of guest wall clock to use a single TSC read

Dongli Zhang (1):
KVM: x86: remove always-false condition in kvmclock_sync_fn

Jim Mattson (4):
KVM: x86: Allow HWCR.McStatusWrEn to be cleared once set
KVM: x86: Virtualize HWCR.TscFreqSel[bit 24]
KVM: selftests: Test behavior of HWCR, a.k.a. MSR_K7_HWCR
x86: KVM: Add feature flag for CPUID.80000021H:EAX[bit 1]

Josh Poimboeuf (2):
KVM: x86: Add IBPB_BRTYPE support
KVM: x86: Add SBPB support

Kyle Meyer (1):
KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs

Liang Chen (1):
KVM: x86: remove the unused assigned_dev_head from kvm_arch

Like Xu (1):
KVM: x86: Don't sync user-written TSC against startup values

Maciej S. Szmigiero (1):
KVM: x86: Ignore MSR_AMD64_TW_CFG access

Michal Luczaj (2):
KVM: x86: Remove redundant vcpu->arch.cr0 assignments
KVM: x86: Force TLB flush on userspace changes to special registers

Mingwei Zhang (1):
KVM: x86: Update the variable naming in kvm_x86_ops.sched_in()

Nicolas Saenz Julienne (1):
KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space

Peng Hao (1):
KVM: x86: Use octal for file permission

arch/x86/include/asm/cpufeatures.h | 1 +
arch/x86/include/asm/kvm_host.h | 12 +-
arch/x86/include/asm/msr-index.h | 1 +
arch/x86/kvm/Kconfig | 11 ++
arch/x86/kvm/cpuid.c | 8 +-
arch/x86/kvm/cpuid.h | 3 +-
arch/x86/kvm/hyperv.c | 10 +-
arch/x86/kvm/smm.c | 1 -
arch/x86/kvm/svm/svm.c | 2 +-
arch/x86/kvm/vmx/vmx.c | 20 +--
arch/x86/kvm/x86.c | 195 ++++++++++++++++-----
arch/x86/kvm/x86.h | 1 +
arch/x86/kvm/xen.c | 4 +-
tools/testing/selftests/kvm/Makefile | 1 +
tools/testing/selftests/kvm/x86_64/hwcr_msr_test.c | 47 +++++
15 files changed, 251 insertions(+), 66 deletions(-)
create mode 100644 tools/testing/selftests/kvm/x86_64/hwcr_msr_test.c

2023-10-27 20:50:04

by Sean Christopherson

[permalink] [raw]
Subject: [GIT PULL] KVM: x86: MMU changes for 6.7

This is mostly the first half of a series by Yan to optimize KVM's handling of
guest MTRR changes for VMs with non-coherent DMA. Yan had to put more complex
changes that actually realize the optimizations on hold, but the patches here
are all nice cleanups on their own.

The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:

Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-mmu-6.7

for you to fetch changes up to 1de9992f9de0a92b6e11133aba0e2be833c11084:

KVM: x86/mmu: Remove unnecessary ‘NULL’ values from sptep (2023-10-18 14:34:28 -0700)

----------------------------------------------------------------
KVM x86 MMU changes for 6.7:

- Clean up code that deals with honoring guest MTRRs when the VM has
non-coherent DMA and host MTRRs are ignored, i.e. EPT is enabled.

- Zap EPT entries when non-coherent DMA assignment stops/start to prevent
using stale entries with the wrong memtype.

- Don't ignore guest PAT for CR0.CD=1 && KVM_X86_QUIRK_CD_NW_CLEARED=y, as
there's zero reason to ignore guest PAT if the effective MTRR memtype is WB.
This will also allow for future optimizations of handling guest MTRR updates
for VMs with non-coherent DMA and the quirk enabled.

- Harden the fast page fault path to guard against encountering an invalid
root when walking SPTEs.

----------------------------------------------------------------
Li zeming (1):
KVM: x86/mmu: Remove unnecessary ‘NULL’ values from sptep

Yan Zhao (5):
KVM: x86/mmu: Add helpers to return if KVM honors guest MTRRs
KVM: x86/mmu: Zap SPTEs when CR0.CD is toggled iff guest MTRRs are honored
KVM: x86/mmu: Zap SPTEs on MTRR update iff guest MTRRs are honored
KVM: x86/mmu: Zap KVM TDP when noncoherent DMA assignment starts/stops
KVM: VMX: drop IPAT in memtype when CD=1 for KVM_X86_QUIRK_CD_NW_CLEARED

arch/x86/kvm/mmu.h | 7 +++++++
arch/x86/kvm/mmu/mmu.c | 37 ++++++++++++++++++++++++++-----------
arch/x86/kvm/mtrr.c | 2 +-
arch/x86/kvm/vmx/vmx.c | 9 +++------
arch/x86/kvm/x86.c | 21 ++++++++++++++++++---
5 files changed, 55 insertions(+), 21 deletions(-)

2023-10-27 20:50:12

by Sean Christopherson

[permalink] [raw]
Subject: [GIT PULL] KVM: x86: PMU change for 6.7

A single PMU change for 6.7. Note, this _just_ got rebased because I had a
brain fart and used kvm-x86/next as the base when recreating the "pmu" branch
after the fixes for 6.6 were merged. The commit has been in -next since October
16th as 4b09cc132a59. This is not at all urgent and can definitely be deferred
to 6.8 if the late rebase is an issue.

The following changes since commit 2b3f2325e71f09098723727d665e2e8003d455dc:

Merge tag 'kvm-x86-selftests-6.6-fixes' of https://github.com/kvm-x86/linux into HEAD (2023-10-15 08:25:18 -0400)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-pmu-6.7

for you to fetch changes up to fad505b2cb838fb52cb72fa22830824c80330f2f:

KVM: x86: Service NMI requests after PMI requests in VM-Enter path (2023-10-27 13:20:29 -0700)

----------------------------------------------------------------
KVM PMU change for 6.7:

- Handle NMI/SMI requests after PMU/PMI requests so that a PMI=>NMI doesn't
require redoing the entire run loop due to the NMI not being detected until
the final kvm_vcpu_exit_request() check before entering the guest.

----------------------------------------------------------------
Mingwei Zhang (1):
KVM: x86: Service NMI requests after PMI requests in VM-Enter path

arch/x86/kvm/x86.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

2023-10-27 20:50:15

by Sean Christopherson

[permalink] [raw]
Subject: [GIT PULL] KVM: x86: Documentation updates for 6.7

Doc updates for 6.7. The bulk is a cleanup of the kvm_mmu_page docs, which are
sadly already stale because I neglected to update the docs when removing the
TDP MMU's async root zapping :-(

The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:

Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-docs-6.7

for you to fetch changes up to b35babd3abea081de0611ce0d5b85281c18c52c7:

KVM: x86/pmu: Add documentation for fixed ctr on PMU filter (2023-09-27 14:23:51 -0700)

----------------------------------------------------------------
KVM x86 Documentation updates for 6.7:

- Fix various typos, notably a confusing reference to the non-existent
"struct kvm_vcpu_event" (the actual structure is kvm_vcpu_events, plural).

- Update x86's kvm_mmu_page documentation to bring it closer to the code
(this raced with the removal of async zapping and so the documentation is
already stale; my bad).

- Document the behavior of x86 PMU filters on fixed counters.

----------------------------------------------------------------
Jinrong Liang (1):
KVM: x86/pmu: Add documentation for fixed ctr on PMU filter

Michal Luczaj (1):
KVM: Correct kvm_vcpu_event(s) typo in KVM API documentation

Mingwei Zhang (6):
KVM: Documentation: Add the missing description for guest_mode in kvm_mmu_page_role
KVM: Documentation: Update the field name gfns and its description in kvm_mmu_page
KVM: Documentation: Add the missing description for ptep in kvm_mmu_page
KVM: Documentation: Add the missing description for tdp_mmu_root_count into kvm_mmu_page
KVM: Documentation: Add the missing description for mmu_valid_gen into kvm_mmu_page
KVM: Documentation: Add the missing description for tdp_mmu_page into kvm_mmu_page

Documentation/virt/kvm/api.rst | 36 +++++++++++++++++++++++--------
Documentation/virt/kvm/x86/mmu.rst | 43 ++++++++++++++++++++++++++++++--------
2 files changed, 61 insertions(+), 18 deletions(-)

2023-10-27 20:50:20

by Sean Christopherson

[permalink] [raw]
Subject: [GIT PULL] KVM: x86: SVM changes for 6.7

An enhancement to help userspace deal with SEV-ES guest crashes, and cleanups
related to not being able to do "skip" emulation for SEV guests.

The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:

Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-svm-6.7

for you to fetch changes up to 00682995409696866fe43984c74c8688bdf8f0a5:

KVM: SVM: Treat all "skip" emulation for SEV guests as outright failures (2023-10-04 15:08:53 -0700)

----------------------------------------------------------------
KVM SVM changes for 6.7:

- Report KVM_EXIT_SHUTDOWN instead of EINVAL if KVM intercepts SHUTDOWN while
running an SEV-ES guest.

- Clean up handling "failures" when KVM detects it can't emulate the "skip"
action for an instruction that has already been partially emulated. Drop a
hack in the SVM code that was fudging around the emulator code not giving
SVM enough information to do the right thing.

----------------------------------------------------------------
Peter Gonda (1):
KVM: SVM: Update SEV-ES shutdown intercepts with more metadata

Sean Christopherson (2):
KVM: x86: Refactor can_emulate_instruction() return to be more expressive
KVM: SVM: Treat all "skip" emulation for SEV guests as outright failures

arch/x86/include/asm/kvm-x86-ops.h | 2 +-
arch/x86/include/asm/kvm_host.h | 4 +--
arch/x86/kvm/svm/svm.c | 50 ++++++++++++++++----------------------
arch/x86/kvm/vmx/vmx.c | 12 ++++-----
arch/x86/kvm/x86.c | 22 +++++++++++------
5 files changed, 45 insertions(+), 45 deletions(-)

2023-10-27 20:50:23

by Sean Christopherson

[permalink] [raw]
Subject: [GIT PULL] KVM: x86: Xen changes for 6.7

Read the tag, I couldn't figure out how to summarize this one without simply
regurgitating the tag :-)

The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:

Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-xen-6.7

for you to fetch changes up to 409f2e92a27a210fc768c5569851b4a419e6a232:

KVM: x86/xen: ignore the VCPU_SSHOTTMR_future flag (2023-10-04 15:22:58 -0700)

----------------------------------------------------------------
KVM x86 Xen changes for 6.7:

- Omit "struct kvm_vcpu_xen" entirely when CONFIG_KVM_XEN=n.

- Use the fast path directly from the timer callback when delivering Xen timer
events. Avoid the problematic races with using the fast path by ensuring
the hrtimer isn't running when (re)starting the timer or saving the timer
information (for userspace).

- Follow the lead of upstream Xen and ignore the VCPU_SSHOTTMR_future flag.

----------------------------------------------------------------
David Woodhouse (1):
KVM: x86/xen: Use fast path for Xen timer delivery

Paul Durrant (1):
KVM: x86/xen: ignore the VCPU_SSHOTTMR_future flag

Peng Hao (1):
KVM: X86: Reduce size of kvm_vcpu_arch structure when CONFIG_KVM_XEN=n

arch/x86/include/asm/kvm_host.h | 5 +++-
arch/x86/kvm/cpuid.c | 2 ++
arch/x86/kvm/x86.c | 2 ++
arch/x86/kvm/xen.c | 55 +++++++++++++++++++++++++++++++++++++----
4 files changed, 58 insertions(+), 6 deletions(-)

2023-10-31 14:16:00

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [GIT PULL] KVM: x86: Documentation updates for 6.7

On Fri, Oct 27, 2023 at 10:49 PM Sean Christopherson <[email protected]> wrote:
>
> Doc updates for 6.7. The bulk is a cleanup of the kvm_mmu_page docs, which are
> sadly already stale because I neglected to update the docs when removing the
> TDP MMU's async root zapping :-(
>
> The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:
>
> Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-docs-6.7

Pulled, thanks.

Paolo

> for you to fetch changes up to b35babd3abea081de0611ce0d5b85281c18c52c7:
>
> KVM: x86/pmu: Add documentation for fixed ctr on PMU filter (2023-09-27 14:23:51 -0700)
>
> ----------------------------------------------------------------
> KVM x86 Documentation updates for 6.7:
>
> - Fix various typos, notably a confusing reference to the non-existent
> "struct kvm_vcpu_event" (the actual structure is kvm_vcpu_events, plural).
>
> - Update x86's kvm_mmu_page documentation to bring it closer to the code
> (this raced with the removal of async zapping and so the documentation is
> already stale; my bad).
>
> - Document the behavior of x86 PMU filters on fixed counters.
>
> ----------------------------------------------------------------
> Jinrong Liang (1):
> KVM: x86/pmu: Add documentation for fixed ctr on PMU filter
>
> Michal Luczaj (1):
> KVM: Correct kvm_vcpu_event(s) typo in KVM API documentation
>
> Mingwei Zhang (6):
> KVM: Documentation: Add the missing description for guest_mode in kvm_mmu_page_role
> KVM: Documentation: Update the field name gfns and its description in kvm_mmu_page
> KVM: Documentation: Add the missing description for ptep in kvm_mmu_page
> KVM: Documentation: Add the missing description for tdp_mmu_root_count into kvm_mmu_page
> KVM: Documentation: Add the missing description for mmu_valid_gen into kvm_mmu_page
> KVM: Documentation: Add the missing description for tdp_mmu_page into kvm_mmu_page
>
> Documentation/virt/kvm/api.rst | 36 +++++++++++++++++++++++--------
> Documentation/virt/kvm/x86/mmu.rst | 43 ++++++++++++++++++++++++++++++--------
> 2 files changed, 61 insertions(+), 18 deletions(-)
>

2023-10-31 14:16:47

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [GIT PULL] KVM: x86: APIC changes for 6.7

On Fri, Oct 27, 2023 at 10:49 PM Sean Christopherson <[email protected]> wrote:
>
> Two small APIC changes for 6.7, both specific to Intel's APICv.
>
> The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:
>
> Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-apic-6.7
>
> for you to fetch changes up to 629d3698f6958ee6f8131ea324af794f973b12ac:
>
> KVM: x86: Clear bit12 of ICR after APIC-write VM-exit (2023-09-28 10:42:16 -0700)

Pulled, thanks.

Paolo

> ----------------------------------------------------------------
> KVM x86 APIC changes for 6.7:
>
> - Purge VMX's posted interrupt descriptor *before* loading APIC state when
> handling KVM_SET_LAPIC. Purging the PID after loading APIC state results in
> lost APIC timer IRQs as the APIC timer can be armed as part of loading APIC
> state, i.e. can immediately pend an IRQ if the expiry is in the past.
>
> - Clear the ICR.BUSY bit when handling trap-like x2APIC writes to suppress a
> WARN due to KVM expecting the BUSY bit to be cleared when sending IPIs.
>
> ----------------------------------------------------------------
> Haitao Shan (1):
> KVM: x86: Fix lapic timer interrupt lost after loading a snapshot.
>
> Tao Su (1):
> KVM: x86: Clear bit12 of ICR after APIC-write VM-exit
>
> arch/x86/include/asm/kvm-x86-ops.h | 1 +
> arch/x86/include/asm/kvm_host.h | 1 +
> arch/x86/kvm/lapic.c | 30 +++++++++++++++++-------------
> arch/x86/kvm/vmx/vmx.c | 4 ++--
> 4 files changed, 21 insertions(+), 15 deletions(-)
>

2023-10-31 14:21:54

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [GIT PULL] KVM: x86: MMU changes for 6.7

On Fri, Oct 27, 2023 at 10:49 PM Sean Christopherson <[email protected]> wrote:
>
> This is mostly the first half of a series by Yan to optimize KVM's handling of
> guest MTRR changes for VMs with non-coherent DMA. Yan had to put more complex
> changes that actually realize the optimizations on hold, but the patches here
> are all nice cleanups on their own.
>
> The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:
>
> Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)

Pulled, thanks.

Paolo


> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-mmu-6.7
>
> for you to fetch changes up to 1de9992f9de0a92b6e11133aba0e2be833c11084:
>
> KVM: x86/mmu: Remove unnecessary ‘NULL’ values from sptep (2023-10-18 14:34:28 -0700)
>
> ----------------------------------------------------------------
> KVM x86 MMU changes for 6.7:
>
> - Clean up code that deals with honoring guest MTRRs when the VM has
> non-coherent DMA and host MTRRs are ignored, i.e. EPT is enabled.
>
> - Zap EPT entries when non-coherent DMA assignment stops/start to prevent
> using stale entries with the wrong memtype.
>
> - Don't ignore guest PAT for CR0.CD=1 && KVM_X86_QUIRK_CD_NW_CLEARED=y, as
> there's zero reason to ignore guest PAT if the effective MTRR memtype is WB.
> This will also allow for future optimizations of handling guest MTRR updates
> for VMs with non-coherent DMA and the quirk enabled.
>
> - Harden the fast page fault path to guard against encountering an invalid
> root when walking SPTEs.
>
> ----------------------------------------------------------------
> Li zeming (1):
> KVM: x86/mmu: Remove unnecessary ‘NULL’ values from sptep
>
> Yan Zhao (5):
> KVM: x86/mmu: Add helpers to return if KVM honors guest MTRRs
> KVM: x86/mmu: Zap SPTEs when CR0.CD is toggled iff guest MTRRs are honored
> KVM: x86/mmu: Zap SPTEs on MTRR update iff guest MTRRs are honored
> KVM: x86/mmu: Zap KVM TDP when noncoherent DMA assignment starts/stops
> KVM: VMX: drop IPAT in memtype when CD=1 for KVM_X86_QUIRK_CD_NW_CLEARED
>
> arch/x86/kvm/mmu.h | 7 +++++++
> arch/x86/kvm/mmu/mmu.c | 37 ++++++++++++++++++++++++++-----------
> arch/x86/kvm/mtrr.c | 2 +-
> arch/x86/kvm/vmx/vmx.c | 9 +++------
> arch/x86/kvm/x86.c | 21 ++++++++++++++++++---
> 5 files changed, 55 insertions(+), 21 deletions(-)
>

2023-10-31 14:22:23

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [GIT PULL] KVM: x86: Misc changes for 6.7

On Fri, Oct 27, 2023 at 10:49 PM Sean Christopherson <[email protected]> wrote:
>
> A truly miscellaneous collection of patches this time around. David M's PML
> fix obviously belongs in the MMU pull request, but I applied it to the wrong
> branch and didn't want to rebase for such a silly thing.
>
> The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:
>
> Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-misc-6.7
>
> for you to fetch changes up to 2770d4722036d6bd24bcb78e9cd7f6e572077d03:
>
> KVM: x86: Ignore MSR_AMD64_TW_CFG access (2023-10-19 10:55:14 -0700)

Pulled, thanks.

Paolo

>
> ----------------------------------------------------------------
> KVM x86 misc changes for 6.7:
>
> - Add CONFIG_KVM_MAX_NR_VCPUS to allow supporting up to 4096 vCPUs without
> forcing more common use cases to eat the extra memory overhead.
>
> - Add IBPB and SBPB virtualization support.
>
> - Fix a bug where restoring a vCPU snapshot that was taken within 1 second of
> creating the original vCPU would cause KVM to try to synchronize the vCPU's
> TSC and thus clobber the correct TSC being set by userspace.
>
> - Compute guest wall clock using a single TSC read to avoid generating an
> inaccurate time, e.g. if the vCPU is preempted between multiple TSC reads.
>
> - "Virtualize" HWCR.TscFreqSel to make Linux guests happy, which complain
> about a "Firmware Bug" if the bit isn't set for select F/M/S combos.
>
> - Don't apply side effects to Hyper-V's synthetic timer on writes from
> userspace to fix an issue where the auto-enable behavior can trigger
> spurious interrupts, i.e. do auto-enabling only for guest writes.
>
> - Remove an unnecessary kick of all vCPUs when synchronizing the dirty log
> without PML enabled.
>
> - Advertise "support" for non-serializing FS/GS base MSR writes as appropriate.
>
> - Use octal notation for file permissions through KVM x86.
>
> - Fix a handful of typo fixes and warts.
>
> ----------------------------------------------------------------
> David Matlack (1):
> KVM: x86/mmu: Stop kicking vCPUs to sync the dirty log when PML is disabled
>
> David Woodhouse (1):
> KVM: x86: Refine calculation of guest wall clock to use a single TSC read
>
> Dongli Zhang (1):
> KVM: x86: remove always-false condition in kvmclock_sync_fn
>
> Jim Mattson (4):
> KVM: x86: Allow HWCR.McStatusWrEn to be cleared once set
> KVM: x86: Virtualize HWCR.TscFreqSel[bit 24]
> KVM: selftests: Test behavior of HWCR, a.k.a. MSR_K7_HWCR
> x86: KVM: Add feature flag for CPUID.80000021H:EAX[bit 1]
>
> Josh Poimboeuf (2):
> KVM: x86: Add IBPB_BRTYPE support
> KVM: x86: Add SBPB support
>
> Kyle Meyer (1):
> KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs
>
> Liang Chen (1):
> KVM: x86: remove the unused assigned_dev_head from kvm_arch
>
> Like Xu (1):
> KVM: x86: Don't sync user-written TSC against startup values
>
> Maciej S. Szmigiero (1):
> KVM: x86: Ignore MSR_AMD64_TW_CFG access
>
> Michal Luczaj (2):
> KVM: x86: Remove redundant vcpu->arch.cr0 assignments
> KVM: x86: Force TLB flush on userspace changes to special registers
>
> Mingwei Zhang (1):
> KVM: x86: Update the variable naming in kvm_x86_ops.sched_in()
>
> Nicolas Saenz Julienne (1):
> KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space
>
> Peng Hao (1):
> KVM: x86: Use octal for file permission
>
> arch/x86/include/asm/cpufeatures.h | 1 +
> arch/x86/include/asm/kvm_host.h | 12 +-
> arch/x86/include/asm/msr-index.h | 1 +
> arch/x86/kvm/Kconfig | 11 ++
> arch/x86/kvm/cpuid.c | 8 +-
> arch/x86/kvm/cpuid.h | 3 +-
> arch/x86/kvm/hyperv.c | 10 +-
> arch/x86/kvm/smm.c | 1 -
> arch/x86/kvm/svm/svm.c | 2 +-
> arch/x86/kvm/vmx/vmx.c | 20 +--
> arch/x86/kvm/x86.c | 195 ++++++++++++++++-----
> arch/x86/kvm/x86.h | 1 +
> arch/x86/kvm/xen.c | 4 +-
> tools/testing/selftests/kvm/Makefile | 1 +
> tools/testing/selftests/kvm/x86_64/hwcr_msr_test.c | 47 +++++
> 15 files changed, 251 insertions(+), 66 deletions(-)
> create mode 100644 tools/testing/selftests/kvm/x86_64/hwcr_msr_test.c
>

2023-10-31 14:23:17

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [GIT PULL] KVM: x86: Xen changes for 6.7

On Fri, Oct 27, 2023 at 10:49 PM Sean Christopherson <[email protected]> wrote:
>
> Read the tag, I couldn't figure out how to summarize this one without simply
> regurgitating the tag :-)
>
> The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:
>
> Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-xen-6.7
>
> for you to fetch changes up to 409f2e92a27a210fc768c5569851b4a419e6a232:
>
> KVM: x86/xen: ignore the VCPU_SSHOTTMR_future flag (2023-10-04 15:22:58 -0700)

Pulled, thanks.

Paolo

>
> ----------------------------------------------------------------
> KVM x86 Xen changes for 6.7:
>
> - Omit "struct kvm_vcpu_xen" entirely when CONFIG_KVM_XEN=n.
>
> - Use the fast path directly from the timer callback when delivering Xen timer
> events. Avoid the problematic races with using the fast path by ensuring
> the hrtimer isn't running when (re)starting the timer or saving the timer
> information (for userspace).
>
> - Follow the lead of upstream Xen and ignore the VCPU_SSHOTTMR_future flag.
>
> ----------------------------------------------------------------
> David Woodhouse (1):
> KVM: x86/xen: Use fast path for Xen timer delivery
>
> Paul Durrant (1):
> KVM: x86/xen: ignore the VCPU_SSHOTTMR_future flag
>
> Peng Hao (1):
> KVM: X86: Reduce size of kvm_vcpu_arch structure when CONFIG_KVM_XEN=n
>
> arch/x86/include/asm/kvm_host.h | 5 +++-
> arch/x86/kvm/cpuid.c | 2 ++
> arch/x86/kvm/x86.c | 2 ++
> arch/x86/kvm/xen.c | 55 +++++++++++++++++++++++++++++++++++++----
> 4 files changed, 58 insertions(+), 6 deletions(-)
>

2023-10-31 14:56:53

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [GIT PULL] KVM: x86: SVM changes for 6.7

On Fri, Oct 27, 2023 at 10:49 PM Sean Christopherson <[email protected]> wrote:
>
> An enhancement to help userspace deal with SEV-ES guest crashes, and cleanups
> related to not being able to do "skip" emulation for SEV guests.
>
> The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:
>
> Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-svm-6.7
>
> for you to fetch changes up to 00682995409696866fe43984c74c8688bdf8f0a5:
>
> KVM: SVM: Treat all "skip" emulation for SEV guests as outright failures (2023-10-04 15:08:53 -0700)

Pulled, thanks.

Paolo

> ----------------------------------------------------------------
> KVM SVM changes for 6.7:
>
> - Report KVM_EXIT_SHUTDOWN instead of EINVAL if KVM intercepts SHUTDOWN while
> running an SEV-ES guest.
>
> - Clean up handling "failures" when KVM detects it can't emulate the "skip"
> action for an instruction that has already been partially emulated. Drop a
> hack in the SVM code that was fudging around the emulator code not giving
> SVM enough information to do the right thing.
>
> ----------------------------------------------------------------
> Peter Gonda (1):
> KVM: SVM: Update SEV-ES shutdown intercepts with more metadata
>
> Sean Christopherson (2):
> KVM: x86: Refactor can_emulate_instruction() return to be more expressive
> KVM: SVM: Treat all "skip" emulation for SEV guests as outright failures
>
> arch/x86/include/asm/kvm-x86-ops.h | 2 +-
> arch/x86/include/asm/kvm_host.h | 4 +--
> arch/x86/kvm/svm/svm.c | 50 ++++++++++++++++----------------------
> arch/x86/kvm/vmx/vmx.c | 12 ++++-----
> arch/x86/kvm/x86.c | 22 +++++++++++------
> 5 files changed, 45 insertions(+), 45 deletions(-)
>