[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+CK2bD9RHEWZd+t7kWFxofOjBVLd-e+gQTheNJxZbSFy84rfA@mail.gmail.com>
Date: Tue, 21 Oct 2025 12:08:02 -0400
From: Pasha Tatashin <pasha.tatashin@...een.com>
To: Mike Rapoport <rppt@...nel.org>
Cc: akpm@...ux-foundation.org, brauner@...nel.org, corbet@....net,
graf@...zon.com, jgg@...pe.ca, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-mm@...ck.org, masahiroy@...nel.org,
ojeda@...nel.org, pratyush@...nel.org, rdunlap@...radead.org, tj@...nel.org,
jasonmiu@...gle.com, dmatlack@...gle.com, skhawaja@...gle.com
Subject: Re: [PATCH v6 01/10] kho: allow to drive kho from within kernel
On Mon, Oct 20, 2025 at 3:43 AM Mike Rapoport <rppt@...nel.org> wrote:
>
> On Sat, Oct 18, 2025 at 01:17:47PM -0400, Pasha Tatashin wrote:
> > Allow to do finalize and abort from kernel modules, so LUO could
>
> We surely don't want modules being able to drive that. Maybe
>
> allow kernel to drive finalize and abort without requiring triggers
> from the userspace
done
>
> > drive the KHO sequence via its own state machine.
> >
> > Signed-off-by: Pasha Tatashin <pasha.tatashin@...een.com>
> > Reviewed-by: Pratyush Yadav <pratyush@...nel.org>
> > ---
> > include/linux/kexec_handover.h | 15 +++++++
> > kernel/kexec_handover.c | 74 ++++++++++++++++++++--------------
> > 2 files changed, 59 insertions(+), 30 deletions(-)
>
> ...
>
> > diff --git a/kernel/kexec_handover.c b/kernel/kexec_handover.c
> > index 76f0940fb485..76c34ea923f0 100644
> > --- a/kernel/kexec_handover.c
> > +++ b/kernel/kexec_handover.c
> > @@ -1067,7 +1067,7 @@ static int kho_out_update_debugfs_fdt(void)
> > return err;
> > }
> >
> > -static int kho_abort(void)
> > +static int __kho_abort(void)
> > {
> > int err;
> > unsigned long order;
> > @@ -1100,7 +1100,27 @@ static int kho_abort(void)
> > return err;
> > }
> >
> > -static int kho_finalize(void)
> > +int kho_abort(void)
> > +{
> > + int ret = 0;
> > +
> > + if (!kho_enable)
> > + return -EOPNOTSUPP;
> > +
> > + guard(mutex)(&kho_out.lock);
>
> Please include linux/cleanup.h explicitly
That is going to be included via kfence fixes which will come before this patch.
>
> > + if (!kho_out.finalized)
> > + return -ENOENT;
> > +
>
> ...
>
> > -unlock:
> > - mutex_unlock(&kho_out.lock);
> > - return ret;
> > + return (!!_val) ? kho_finalize() : kho_abort();
>
> An 'if' would be cleared IMO:
>
> if (val)
> return kho_finalize();
> else
> return kho_abort();
>
> and we can rename u64 _val to u64 val as we are dropping the boolean.
done
>
> > }
>
> --
> Sincerely yours,
> Mike.
Powered by blists - more mailing lists