[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aBD_rOvMPk5_iT9J@kernel.org>
Date: Tue, 29 Apr 2025 19:34:52 +0300
From: Mike Rapoport <rppt@...nel.org>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Changyuan Lyu <changyuanl@...gle.com>, linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org, anthony.yznaga@...cle.com, arnd@...db.de,
ashish.kalra@....com, benh@...nel.crashing.org, bp@...en8.de,
catalin.marinas@....com, corbet@....net,
dave.hansen@...ux.intel.com, devicetree@...r.kernel.org,
dwmw2@...radead.org, ebiederm@...ssion.com, graf@...zon.com,
hpa@...or.com, jgowans@...zon.com, kexec@...ts.infradead.org,
krzk@...nel.org, linux-arm-kernel@...ts.infradead.org,
linux-doc@...r.kernel.org, linux-mm@...ck.org, luto@...nel.org,
mark.rutland@....com, mingo@...hat.com, pasha.tatashin@...een.com,
pbonzini@...hat.com, peterz@...radead.org, ptyadav@...zon.de,
robh@...nel.org, rostedt@...dmis.org, saravanak@...gle.com,
skinsburskii@...ux.microsoft.com, tglx@...utronix.de,
thomas.lendacky@....com, will@...nel.org, x86@...nel.org
Subject: Re: [PATCH v6 11/14] x86: add KHO support
On Tue, Apr 29, 2025 at 09:05:02AM -0700, Dave Hansen wrote:
> On 4/29/25 08:53, Mike Rapoport wrote:
> > On Mon, Apr 28, 2025 at 03:05:55PM -0700, Dave Hansen wrote:
> >> On 4/10/25 22:37, Changyuan Lyu wrote:
> >>> From: Alexander Graf <graf@...zon.com>
> >>>
> >>> +#ifdef CONFIG_KEXEC_HANDOVER
> >>> +static bool process_kho_entries(unsigned long minimum, unsigned long image_size)
> >>> +{
> >>> + struct kho_scratch *kho_scratch;
> >>> + struct setup_data *ptr;
> >>> + int i, nr_areas = 0;
> >>
> >> Do these really need actual #ifdefs or will a nice IS_ENABLED() check
> >> work instead?
> >>
> >>> + ptr = (struct setup_data *)(unsigned long)boot_params_ptr->hdr.setup_data;
> >>
> >> What's with the double cast?
> >
> > The double cast is required for this to be compiled on 32 bits (just like
> > in mem_avoid_overlap). The setup_data is all u64 and to cast it to a
> > pointer on 32 bit it has to go via unsigned long.
>
> Let's just make KHO depend on 64BIT, at least on x86.
Ok, so we are keeping #ifdef and dropping double cast here.
> >>> diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c
> >>> index 68530fad05f74..518635cc0876c 100644
> >>> --- a/arch/x86/kernel/kexec-bzimage64.c
> >>> +++ b/arch/x86/kernel/kexec-bzimage64.c
> >>> @@ -233,6 +233,31 @@ setup_ima_state(const struct kimage *image, struct boot_params *params,
> >>> #endif /* CONFIG_IMA_KEXEC */
> >>> }
> >>>
> >>> +static void setup_kho(const struct kimage *image, struct boot_params *params,
> >>> + unsigned long params_load_addr,
> >>> + unsigned int setup_data_offset)
> >>> +{
> >>> +#ifdef CONFIG_KEXEC_HANDOVER
> >>
> >> Can this #ifdef be replaced with IS_ENABLED()?
> >
> > The KHO structures in kexec image are under #ifdef, so it won't compile
> > with IS_ENABLED().
>
> They shouldn't be. Define them unconditionally, please.
>
> ...
> >> Please axe the #ifdef in the .c file if at all possible, just like the
> >> others.
> >
> > This one follows IMA, but it's easy to make it IS_ENABLED(). It's really up
> > to x86 folks preference.
>
> Last I checked, I'm listed under the big M: for "X86 ARCHITECTURE". ;)
I remember :)
--
Sincerely yours,
Mike.
Powered by blists - more mailing lists