mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/5] KVM: x86: Quirk "MWAIT never faults" behavior
Date: Wed,  8 Jun 2022 22:45:11 +0000	[thread overview]
Message-ID: <20220608224516.3788274-1-seanjc@google.com> (raw)

Add a quirk to let userspace opt into correctly emulating MONITOR/MWAIT
when they are disabled in CPUID instead of unconditionally treating them
as NOPs.

The selftest changes are based on the CPUID overhaul[*], the KVM patch
should apply cleanly on kvm/queue, commit 55371f1d0c01 ("...").

Note!  Patch 3 is a fix for a bug in the Hyper-V Features test that I
encountered when verifying the exception fixup works as expected.  The
"bug", which is in reality a rather large set of bugs, basically turns
the test into a giant nop.  The patch really should be "backported" all
the way across the selftests overhaul, but I don't care enough about
Hyper-V to spend yet more time on selftests at this point.

[*] https://lore.kernel.org/all/20220604012058.1972195-1-seanjc@google.com

Sean Christopherson (5):
  KVM: x86: Add a quirk for KVM's "MONITOR/MWAIT are NOPs!" behavior
  KVM: selftests: Add x86-64 support for exception fixup
  KVM: selftests: Mostly fix comically broken Hyper-V Features test
  KVM: selftests: Use exception fixup for #UD/#GP Hyper-V MSR/hcall
    tests
  KVM: selftests: Add MONITOR/MWAIT quirk test

 Documentation/virt/kvm/api.rst                |  13 +
 arch/x86/include/asm/kvm_host.h               |   3 +-
 arch/x86/include/uapi/asm/kvm.h               |   1 +
 arch/x86/kvm/x86.c                            |  26 +-
 tools/testing/selftests/kvm/.gitignore        |   1 +
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../selftests/kvm/include/x86_64/processor.h  |  74 ++++++
 .../selftests/kvm/lib/x86_64/processor.c      |  17 ++
 .../selftests/kvm/x86_64/hyperv_features.c    | 239 ++++++++----------
 .../selftests/kvm/x86_64/kvm_pv_test.c        |  82 ++----
 .../selftests/kvm/x86_64/monitor_mwait_test.c | 127 ++++++++++
 11 files changed, 375 insertions(+), 209 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c


base-commit: 081ad4bbae8d503c79fae45f463766d28b2f3241
-- 
2.36.1.255.ge46751e96f-goog


             reply	other threads:[~2022-06-08 22:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 22:45 Sean Christopherson [this message]
2022-06-08 22:45 ` [PATCH 1/5] KVM: x86: Add a quirk for KVM's "MONITOR/MWAIT are NOPs!" behavior Sean Christopherson
2022-06-08 22:45 ` [PATCH 2/5] KVM: selftests: Add x86-64 support for exception fixup Sean Christopherson
2022-06-08 22:45 ` [PATCH 3/5] KVM: selftests: Mostly fix comically broken Hyper-V Features test Sean Christopherson
2022-06-08 22:45 ` [PATCH 4/5] KVM: selftests: Use exception fixup for #UD/#GP Hyper-V MSR/hcall tests Sean Christopherson
2022-06-08 22:45 ` [PATCH 5/5] KVM: selftests: Add MONITOR/MWAIT quirk test Sean Christopherson
2022-06-09  6:37   ` Yuan Yao
2022-06-09 13:55     ` Sean Christopherson
2022-06-20 15:00 ` [PATCH 0/5] KVM: x86: Quirk "MWAIT never faults" behavior Paolo Bonzini

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=20220608224516.3788274-1-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    /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®