linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Acs <acsjakub@amazon.de>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	kernel test robot <lkp@intel.com>, <llvm@lists.linux.dev>,
	<oe-kbuild-all@lists.linux.dev>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Miguel Ojeda <ojeda@kernel.org>,
	Alice Ryhl <aliceryhl@google.com>
Subject: Re: [akpm-mm:mm-new 36/102] error[E0425]: cannot find value `VM_READ` in crate `bindings`
Date: Fri, 10 Oct 2025 07:44:58 +0000	[thread overview]
Message-ID: <20251010074458.GA91144@dev-dsk-acsjakub-1b-6f9934e2.eu-west-1.amazon.com> (raw)
In-Reply-To: <CANiq72kndiqwEm-OZLd6JumAaBy7KrzYf_rDjwhtw5Uh4vdTCg@mail.gmail.com>

On Fri, Oct 10, 2025 at 08:59:06AM +0200, Miguel Ojeda wrote:
> On Fri, Oct 10, 2025 at 8:07 AM Jakub Acs <acsjakub@amazon.de> wrote:
> >
> > FWIW Alice suggested the enum version and we discussed adjustment to the
> > patch in thread [1]. I was going to send new version of the patch as
> > soon as I figure out how to test for the issue pointed out by Derrick in
> > [2].
> >
> > Please let me know if that is desired or whether you're taking care of
> > it here. And/or how else I can help.
> 
> The `enum` approach is what we usually suggest if possible, and in
> this case it also avoids having to replicate conditional compilation
> on the Rust side, which is good.
> 
> However, using it here as-is means the resulting type of
> `VM_MERGEABLE` is `unsigned int`, not `unsigned long` -- but wasn't
> that an issue? i.e.
> 
>     https://lore.kernel.org/all/20250930130023.60106-1-acsjakub@amazon.de/
> 

This is a tricky one - VM_MERGEABLE being `unsigned int` is only an issue
if there are flags using any of the upper 32 bits. And if that is the
case, CONFIG_ARCH_USES_HIGH_VMA_FLAGS has to be 'y', -> thus the enum
will also have BIT(33), BIT(34), and so on. So from that perspective
we're ok (checked by running a reproducer).

> We may be able to use a dummy larger constant to force the compiler to
> pick a bigger underlying type, e.g. something like:
> 
>     __VM_FLAGS_FORCE_UL    = BIT(63),
> 
> But note that older versions of GCC and Clang keep the smaller `enum`
> constants as `int` (i.e. small and signed), even if they will pick
> `unsigned long` for the bigger ones. Newer versions will pick
> `unsigned long` for all.
> 
> The best would be to use C23-like `enum : unsigned long { ... }`, but
> sadly we don't have a recent enough GCC as a minimum in the kernel
> (GCC 13).
> 
> If there are extra complications with the `enum` approach (i.e. second
> link), then perhaps just replicating it on the Rust side is simpler.
> 

This ofc remains true, I'm not yet sure how to test that complication.

Thanks,
Jakub



Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christian Schlaeger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597

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

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09 17:42 kernel test robot
2025-10-09 18:05 ` Andrew Morton
2025-10-09 18:14   ` Miguel Ojeda
2025-10-09 18:15     ` Miguel Ojeda
2025-10-09 19:23       ` Andrew Morton
2025-10-10  6:07     ` Jakub Acs
2025-10-10  6:59       ` Miguel Ojeda
2025-10-10  7:44         ` Jakub Acs [this message]
2025-10-10  8:13           ` Miguel Ojeda
2025-10-10  8:19             ` Miguel Ojeda
2025-10-10  7:47         ` Miguel Ojeda

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=20251010074458.GA91144@dev-dsk-acsjakub-1b-6f9934e2.eu-west-1.amazon.com \
    --to=acsjakub@amazon.de \
    --cc=akpm@linux-foundation.org \
    --cc=aliceryhl@google.com \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=ojeda@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