kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jim Mattson <jmattson@google.com>
To: Nadav Amit <nadav.amit@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <sean.j.christopherson@intel.com>,
	KVM <kvm@vger.kernel.org>, Peter Shier <pshier@google.com>
Subject: Re: [kvm-unit-tests PATCH] x86: VMX: Add a VMX-preemption timer expiration test
Date: Mon, 12 Oct 2020 11:46:03 -0700	[thread overview]
Message-ID: <CALMp9eSe35-8jCzXjYkGVkHfam2CPGCO5+A=1+OGGCnKb_yEPA@mail.gmail.com> (raw)
In-Reply-To: <354EB465-6F61-4AED-89B1-AB49A984A8A1@gmail.com>

On Mon, Oct 12, 2020 at 11:31 AM Nadav Amit <nadav.amit@gmail.com> wrote:
>
> > On Oct 12, 2020, at 11:29 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >
> > On 12/10/20 20:17, Nadav Amit wrote:
> >>> KVM clearly doesn't adhere to the architectural specification. I don't
> >>> know what is wrong with your Broadwell machine.
> >> Are you saying that the test is expected to fail on KVM? And that Sean’s
> >> failures are expected?
> >
> > It's not expected to fail, but it's apparently broken.
>
> Hm… Based on my results on bare-metal, it might be an architectural issue or
> a test issue, and not a KVM issue.

From section 25.5.1 of the SDM, volume 3:

If the last VM entry was performed with the 1-setting of “activate
VMX-preemption timer” VM-execution control,
the VMX-preemption timer counts down (from the value loaded by VM
entry; see Section 26.7.4) in VMX non-
root operation. When the timer counts down to zero, it stops counting
down and a VM exit occurs (see Section
25.2).

The test is actually quite lax, in that it doesn't start tracking VMX
non-root operation time until actually in the guest. Hardware is free
to start tracking VMX non-root operation time during VM-entry.

If the test can both observe a TSC value after the VMX-preemption
timer deadline *and* store that value to memory, then the store
instruction must have started executing after the VMX-preemption timer
has counted down to zero. Per the SDM, a VM-exit should have occurred
before the store could retire.

Of course, there could be a test bug.

  reply	other threads:[~2020-10-12 18:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 20:39 [kvm-unit-tests PATCH] x86: VMX: Add a VMX-preemption timer expiration test Jim Mattson
2020-05-09 13:26 ` Paolo Bonzini
2020-10-10  8:42 ` Nadav Amit
2020-10-12 16:32   ` Sean Christopherson
2020-10-12 16:47     ` Nadav Amit
2020-10-12 17:55       ` Jim Mattson
2020-10-12 18:17         ` Nadav Amit
2020-10-12 18:29           ` Paolo Bonzini
2020-10-12 18:31             ` Nadav Amit
2020-10-12 18:46               ` Jim Mattson [this message]
2020-10-12 20:21                 ` Nadav Amit
2020-10-12 18:34             ` Jim Mattson

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='CALMp9eSe35-8jCzXjYkGVkHfam2CPGCO5+A=1+OGGCnKb_yEPA@mail.gmail.com' \
    --to=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=nadav.amit@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=pshier@google.com \
    --cc=sean.j.christopherson@intel.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;
as well as URLs for NNTP newsgroup(s).