[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b34f2a0ce2b530efbb12c03f1b40ccf33b318dc.camel@intel.com>
Date: Tue, 14 Jan 2025 22:24:34 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "kvm@...r.kernel.org" <kvm@...r.kernel.org>, "pbonzini@...hat.com"
<pbonzini@...hat.com>, "seanjc@...gle.com" <seanjc@...gle.com>, "Zhao, Yan Y"
<yan.y.zhao@...el.com>
CC: "Huang, Kai" <kai.huang@...el.com>, "binbin.wu@...ux.intel.com"
<binbin.wu@...ux.intel.com>, "Li, Xiaoyao" <xiaoyao.li@...el.com>, "Lindgren,
Tony" <tony.lindgren@...el.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "Chatre, Reinette"
<reinette.chatre@...el.com>, "dmatlack@...gle.com" <dmatlack@...gle.com>,
"Hunter, Adrian" <adrian.hunter@...el.com>, "Yamahata, Isaku"
<isaku.yamahata@...el.com>, "isaku.yamahata@...il.com"
<isaku.yamahata@...il.com>
Subject: Re: [PATCH 1/7] KVM: TDX: Return -EBUSY when tdh_mem_page_add()
encounters TDX_OPERAND_BUSY
On Mon, 2025-01-13 at 10:10 +0800, Yan Zhao wrote:
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index d0dc3200fa37..1cf3ef0faff7 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -3024,13 +3024,11 @@ static int tdx_gmem_post_populate(struct kvm *kvm, gfn_t gfn, kvm_pfn_t pfn,
> }
>
> ret = 0;
> - do {
> - err = tdh_mem_page_add(kvm_tdx->tdr_pa, gpa, pfn_to_hpa(pfn),
> - pfn_to_hpa(page_to_pfn(page)),
> - &entry, &level_state);
> - } while (err == TDX_ERROR_SEPT_BUSY);
> + err = tdh_mem_page_add(kvm_tdx->tdr_pa, gpa, pfn_to_hpa(pfn),
> + pfn_to_hpa(page_to_pfn(page)),
> + &entry, &level_state);
> if (err) {
> - ret = -EIO;
> + ret = unlikely(err & TDX_OPERAND_BUSY) ? -EBUSY : -EIO;
> goto out;
> }
Should we just squash this into "KVM: TDX: Add an ioctl to create initial guest
memory"? I guess we get a little more specific log history on this corner as a
separate patch, but seems strange to add and remove a loop before it even can
get exercised.
Powered by blists - more mailing lists