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 16/16] add IPI loss stress test
Date: Thu, 27 Oct 2022 18:41:36 +0000 [thread overview]
Message-ID: <Y1rQ4IPX4o9f/Oop@google.com> (raw)
In-Reply-To: <df085771c95517538f6056adfe6f5f656de5d2be.camel@redhat.com>
On Thu, Oct 27, 2022, Maxim Levitsky wrote:
> On Mon, 2022-10-24 at 17:19 +0000, Sean Christopherson wrote:
> > That doesn't (and shouldn't) wake the vCPU from the guest's perspective. If/when
> > userspace calls KVM_RUN again, the vCPU's state should still be KVM_MP_STATE_HALTED
> > and thus KVM will invoke vcpu_block() until there is an actual wake event.
>
> Well HLT is allowed to do suprious wakeups so KVM is allowed to not do it correclty,
I suspect the above "HLT is allowed to do spurious wakeups" is a typo, but in case
it's not, the SDM says:
An enabled interrupt (including NMI and SMI), a debug exception, the BINIT# signal,
the INIT# signal, or the RESET# signal will resume execution.
and the APM says:
Execution resumes when an unmasked hardware interrupt (INTR), non-maskable
interrupt (NMI), system management interrupt (SMI), RESET, or INIT occurs.
I.e. resuming from HLT without a valid wake event is a violation of the x86 architecture.
> > > In fact I'll just do it - just need to pick some open source PRNG code.
> > > Do you happen to know a good one? Mersenne Twister?
> >
> > It probably makes sense to use whatever we end up using for selftests[*] in order
> > to minimize the code we have to maintain.
> >
> > [*] https://lore.kernel.org/all/20221019221321.3033920-2-coltonlewis@google.com
>
> Makes sense. I'll then just take this generator and adopt it to the kvm unit tests.
> Or do you want to actually share the code? via a kernel header or something?
Sadly, just copy+paste for now. It'd be nice to share code, e.g. for the myriad
X86_FEATURE_* flags, but's a separate problem.
> > > That is the problem - the delay is just in TSC freq units, and knowing TSC freq
> > > for some reason on x86 is next to impossible on AMD
> >
> > Ah, delay() takes the number cycles. Ugh.
> >
> > We should fix that, e.g. use the CPUID-provided frequency when possible (KVM should
> > emulate this if it doesn't already), and then #define an arbitrary TSC frequency as
> > a fall back so that we can write readable code, e.g. 2.4Ghz is probably close enough
> > to work.
>
> KVM doesn't emulate the Intel's specific way of reporting TSC freq on AMD.
> In some sense this is wrong to do as it is Intel specific.
>
> I do think that it is a great idea to report the TSC freq via some KVM specific MSR.
> That might though open a pandora box in regard to migration.
Heh, yeah, the Hyper-V TSC stuff is rather ugly.
> I don't like the 2.4Ghz idea at all - it is once again corner cutting. Its true
> that most code doens't need exact delay, not to mention that delay is never going
> to be exact, but once you expose (nano)second based interface, test writers
> will start to use it, and then wonder why someone hardcoded it to 2.4 GHz.a
True. A really crazy/bad idea would be to get APERF/MPERF from /dev/cpu/0/msr
in the run script and somehow feed the host TSC into KUT :-)
prev parent reply other threads:[~2022-10-27 18:41 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
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 [this message]
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=Y1rQ4IPX4o9f/Oop@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