From: Paolo Bonzini <pbonzini@redhat.com>
To: David Matlack <dmatlack@google.com>,
kvm@vger.kernel.org, Lai Jiangshan <jiangshanlai@gmail.com>
Subject: Re: VM_BUG_ON in vmx_prepare_switch_to_guest->__get_current_cr3_fast at kvm/queue
Date: Sat, 11 Dec 2021 03:01:37 +0100 [thread overview]
Message-ID: <76d5e958-af0b-68fb-e6fa-ecdab8d79eeb@redhat.com> (raw)
In-Reply-To: <d22eb5e1-0e9d-707d-8482-c63857e87b0d@redhat.com>
On 12/11/21 01:11, Paolo Bonzini wrote:
> Yeah, vmx_prepare_switch_to_guest() doesn't update HOST_CR3 if no
> preemption happens from one call of vcpu_enter_guest() to the next
> (preemption would cause a call to kvm_arch_vcpu_put and from there to
> vmx_prepare_switch_to_host, which clears vmx->guest_state_loaded).
>
> During that time an MM switch is bumping the PCID; I would have expected
> any such flush to require a preemption (in order to reach e.g.
> switch_mm_irqs_off), but that must be wrong. In the splat below in fact
> you can see that the values are 0x60674f2005 (RAX) and 0x60674f2006 (RCX
> and CR3).
As Jiangshan said, the PCID is bumped while L2 runs, and is stale when
switching back to the vmcs01. That indeed is compatible with a
preemption. There should definitely be a comment in
vmx_prepare_switch_to_guest() that points to vmx_sync_vmcs_host_state().
Paolo
next prev parent reply other threads:[~2021-12-11 2:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-10 17:57 VM_BUG_ON in vmx_prepare_switch_to_guest->__get_current_cr3_fast at kvm/queue David Matlack
2021-12-10 23:54 ` Lai Jiangshan
2021-12-11 1:04 ` Lai Jiangshan
2021-12-11 0:11 ` Paolo Bonzini
2021-12-11 2:01 ` Paolo Bonzini [this message]
2021-12-11 3:14 ` Lai Jiangshan
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=76d5e958-af0b-68fb-e6fa-ecdab8d79eeb@redhat.com \
--to=pbonzini@redhat.com \
--cc=dmatlack@google.com \
--cc=jiangshanlai@gmail.com \
--cc=kvm@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.