[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce1b2bc760daf9cc07591bdc4d3e83e40391f468.camel@intel.com>
Date: Wed, 14 Dec 2022 10:51:31 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>
CC: "pbonzini@...hat.com" <pbonzini@...hat.com>,
"Shahar, Sagi" <sagis@...gle.com>,
"Aktas, Erdem" <erdemaktas@...gle.com>,
"isaku.yamahata@...il.com" <isaku.yamahata@...il.com>,
"dmatlack@...gle.com" <dmatlack@...gle.com>,
"Christopherson,, Sean" <seanjc@...gle.com>
Subject: Re: [PATCH v10 046/108] KVM: Add flags to struct kvm_gfn_range
On Sat, 2022-10-29 at 23:22 -0700, isaku.yamahata@...el.com wrote:
> From: Isaku Yamahata <isaku.yamahata@...el.com>
>
> kvm_unmap_gfn_range() needs to know the reason of the callback for TDX.
> mmu notifier, set memattr ioctl or restrictedmem notifier. Based on the
> reason, TDX changes the behavior. For mmu notifier, it's the operation on
> shared memory slot to zap shared PTE. For set memattr, private<->shared
> conversion, zap the original PTE. For restrictedmem, it's a hint that TDX
> can ignore.
Could you elaborate why restricted memfd notifier can be ignored? IIUC if
userspace punch a hole, the pages within the hole will be de-allocated. So why
can such notifier be ignored?
Btw, I think this patch should be just merged to the patch which consumes those
flags (checked it is next patch). It's easier to review when putting them
together.
>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
> ---
> include/linux/kvm_host.h | 8 +++++++-
> virt/kvm/kvm_main.c | 5 ++++-
> 2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index 839d98d56632..b658803ea2c7 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -247,12 +247,18 @@ int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu);
>
>
> #if defined(KVM_ARCH_WANT_MMU_NOTIFIER) || defined(CONFIG_HAVE_KVM_RESTRICTED_MEM)
> +#define KVM_GFN_RANGE_FLAGS_RESTRICTED_MEM BIT(0)
> +#define KVM_GFN_RANGE_FLAGS_SET_MEM_ATTR BIT(1)
> struct kvm_gfn_range {
> struct kvm_memory_slot *slot;
> gfn_t start;
> gfn_t end;
> - pte_t pte;
> + union {
> + pte_t pte;
> + int attr;
> + };
attribute is u64 in Chao's series.
> bool may_block;
> + unsigned int flags;
> };
Powered by blists - more mailing lists