[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYJbRTi_Z28F9is-@google.com>
Date: Tue, 3 Feb 2026 12:32:05 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Rick P Edgecombe <rick.p.edgecombe@...el.com>
Cc: Dave Hansen <dave.hansen@...el.com>, "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-coco@...ts.linux.dev" <linux-coco@...ts.linux.dev>, Kai Huang <kai.huang@...el.com>,
Xiaoyao Li <xiaoyao.li@...el.com>, Yan Y Zhao <yan.y.zhao@...el.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>, "kas@...nel.org" <kas@...nel.org>,
"binbin.wu@...ux.intel.com" <binbin.wu@...ux.intel.com>, "mingo@...hat.com" <mingo@...hat.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>, "ackerleytng@...gle.com" <ackerleytng@...gle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Isaku Yamahata <isaku.yamahata@...el.com>,
"sagis@...gle.com" <sagis@...gle.com>, "tglx@...nel.org" <tglx@...nel.org>, "bp@...en8.de" <bp@...en8.de>,
Vishal Annapurve <vannapurve@...gle.com>, "x86@...nel.org" <x86@...nel.org>
Subject: Re: [RFC PATCH v5 11/45] x86/tdx: Add helpers to check return status codes
On Fri, Jan 30, 2026, Rick P Edgecombe wrote:
> On Thu, 2026-01-29 at 12:35 -0800, Sean Christopherson wrote:
> > On Thu, Jan 29, 2026, Dave Hansen wrote:
> > > On 1/28/26 17:14, Sean Christopherson wrote:
> > > ...
> > > > err = tdh_mng_vpflushdone(&kvm_tdx->td);
> > > > - if (err == TDX_FLUSHVP_NOT_DONE)
> > > > + if (IS_TDX_FLUSHVP_NOT_DONE(err))
> > > > goto out;
> > > > if (TDX_BUG_ON(err, TDH_MNG_VPFLUSHDONE, kvm)) {
> > >
> > > I really despise the non-csopeable, non-ctaggable, non-greppable names
> > > like this. Sometimes it's unavoidable. Is it really unavoidable here?
> > >
> > > Something like this is succinct enough and doesn't have any magic ##
> > > macro definitions:
> > >
> > > TDX_ERR_EQ(err, TDX_FLUSHVP_NOT_DONE)
>
> I like the editor friendliness. The only downside is that it puts the onus on
> the caller to make sure supported defines are passed into TDX_ERR_EQ().
Eh, that's easy enough to handle with a static_assert().
> Today there are a few special cases like IS_TDX_NON_RECOVERABLE().
Why bother with a wrapper for that one? It's a single bit, just test that bit.
For me, providing IS_TDX_NON_RECOVERABLE() is _more_ confusing, because it
suggests that there's a NON_RECOVERABLE error, when in fact (IIUC) it's more or
less a modifier.
> I don't know, I'm ok either way. I lean towards keeping it as in this patch
> because we already had an error code bit interpretation bug:
> https://lore.kernel.org/kvm/24d2f165-f854-4996-89cf-28d644c592a3@intel.com/
>
> So the centralization of bit interpretation seems like a real win.
>
> > FWIW, I have zero preference on this. I included the patch purely because it was
> > already there.
>
> Ha, actually we all had a long thread on this:
> https://lore.kernel.org/kvm/70484aa1b553ca250d893f80b2687b5d915e5309.camel@intel.com/
Oh, it's _that_ discussion :-)
What I meant was, "I don't have a strong preference between TDX_ERR_EQ() and
this patch". What I didn't like was tdx_operand_invalid(), because that reads
like a command and it's not at all clear that it's macro-like in behavior.
I'd vote for IS_TDX_ERR() over TDX_ERR_EQ(), but either works for me (as does
this patch).
> I see now that we closed it with you but never got Dave's final buy in.
Powered by blists - more mailing lists