[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <68943e0b-8d82-42de-8f09-058e97d9a392@intel.com>
Date: Tue, 4 Jun 2024 09:27:59 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>,
Elena Reshetova <elena.reshetova@...el.com>,
Jun Nakajima <jun.nakajima@...el.com>,
Rick Edgecombe <rick.p.edgecombe@...el.com>,
Tom Lendacky <thomas.lendacky@....com>, "Kalra, Ashish"
<ashish.kalra@....com>, Sean Christopherson <seanjc@...gle.com>,
"Huang, Kai" <kai.huang@...el.com>, Ard Biesheuvel <ardb@...nel.org>,
Baoquan He <bhe@...hat.com>, "H. Peter Anvin" <hpa@...or.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>, kexec@...ts.infradead.org,
linux-hyperv@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-coco@...ts.linux.dev, linux-kernel@...r.kernel.org,
Tao Liu <ltao@...hat.com>
Subject: Re: [PATCHv11 11/19] x86/tdx: Convert shared memory back to private
on kexec
On 5/28/24 02:55, Kirill A. Shutemov wrote:
> +/* Stop new private<->shared conversions */
> +static void tdx_kexec_begin(bool crash)
> +{
> + /*
> + * Crash kernel reaches here with interrupts disabled: can't wait for
> + * conversions to finish.
> + *
> + * If race happened, just report and proceed.
> + */
> + if (!set_memory_enc_stop_conversion(!crash))
> + pr_warn("Failed to stop shared<->private conversions\n");
> +}
I don't like having to pass 'crash' in here.
If interrupts are the problem we have ways of testing for those directly.
If it's being in an oops that's a problem, we have 'oops_in_progress'
for that.
In other words, I'd much rather this function (or better yet
set_memory_enc_stop_conversion() itself) use some existing API to change
its behavior in a crash rather than have the context be passed down and
twiddled through several levels of function calls.
There are a ton of these in the console code:
if (oops_in_progress)
foo_trylock();
else
foo_lock();
To me, that's a billion times more clear than a 'wait' argument that
gets derives from who-knows-what that I have to trace through ten levels
of function calls.
Powered by blists - more mailing lists