The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Pratyush Yadav <pratyush@kernel.org>
To: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Tarun Sahu <tarunsahu@google.com>,
	 Pratyush Yadav <pratyush@kernel.org>,
	 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: Thu, 09 Jul 2026 12:20:19 +0200	[thread overview]
Message-ID: <2vxzldbklb18.fsf@kernel.org> (raw)
In-Reply-To: <178271651966.13502.2620034351625890943.b4-review@b4> (Pasha Tatashin's message of "Mon, 29 Jun 2026 07:01:59 +0000")

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.

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

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

      reply	other threads:[~2026-07-09 10:20 UTC|newest]

Thread overview: 6+ 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 [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=2vxzldbklb18.fsf@kernel.org \
    --to=pratyush@kernel.org \
    --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=pasha.tatashin@soleen.com \
    --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