Re: [RFCv2 13/13] KVM: unmap guest memory using poisoned pages

Xiaoyao Li
2021-04-19T11:32:39Z

On 4/17/2021 1:30 AM, Sean Christopherson wrote:
> On Fri, Apr 16, 2021, Kirill A. Shutemov wrote:
[...]
>> index fadaccb95a4c..cd2374802702 100644
>> --- a/include/linux/kvm_host.h
>> +++ b/include/linux/kvm_host.h
>> @@ -436,6 +436,8 @@ static inline int kvm_arch_vcpu_memslots_id(struct kvm_vcpu *vcpu)
>> }
>> #endif
>>
>> +#define KVM_NR_SHARED_RANGES 32
>> +
>> /*
>> * Note:
>> * memslots are not sorted by id anymore, please use id_to_memslot()
>> @@ -513,6 +515,10 @@ struct kvm {
>> pid_t userspace_pid;
>> unsigned int max_halt_poll_ns;
>> u32 dirty_ring_size;
>> + bool mem_protected;
>> + void *id;
>> + int nr_shared_ranges;
>> + struct range shared_ranges[KVM_NR_SHARED_RANGES];
>
> Hard no for me. IMO, anything that requires KVM to track shared/pinned pages in
> a separate tree/array is non-starter. More specific to TDX #MCs, KVM should not
> be the canonical reference for the state of a page.
>

Do you mean something in struct page to track if the page is shared or
private?