From: Maxim Levitsky <mlevitsk@redhat.com>
To: kvm@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
Sean Christopherson <seanjc@google.com>,
Borislav Petkov <bp@alien8.de>,
x86@kernel.org, Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Maxim Levitsky <mlevitsk@redhat.com>
Subject: [PATCH v4 0/4] KVM: x86: allow DEBUGCTL.DEBUGCTLMSR_FREEZE_IN_SMM passthrough
Date: Wed, 14 May 2025 20:53:49 -0400 [thread overview]
Message-ID: <20250515005353.952707-1-mlevitsk@redhat.com> (raw)
Currently KVM allows the guest to set IA32_DEBUGCTL to whatever value
the guest wants, only capped by a bitmask of allowed bits
(except in the nested entry where KVM apparently doesn't even check
this set of allowed bits - this patch series also fixes that)
However some IA32_DEBUGCTL bits can be useful for the host, e.g the
IA32_DEBUGCTL.DEBUGCTLMSR_FREEZE_IN_SMM which isolates the PMU from
the influence of the host's SMM.
Reshuffle some of the code to allow (currently only this bit) to be passed
though from its host value to the guest.
Note that host value of this bit can be toggled by writing 0 or 1 to
/sys/devices/cpu/freeze_on_smi
This was tested on a Intel(R) Xeon(R) Silver 4410Y with KVM unit tests and
kvm selftests running in parallel with tight loop writing to IO port 0xB2
which on this machine generates #SMIs.
SMI generation was also verified also by reading the MSR 0x34 which
shows the current count of #SMIs received.
Despite the flood of #SMIs, the tests survived with this patch applied.
V4: incorporated review feedback.
Best regards,
Maxim Levitsky
Maxim Levitsky (2):
x86: nVMX: check vmcs12->guest_ia32_debugctl value given by L2
x86: KVM: VMX: preserve DEBUGCTLMSR_FREEZE_IN_SMM
Sean Christopherson (2):
KVM: x86: Convert vcpu_run()'s immediate exit param into a generic
bitmap
KVM: x86: Drop kvm_x86_ops.set_dr6() in favor of a new KVM_RUN flag
arch/x86/include/asm/kvm-x86-ops.h | 1 -
arch/x86/include/asm/kvm_host.h | 9 ++++++--
arch/x86/kvm/svm/svm.c | 14 +++++++-----
arch/x86/kvm/vmx/main.c | 15 +++----------
arch/x86/kvm/vmx/nested.c | 8 +++++--
arch/x86/kvm/vmx/tdx.c | 3 ++-
arch/x86/kvm/vmx/vmx.c | 36 +++++++++++++++++++++---------
arch/x86/kvm/vmx/vmx.h | 4 ++++
arch/x86/kvm/vmx/x86_ops.h | 4 ++--
arch/x86/kvm/x86.c | 18 ++++++++++-----
10 files changed, 70 insertions(+), 42 deletions(-)
--
2.46.0
next reply other threads:[~2025-05-15 0:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 0:53 Maxim Levitsky [this message]
2025-05-15 0:53 ` [PATCH v4 1/4] KVM: x86: Convert vcpu_run()'s immediate exit param into a generic bitmap Maxim Levitsky
2025-05-15 0:53 ` [PATCH v4 2/4] KVM: x86: Drop kvm_x86_ops.set_dr6() in favor of a new KVM_RUN flag Maxim Levitsky
2025-05-16 6:49 ` Chao Gao
2025-05-16 13:07 ` Sean Christopherson
2025-05-15 0:53 ` [PATCH v4 3/4] x86: nVMX: check vmcs12->guest_ia32_debugctl value given by L2 Maxim Levitsky
2025-05-16 3:31 ` Chao Gao
2025-05-16 14:50 ` mlevitsk
2025-05-20 21:48 ` mlevitsk
2025-05-21 0:32 ` Chao Gao
2025-05-21 16:50 ` mlevitsk
2025-05-20 22:24 ` Sean Christopherson
2025-05-15 0:53 ` [PATCH v4 4/4] x86: KVM: VMX: preserve DEBUGCTLMSR_FREEZE_IN_SMM Maxim Levitsky
2025-05-16 3:39 ` Chao Gao
2025-05-16 14:49 ` mlevitsk
2025-05-20 22:57 ` Sean Christopherson
2025-05-21 20:43 ` mlevitsk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250515005353.952707-1-mlevitsk@redhat.com \
--to=mlevitsk@redhat.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®