Messages in this thread | | | Date | Wed, 13 Mar 2024 10:14:28 -0700 | From | Isaku Yamahata <> | Subject | Re: [PATCH v19 011/130] KVM: Add new members to struct kvm_gfn_range to operate on |
| |
On Tue, Mar 12, 2024 at 09:33:31PM +0800, Binbin Wu <binbin.wu@linux.intel.com> wrote:
> > > On 2/26/2024 4:25 PM, isaku.yamahata@intel.com wrote: > > From: Isaku Yamahata <isaku.yamahata@intel.com> > > > > Add new members to strut kvm_gfn_range to indicate which mapping > > (private-vs-shared) to operate on. only_private and only_shared. Update > > mmu notifier, set memory attributes ioctl or KVM gmem callback to > > initialize them. > > > > It was premature for set_memory_attributes ioctl to call > > kvm_unmap_gfn_range(). Instead, let kvm_arch_ste_memory_attributes() > "kvm_arch_ste_memory_attributes()" -> "kvm_vm_set_mem_attributes()" ?
Yes, will fix it.
> > handle it and add a new x86 vendor callback to react to memory attribute > > change. [1] > Which new x86 vendor callback?
Now we don't have it. Will drop this sentnse.
> > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > > index 7e7fd25b09b3..0520cd8d03cc 100644 > > --- a/include/linux/kvm_host.h > > +++ b/include/linux/kvm_host.h > > @@ -264,6 +264,8 @@ struct kvm_gfn_range { > > gfn_t start; > > gfn_t end; > > union kvm_mmu_notifier_arg arg; > > + bool only_private; > > + bool only_shared; > > IMO, an enum will be clearer than the two flags. > > enum { > PROCESS_PRIVATE_AND_SHARED, > PROCESS_ONLY_PRIVATE, > PROCESS_ONLY_SHARED, > };
The code will be ugly like "if (== PRIVATE || == PRIVATE_AND_SHARED)" or "if (== SHARED || == PRIVATE_AND_SHARED)"
two boolean (or two flags) is less error-prone.
Thanks, -- Isaku Yamahata <isaku.yamahata@intel.com>
| |