Re: [PATCH v13 12/35] KVM: Prepare for handling only shared mappings in mmu_notifier events

From: Paolo Bonzini
Date: Thu Nov 02 2023 - 07:15:14 EST


On 11/2/23 06:59, Binbin Wu wrote:

Add flags to "struct kvm_gfn_range" to let notifier events target
only shared and only private mappings, and write up the existing
mmu_notifier events to be shared-only (private memory is never
associated with a userspace virtual address, i.e. can't be reached
via mmu_notifiers).

Add two flags so that KVM can handle the three possibilities
(shared, private, and shared+private) without needing something
like a tri-state enum.

I see the two flags are set/cleared in __kvm_handle_hva_range() in
this patch and kvm_handle_gfn_range() from the later patch 13/35, but
I didn't see they are used/read in this patch series if I didn't miss
anything. How are they supposed to be used in KVM?

They are going to be used by SNP/TDX patches.

Paolo