linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: Pratyush Yadav <pratyush@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Alexander Graf <graf@amazon.com>,
	Jason Miu <jasonmiu@google.com>, Jonathan Corbet <corbet@lwn.net>,
	 kexec@lists.infradead.org, linux-doc@vger.kernel.org,
	 linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 5/6] kho: Relocate vmalloc preservation structure to KHO ABI header
Date: Thu, 22 Jan 2026 13:24:43 -0500	[thread overview]
Message-ID: <CA+CK2bB18ymLKh8YAyg8O44j5-7ttAfKC-Og-XMg5KQ=O_Xhwg@mail.gmail.com> (raw)
In-Reply-To: <2vxz5x8wcdv3.fsf@kernel.org>

On Tue, Jan 20, 2026 at 1:56 PM Pratyush Yadav <pratyush@kernel.org> wrote:
>
> On Tue, Jan 20 2026, Mike Rapoport wrote:
>
> > On Tue, Jan 20, 2026 at 04:26:51PM +0000, Pratyush Yadav wrote:
> >> On Mon, Jan 05 2026, Mike Rapoport wrote:
> >>
> >> > From: Jason Miu <jasonmiu@google.com>
> >> >
> >> > The `struct kho_vmalloc` defines the in-memory layout for preserving
> >> > vmalloc regions across kexec. This layout is a contract between kernels
> >> > and part of the KHO ABI.
> >> >
> >> > To reflect this relationship, the related structs and helper macros are
> >> > relocated to the ABI header, `include/linux/kho/abi/kexec_handover.h`.
> >> > This move places the structure's definition under the protection of the
> >> > KHO_FDT_COMPATIBLE version string.
> >> >
> >> > The structure and its components are now also documented within the
> >> > ABI header to describe the contract and prevent ABI breaks.
> >> >
> >> > Signed-off-by: Jason Miu <jasonmiu@google.com>
> >> > Co-developed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> >> > Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> >> [...]
> >> > +/* Helper macro to define a union for a serializable pointer. */
> >> > +#define DECLARE_KHOSER_PTR(name, type)    \
> >> > +  union {                        \
> >> > +          u64 phys;              \
> >> > +          type ptr;              \
> >> > +  } name
> >> > +
> >> > +/* Stores the physical address of a serializable pointer. */
> >> > +#define KHOSER_STORE_PTR(dest, val)               \
> >> > +  ({                                        \
> >> > +          typeof(val) v = val;              \
> >> > +          typecheck(typeof((dest).ptr), v); \
> >> > +          (dest).phys = virt_to_phys(v);    \
> >> > +  })
> >> > +
> >> > +/* Loads the stored physical address back to a pointer. */
> >> > +#define KHOSER_LOAD_PTR(src)                                              \
> >> > +  ({                                                                   \
> >> > +          typeof(src) s = src;                                         \
> >> > +          (typeof((s).ptr))((s).phys ? phys_to_virt((s).phys) : NULL); \
> >> > +  })
> >>
> >> Nit: not a fan of exposing code internals to the ABI header. But without
> >> this the definition of kho_vmalloc_hdr won't make any sense to someone
> >> reading the doc without looking at the code. Dunno if we can do anything
> >> better though...
> >
> > These might be actually useful for other KHO users.

In my view, khoser definition belongs in the kernel implementation
rather than the cross-kernel ABI. The ABI describes the preserved data
format and should be independent of C types. However, this is a minor
complaint compared to the overall effort of moving the preserved
format into the ABI and making KHO stateless. For that reason, let's
merge it.

Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>


  reply	other threads:[~2026-01-22 18:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05 16:58 [PATCH 0/6] kho: ABI headers and Documentation updates Mike Rapoport
2026-01-05 16:58 ` [PATCH 1/6] kho/abi: luo: make generated documentation more coherent Mike Rapoport
2026-01-20 15:48   ` Pratyush Yadav
2026-01-22 18:27   ` Pasha Tatashin
2026-01-05 16:58 ` [PATCH 2/6] kho/abi: memfd: " Mike Rapoport
2026-01-20 15:49   ` Pratyush Yadav
2026-01-22 18:28   ` Pasha Tatashin
2026-01-05 16:58 ` [PATCH 3/6] kho: docs: combine concepts and FDT documentation Mike Rapoport
2026-01-20 16:08   ` Pratyush Yadav
2026-01-20 18:35     ` Mike Rapoport
2026-01-20 18:36       ` Pratyush Yadav
2026-01-22 18:27   ` Pasha Tatashin
2026-01-05 16:58 ` [PATCH 4/6] kho: Introduce KHO FDT ABI header Mike Rapoport
2026-01-20 16:14   ` Pratyush Yadav
2026-01-22 18:29   ` Pasha Tatashin
2026-01-05 16:58 ` [PATCH 5/6] kho: Relocate vmalloc preservation structure to KHO " Mike Rapoport
2026-01-20 16:26   ` Pratyush Yadav
2026-01-20 18:42     ` Mike Rapoport
2026-01-20 18:56       ` Pratyush Yadav
2026-01-22 18:24         ` Pasha Tatashin [this message]
2026-01-05 16:58 ` [PATCH 6/6] kho/abi: add memblock " Mike Rapoport
2026-01-20 16:31   ` Pratyush Yadav
2026-01-20 18:44     ` Mike Rapoport
2026-01-22 18:25   ` Pasha Tatashin
2026-01-20 16:32 ` [PATCH 0/6] kho: ABI headers and Documentation updates Pratyush Yadav

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='CA+CK2bB18ymLKh8YAyg8O44j5-7ttAfKC-Og-XMg5KQ=O_Xhwg@mail.gmail.com' \
    --to=pasha.tatashin@soleen.com \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=graf@amazon.com \
    --cc=jasonmiu@google.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pratyush@kernel.org \
    --cc=rppt@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