[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <925ef12f51fe22cd9154196a68137b6d106f9227.camel@intel.com>
Date: Wed, 4 Sep 2024 14:01:47 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "Zhao, Yan Y" <yan.y.zhao@...el.com>
CC: "seanjc@...gle.com" <seanjc@...gle.com>, "Huang, Kai"
<kai.huang@...el.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "isaku.yamahata@...il.com"
<isaku.yamahata@...il.com>, "dmatlack@...gle.com" <dmatlack@...gle.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>, "nik.borisov@...e.com"
<nik.borisov@...e.com>, "pbonzini@...hat.com" <pbonzini@...hat.com>
Subject: Re: [PATCH 19/21] KVM: TDX: Add an ioctl to create initial guest
memory
On Wed, 2024-09-04 at 12:53 +0800, Yan Zhao wrote:
> > + if (!kvm_mem_is_private(kvm, gfn)) {
> > + ret = -EFAULT;
> > + goto out_put_page;
> > + }
> > +
> > + ret = kvm_tdp_map_page(vcpu, gpa, error_code, &level);
> > + if (ret < 0)
> > + goto out_put_page;
> > +
> > + read_lock(&kvm->mmu_lock);
> Although mirrored root can't be zapped with shared lock currently, is it
> better to hold write_lock() here?
>
> It should bring no extra overhead in a normal condition when the
> tdx_gmem_post_populate() is called.
I think we should hold the weakest lock we can. Otherwise someday someone could
run into it and think the write_lock() is required. It will add confusion.
What was the benefit of a write lock? Just in case we got it wrong?
Powered by blists - more mailing lists