[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGtprH8A8zLLPVUdRjy179Rn=MtwzSUk8UDbR+XPws2+J4h-hw@mail.gmail.com>
Date: Mon, 10 Feb 2025 10:08:03 -0800
From: Vishal Annapurve <vannapurve@...gle.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, pbonzini@...hat.com,
erdemaktas@...gle.com, ackerleytng@...gle.com, jxgao@...gle.com,
sagis@...gle.com, oupton@...gle.com, pgonda@...gle.com, kirill@...temov.name,
dave.hansen@...ux.intel.com, linux-coco@...ts.linux.dev,
chao.p.peng@...ux.intel.com, isaku.yamahata@...il.com,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: Re: [PATCH V3 2/2] x86/tdx: Emit warning if IRQs are enabled during
HLT #VE handling
On Fri, Feb 7, 2025 at 7:22 AM Sean Christopherson <seanjc@...gle.com> wrote:
>
> On Thu, Feb 06, 2025, Vishal Annapurve wrote:
> ...
> > ---
> > arch/x86/coco/tdx/tdx.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
> > index 5e68758666a4..ed6738ea225c 100644
> > --- a/arch/x86/coco/tdx/tdx.c
> > +++ b/arch/x86/coco/tdx/tdx.c
> > @@ -393,6 +393,11 @@ static int handle_halt(struct ve_info *ve)
> > {
> > const bool irq_disabled = irqs_disabled();
> >
> > + if (!irq_disabled) {
>
> Wrap the check with WARN_ONCE(), doing so adds an unlikely to the <drum roll>
> unlikely scenario.
>
> > + WARN_ONCE(1, "HLT instruction emulation unsafe with irqs enabled\n");
>
> Newline is redundant, the WARN does that for you. IMO, it's also worth adding
> a comment, because this is like the fifth time "safe halt" has come up in the
> context of TDX.
>
> E.g.
>
> /*
> * HLT with IRQs enabled is unsafe, as an IRQ that is intended to be a
> * wake event may be consumed before requesting HLT emulation, leaving
> * the vCPU blocking indefinitely.
> */
> if (WARN_ONCE(!irq_disabled, "HLT emulation with IRQs enabled"))
> return -EIO;
Ack, will integrate this feedback in v4.
Thanks,
Vishal
Powered by blists - more mailing lists