lkml.org 
[lkml]   [2021]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH Part2 RFC v4 20/40] KVM: SVM: Make AVIC backing, VMSA and VMCB memory allocation SNP safe
From
Date
Hi Sean,


On 7/20/21 1:02 PM, Sean Christopherson wrote:
> IMO, the CPU behavior is a bug, even if the behavior is working as intended for
> the microarchitecture. I.e. this should be treated as an erratum.
>

I agreed with your comment that it should be treated as an erratum. I
now have agreement from the hardware team to publish this as an erratum
with explanation and recommendation. This will certainly help in
documenting on "why" we are making the page split.

...

>>
>> - apic->regs = (void *)get_zeroed_page(GFP_KERNEL_ACCOUNT);
>> + if (kvm_x86_ops.alloc_apic_backing_page)
>> + apic->regs = kvm_x86_ops.alloc_apic_backing_page(vcpu);
>
> This can be a static_call().

Noted.

>
> This isn't "finding" anything, it's identifying which of the two pages is
> _guaranteed_ to be unaligned. The whole function needs a much bigger comment to
> explain what's going on.

Let me add more comment to clarify it.

>
>> + pfn = page_to_pfn(p);
>> + if (IS_ALIGNED(__pfn_to_phys(pfn), PMD_SIZE)) {
>> + pfn++;
>> + __free_page(p);
>> + } else {
>> + __free_page(pfn_to_page(pfn + 1));
>> + }
>> +
>> + return pfn_to_page(pfn);
>> +}

thanks

\
 
 \ /
  Last update: 2021-08-03 16:39    [W:0.145 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site