The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: Pratyush Yadav <pratyush@kernel.org>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>,
	 Tarun Sahu <tarunsahu@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,  Mike Rapoport <rppt@kernel.org>,
	Alexander Graf <graf@amazon.com>,
	skhawaja@google.com,  kexec@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 3/3] luo: Update serialized data to use KHOSER_PTR
Date: Fri, 24 Jul 2026 16:46:04 +0000	[thread overview]
Message-ID: <amOWTew3JpsY4QcB@plex> (raw)
In-Reply-To: <2vxzldbklb18.fsf@kernel.org>

On 07-09 12:20, Pratyush Yadav wrote:
> Hi Pasha,
> 
> On Mon, Jun 29 2026, Pasha Tatashin wrote:
> 
> > On Sun, 28 Jun 2026 00:11:14 +0000, Tarun Sahu <tarunsahu@google.com> wrote:
> >> diff --git a/include/linux/kho/abi/luo.h b/include/linux/kho/abi/luo.h
> >> index 288076de6d4a..9e78625cfdc1 100644
> >> --- a/include/linux/kho/abi/luo.h
> >> +++ b/include/linux/kho/abi/luo.h
> >> @@ -89,14 +90,14 @@ struct luo_ser {
> >>  /**
> >>   * struct luo_file_ser - Represents the serialized preserves files.
> >>   * @compatible:  File handler compatible string.
> >> - * @data:        Private data
> >> + * @serialized_data:  The serialized KHO pointer for this file
> >
> > I am concerned about layring violation here.
> >
> > LUO is designed as  a generic, opaque transport layer that promises to 
> > preserve 64 bits of raw data. How those 64 bits are interpreted is 
> > entirely up to individual clients.
> >
> > While some clients like memfd_luo will use those 64 bits as a physical 
> > address pointing to KHO-preserved structures, other clients may store a 
> > generic token, cookie, index, or non-pointer status. By
> > changing u64 data to DECLARE_KHOSER_PTR(serialized_data, void *) in 
> > struct luo_file_ser, we force KHO pointer semantics and layout 
> > constraints on all generic LUO files.
> 
> That makes sense theory, but in practice, no file handler is going to
> need only 8 bytes for its metadata. It is always going to need more, and
> to store more information, it needs to store a pointer to that
> information with the 64 bits it gets.
> 
> Do you have any examples of something else one might store here?
> 
> At least looking at the current file handlers merged and in flight,
> memfd, iommufd, vfio, pci, hugetlb, guest_memfd, all of them store a
> pointer here.

Right, and all of those types are private to file-handlers, not to LUO, 
so my question is:

> 
> And if everyone is only storing pointers in this field, might as well
> give them a bit of type safety.

How khoser helps void * type?

Pasha

> 
> >
> > Clients that need KHO pointer serialization must cast that opaque 64-bit 
> > value to/from a  KHOSER_PTR  within their own callbacks.
> >
> > Also, the field descriptions in  struct luo_file_ser  are no longer 
> > aligned due to the length of the new variable name, I believe it will 
> > cause warning when making docs.
> 
> -- 
> Regards,
> Pratyush Yadav

      parent reply	other threads:[~2026-07-24 16:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-28  0:11 [PATCH v6 0/3] luo: convert serialized ptr to KHOSER_PTR Tarun Sahu
2026-06-28  0:11 ` [PATCH v6 1/3] mm/memfd_luo: validate serialized_data before conversion Tarun Sahu
2026-06-28  0:11 ` [PATCH v6 2/3] kho: add KHOSER_COPY_PTR to allow phys copy of serialized ptr Tarun Sahu
2026-06-28  0:11 ` [PATCH v6 3/3] luo: Update serialized data to use KHOSER_PTR Tarun Sahu
2026-06-29  7:01   ` Pasha Tatashin
2026-07-09 10:20     ` Pratyush Yadav
2026-07-23 15:33       ` tarunsahu
2026-07-24 16:46       ` Pasha Tatashin [this message]

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=amOWTew3JpsY4QcB@plex \
    --to=pasha.tatashin@soleen.com \
    --cc=akpm@linux-foundation.org \
    --cc=graf@amazon.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    --cc=skhawaja@google.com \
    --cc=tarunsahu@google.com \
    /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