[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DS0PR11MB63733FFA02B4A5C04561A1BFDC50A@DS0PR11MB6373.namprd11.prod.outlook.com>
Date: Thu, 8 Jun 2023 01:43:27 +0000
From: "Wang, Wei W" <wei.w.wang@...el.com>
To: Isaku Yamahata <isaku.yamahata@...il.com>
CC: "Yamahata, Isaku" <isaku.yamahata@...el.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
"Aktas, Erdem" <erdemaktas@...gle.com>,
"Christopherson,, Sean" <seanjc@...gle.com>,
"Shahar, Sagi" <sagis@...gle.com>,
David Matlack <dmatlack@...gle.com>,
"Huang, Kai" <kai.huang@...el.com>,
Zhi Wang <zhi.wang.linux@...il.com>,
"Chen, Bo2" <chen.bo@...el.com>,
Sean Christopherson <sean.j.christopherson@...el.com>
Subject: RE: [PATCH v14 011/113] KVM: TDX: Add C wrapper functions for
SEAMCALLs to the TDX module
On Thursday, June 8, 2023 2:16 AM, Isaku Yamahata wrote:
> On Mon, Jun 05, 2023 at 03:20:19PM +0000, "Wang, Wei W"
> <wei.w.wang@...el.com> wrote:
> > > +static inline u64 kvm_seamcall(u64 op, u64 rcx, u64 rdx, u64 r8, u64 r9,
> > > + struct tdx_module_output *out) {
> > > + u64 ret;
> > > +
> > > + ret = __seamcall(op, rcx, rdx, r8, r9, out);
> > > + if (unlikely(ret == TDX_SEAMCALL_UD)) {
> > > + /*
> > > + * TDX requires VMXON or #UD. In the case of reboot or
> > > kexec,
> > > + * VMX is made off (VMXOFF) by kvm reboot notifier,
> > > + * kvm_reboot(), while TDs are still running. The callers
> > > check
> > > + * the returned error and complain. Suppress it by returning 0.
> > > + */
> >
> > Curious how do the callers check the returned error when " Suppress it
> > by returning 0" here.
>
> It doesn't make sense for the caller to check the error and warn when
> kvm_rebooting = true.
> Let's make it "return kvm_rebooting ? 0 : ret;" instread of "return 0;".
> Does it make sense?
Seems no need. The comments look confusing, and not aligned to what
the code achieves. From what I read:
- if kvm_rebooting=true there: return 0 to caller and no error or warning happens
- if kvm_rebooting=false there: crash the system via kvm_spurious_fault.
In this non-rebooting case, I think the callers don’t get a chance to read the
returned value and complain.
Another thing is, have you double-checked that invocation of seamcalls
indeed returns TDX_SEAMCALL_UD when VMX=off?
Powered by blists - more mailing lists