lkml.org 
[lkml]   [2021]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/3] KVM: x86: Handle the case of 5-level shadow page table
On Sun, Aug 08, 2021, Wei Huang wrote:
> @@ -3457,10 +3457,19 @@ static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu)
> mmu->pae_root[i] = root | pm_mask;
> }
>
> - if (mmu->shadow_root_level == PT64_ROOT_4LEVEL)
> + /*
> + * Depending on the shadow_root_level, build the root_hpa table by
> + * chaining either pml5->pml4->pae or pml4->pae.
> + */
> + mmu->root_hpa = __pa(mmu->pae_root);
> + if (mmu->shadow_root_level >= PT64_ROOT_4LEVEL) {
> + mmu->pml4_root[0] = mmu->root_hpa | pm_mask;
> mmu->root_hpa = __pa(mmu->pml4_root);
> - else
> - mmu->root_hpa = __pa(mmu->pae_root);
> + }
> + if (mmu->shadow_root_level == PT64_ROOT_5LEVEL) {
> + mmu->pml5_root[0] = mmu->root_hpa | pm_mask;
> + mmu->root_hpa = __pa(mmu->pml5_root);
> + }

I still really dislike this approach, it requires visually connecting multiple
statements to understand the chain. I don't see any advantage (the 6-level paging
comment was 99.9% a joke) of rewriting root_hpa other than that's how it's done today.

In the future, please give reviewers ample opportunity to respond before sending
a new version if there's disagreement, otherwise the conversation gets carried
over into a different thread and loses the original context.

>
> set_root_pgd:
> mmu->root_pgd = root_pgd;

\
 
 \ /
  Last update: 2021-08-09 17:18    [W:0.090 / U:1.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site