[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fb6cd8b4-eee9-6e58-4047-550811bffd58@redhat.com>
Date: Mon, 19 Aug 2019 17:04:23 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Yang Weijiang <weijiang.yang@...el.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, sean.j.christopherson@...el.com
Cc: mst@...hat.com, rkrcmar@...hat.com, jmattson@...gle.com,
yu.c.zhang@...el.com, alazar@...defender.com
Subject: Re: [PATCH RESEND v4 7/9] KVM: VMX: Handle SPP induced vmexit and
page fault
On 19/08/19 16:43, Paolo Bonzini wrote:
>> + /*
>> + * Record write protect fault caused by
>> + * Sub-page Protection, let VMI decide
>> + * the next step.
>> + */
>> + if (spte & PT_SPP_MASK) {
> Should this be "if (spte & PT_WRITABLE_MASK)" instead? That is, if the
> page is already writable, the fault must be an SPP fault.
Hmm, no I forgot how SPP works; still, this is *not* correct. For
example, if SPP marks part of a page as read-write, but KVM wants to
write-protect the whole page for access or dirty tracking, that should
not cause an SPP exit.
So I think that when KVM wants to write-protect the whole page
(wrprot_ad_disabled_spte) it must also clear PT_SPP_MASK; for example it
could save it in bit 53 (PT64_SECOND_AVAIL_BITS_SHIFT + 1). If the
saved bit is set, fast_page_fault must then set PT_SPP_MASK instead of
PT_WRITABLE_MASK. On re-entry this will cause an SPP vmexit;
fast_page_fault should never trigger an SPP userspace exit on its own,
all the SPP handling should go through handle_spp.
Paolo
Powered by blists - more mailing lists