lkml.org 
[lkml]   [2022]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 06/23] KVM: MMU: load new PGD once nested two-dimensional paging is initialized
From
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

\
 
 \ /
  Last update: 2022-02-07 16:10    [W:0.583 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site