From: Sean Christopherson <seanjc@google.com>
To: Maxim Levitsky <mlevitsk@redhat.com>
Cc: kvm@vger.kernel.org, Cathy Avery <cavery@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [kvm-unit-tests PATCH 14/16] svm: rewerite vm entry macros
Date: Thu, 27 Oct 2022 19:39:11 +0000 [thread overview]
Message-ID: <Y1reX9Uha1gc3e4y@google.com> (raw)
In-Reply-To: <0fdd437cfa347258de2841c4af2532e6b49751a7.camel@redhat.com>
On Thu, Oct 27, 2022, Maxim Levitsky wrote:
> On Mon, 2022-10-24 at 19:56 +0000, Sean Christopherson wrote:
> > > And also there is segment registers, etc, etc.
> >
> > Which aren't GPRs.
>
> But user can want to use them too.
My point is that they don't need to be handled in this the VM-Entry/VM-Exit path
as both VMX and SVM context switch all segment information through the VMCS/VMCB.
In other words, if we want to provide easy, generic access to segment information,
that can be done completely separately from this code and in a separate struct.
> > > Note though that my LBR tests do still need this as a macro because they must
> > > not do any extra jumps/calls as these clobber the LBR registers.
> >
> > Shouldn't it be fairly easy to account for the CALL in the asm routine? Taking
> > on that sort of dependency is quite gross, but it'd likely be less maintenance
> > in the long run than an inline asm blob.
>
> That is not possible - the SVM has just one LBR - so doing call will erase it.
Ugh, that's a pain.
> I'll think of something, I also do want to turn this into a function.
Actually, IIUC, there's no need to preserve the LBR across the call to a VMRUN
subroutine. When checking that the host value is preserved, LBRs are disabled
before the call. When checking that the guest value leaks back into the host,
the host value is irrelevant, the only thing that matters is that the LBR is
pre-filled with something other than the guest value, and that functionality is
provided by the call into the VMRUN subroutine.
LBR side topic #1, sequences like this should really be a single asm blob:
wrmsr(MSR_IA32_DEBUGCTLMSR, DEBUGCTLMSR_LBR);
DO_BRANCH(...);
wrmsr(MSR_IA32_DEBUGCTLMSR, 0);
as there is nothing that prevents the compiler from inserting a branch between
DO_BRANCH() and the wrmsr(). It's extremely unlikely, but technicall possible.
LBR side topic #2, the tests are broken on our Milan systems. I've poked around
a few times, but haven't dug in deep yet (and probably won't have cycles to do so
anytime soon).
PASS: Basic LBR test
PASS: Test that without LBRV enabled, guest LBR state does 'leak' to the host(1)
PASS: Test that without LBRV enabled, guest LBR state does 'leak' to the host(2)
PASS: Test that with LBRV enabled, guest LBR state doesn't leak (1)
Unhandled exception 6 #UD at ip 000000000040175c
error_code=0000 rflags=00010086 cs=00000008
rax=00000000004016e7 rcx=00000000000001dc rdx=80000000004016e7 rbx=0000000000414920
rbp=000000000042fa38 rsi=0000000000000000 rdi=0000000000414d98
r8=00000000004176f9 r9=00000000000003f8 r10=000000000000000d r11=0000000000000000
r12=0000000000000000 r13=0000000000000000 r14=0000000000000000 r15=0000000000000000
cr0=0000000080010011 cr2=0000000000000000 cr3=00000000010bf000 cr4=0000000000040020
cr8=0000000000000000
next prev parent reply other threads:[~2022-10-27 19:39 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 15:23 [kvm-unit-tests PATCH 00/16] kvm-unit-tests: set of fixes and new tests Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 01/16] x86: make irq_enable avoid the interrupt shadow Maxim Levitsky
2022-10-20 18:01 ` Sean Christopherson
2022-10-24 12:36 ` Maxim Levitsky
2022-10-24 22:49 ` Sean Christopherson
2022-10-27 10:16 ` Maxim Levitsky
2022-10-27 15:50 ` Sean Christopherson
2022-10-27 17:10 ` Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 02/16] x86: add few helper functions for apic local timer Maxim Levitsky
2022-10-20 19:14 ` Sean Christopherson
2022-10-24 12:37 ` Maxim Levitsky
2022-10-24 16:10 ` Sean Christopherson
2022-10-27 10:19 ` Maxim Levitsky
2022-10-27 15:54 ` Sean Christopherson
2022-10-27 17:11 ` Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 03/16] svm: use irq_enable instead of sti/nop Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 04/16] svm: make svm_intr_intercept_mix_if/gif test a bit more robust Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 05/16] svm: use apic_start_timer/apic_stop_timer instead of open coding it Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 06/16] x86: Add test for #SMI during interrupt window Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 07/16] x86: Add a simple test for SYSENTER instruction Maxim Levitsky
2022-10-20 19:25 ` Sean Christopherson
2022-10-24 12:38 ` Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 08/16] svm: add nested shutdown test Maxim Levitsky
2022-10-20 15:26 ` Maxim Levitsky
2022-10-20 19:06 ` Sean Christopherson
2022-10-24 12:39 ` Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 09/16] svm: move svm spec definitions to lib/x86/svm.h Maxim Levitsky
2022-10-20 19:08 ` Sean Christopherson
2022-10-20 15:23 ` [kvm-unit-tests PATCH 10/16] svm: move some svm support functions into lib/x86/svm_lib.h Maxim Levitsky
2022-10-20 15:23 ` [kvm-unit-tests PATCH 11/16] svm: add svm_suported Maxim Levitsky
2022-10-20 18:21 ` Sean Christopherson
2022-10-24 12:40 ` Maxim Levitsky
2022-10-20 15:24 ` [kvm-unit-tests PATCH 12/16] svm: move setup_svm to svm_lib.c Maxim Levitsky
2022-10-20 15:24 ` [kvm-unit-tests PATCH 13/16] svm: move vmcb_ident " Maxim Levitsky
2022-10-20 18:37 ` Sean Christopherson
2022-10-24 12:46 ` Maxim Levitsky
2022-10-20 15:24 ` [kvm-unit-tests PATCH 14/16] svm: rewerite vm entry macros Maxim Levitsky
2022-10-20 18:55 ` Sean Christopherson
2022-10-24 12:45 ` Maxim Levitsky
2022-10-24 19:56 ` Sean Christopherson
2022-10-27 12:07 ` Maxim Levitsky
2022-10-27 19:39 ` Sean Christopherson [this message]
2022-10-20 15:24 ` [kvm-unit-tests PATCH 15/16] svm: introduce svm_vcpu Maxim Levitsky
2022-10-20 19:02 ` Sean Christopherson
2022-10-24 12:46 ` Maxim Levitsky
2022-10-20 15:24 ` [kvm-unit-tests PATCH 16/16] add IPI loss stress test Maxim Levitsky
2022-10-20 20:23 ` Sean Christopherson
2022-10-24 12:54 ` Maxim Levitsky
2022-10-24 17:19 ` Sean Christopherson
2022-10-27 11:00 ` Maxim Levitsky
2022-10-27 18:41 ` Sean Christopherson
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=Y1reX9Uha1gc3e4y@google.com \
--to=seanjc@google.com \
--cc=cavery@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.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