[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b9b7f7a-cfc6-1e56-aeb2-d3a7e445fe14@redhat.com>
Date: Mon, 7 Feb 2022 15:35:23 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: David Matlack <dmatlack@...gle.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
seanjc@...gle.com, vkuznets@...hat.com
Subject: Re: [PATCH 06/23] KVM: MMU: load new PGD once nested two-dimensional
paging is initialized
On 2/7/22 14:50, Paolo Bonzini wrote:
>>>
>> Those checks are just for performance correct (to skip iterating through
>> the list of roots)?
>>
>> Either way, it's probably worth including a Fixes tag below.
>
> There's no bug because __kvm_mmu_new_pgd is passed a correct new_role.
> But it's unnecessarily complex as shown by patches 7 and 9.
root_level is not part of the role, but we're still safe because
changing it requires to flip CR0.PG to 0 and back to 1. This calls
kvm_mmu_reset_context and unloads all roots, so it's not possible to
have a cached PGD with the wrong root level. On the first call the
root_level might be incorrect, but then again there's no cached PGD.
(Also, shadow_root_level is either always or never >= PT64_ROOT_4LEVEL,
so it's okay unless the guest_mmu was never set up and therefore no
cached PGD exists).
Paolo
Powered by blists - more mailing lists