linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: akpm@linux-foundation.org, brauner@kernel.org, corbet@lwn.net,
	graf@amazon.com, jgg@ziepe.ca, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
	masahiroy@kernel.org, ojeda@kernel.org, pratyush@kernel.org,
	rdunlap@infradead.org, tj@kernel.org, jasonmiu@google.com,
	dmatlack@google.com, skhawaja@google.com
Subject: Re: [PATCH v6 01/10] kho: allow to drive kho from within kernel
Date: Mon, 20 Oct 2025 10:43:37 +0300	[thread overview]
Message-ID: <aPXoKRVAyGWCNj8I@kernel.org> (raw)
In-Reply-To: <20251018171756.1724191-2-pasha.tatashin@soleen.com>

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

> drive the KHO sequence via its own state machine.
> 
> Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> Reviewed-by: Pratyush Yadav <pratyush@kernel.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

> +	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.

>  }

-- 
Sincerely yours,
Mike.


  reply	other threads:[~2025-10-20  7:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-18 17:17 [PATCH v6 00/10] liveupdate: Rework KHO for in-kernel users & Fix memory corruption Pasha Tatashin
2025-10-18 17:17 ` [PATCH v6 01/10] kho: allow to drive kho from within kernel Pasha Tatashin
2025-10-20  7:43   ` Mike Rapoport [this message]
2025-10-21 16:08     ` Pasha Tatashin
2025-10-18 17:17 ` [PATCH v6 02/10] kho: make debugfs interface optional Pasha Tatashin
2025-10-18 17:17 ` [PATCH v6 03/10] kho: drop notifiers Pasha Tatashin
2025-10-18 17:17 ` [PATCH v6 04/10] kho: add interfaces to unpreserve folios and page ranes Pasha Tatashin
2025-10-18 17:17 ` [PATCH v6 05/10] kho: don't unpreserve memory during abort Pasha Tatashin
2025-10-18 17:17 ` [PATCH v6 06/10] liveupdate: kho: move to kernel/liveupdate Pasha Tatashin
2025-10-18 17:17 ` [PATCH v6 07/10] kho: move kho debugfs directory to liveupdate Pasha Tatashin
2025-10-18 17:17 ` [PATCH v6 08/10] liveupdate: kho: warn and fail on metadata or preserved memory in scratch area Pasha Tatashin
2025-10-20  7:56   ` Mike Rapoport
2025-10-20 21:56     ` Pasha Tatashin
2025-10-18 17:17 ` [PATCH v6 09/10] liveupdate: kho: Increase metadata bitmap size to PAGE_SIZE Pasha Tatashin
2025-10-20  8:03   ` Mike Rapoport
2025-10-20 22:09     ` Pasha Tatashin
2025-10-18 17:17 ` [PATCH v6 10/10] liveupdate: kho: allocate metadata directly from the buddy allocator Pasha Tatashin
2025-10-20  8:05   ` Mike Rapoport
2025-10-20 22:17     ` Pasha Tatashin
2025-10-20  8:34 ` [PATCH v6 00/10] liveupdate: Rework KHO for in-kernel users & Fix memory corruption Mike Rapoport
2025-10-20 13:46   ` Pasha Tatashin
2025-10-20 13:47     ` Pasha Tatashin
2025-10-20 18:12     ` Mike Rapoport

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aPXoKRVAyGWCNj8I@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dmatlack@google.com \
    --cc=graf@amazon.com \
    --cc=jasonmiu@google.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=masahiroy@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=pratyush@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhawaja@google.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox