public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4•com>
To: Christophe Leroy <christophe.leroy@csgroup•eu>
Cc: Theodore Ts'o <tytso@mit•edu>, Arnd Bergmann <arnd@arndb•de>,
	Andy Lutomirski <luto@kernel•org>,
	Thomas Gleixner <tglx@linutronix•de>,
	Vincenzo Frascino <vincenzo.frascino@arm•com>,
	Ingo Molnar <mingo@redhat•com>, Borislav Petkov <bp@alien8•de>,
	Dave Hansen <dave.hansen@linux•intel.com>,
	x86@kernel•org, "H. Peter Anvin" <hpa@zytor•com>,
	linux-kernel@vger•kernel.org, linuxppc-dev@lists•ozlabs.org,
	linux-arch@vger•kernel.org
Subject: Re: [PATCH 2/4] random: vDSO: Don't use PAGE_SIZE and PAGE_MASK
Date: Tue, 27 Aug 2024 09:49:58 +0200	[thread overview]
Message-ID: <Zs2FJku2hM2bp4ik@zx2c4.com> (raw)
In-Reply-To: <b8f8fb6d1d10386c74f2d8826b737a74c60b76b2.1724743492.git.christophe.leroy@csgroup.eu>

On Tue, Aug 27, 2024 at 09:31:48AM +0200, Christophe Leroy wrote:
> -	ssize_t ret = min_t(size_t, INT_MAX & PAGE_MASK /* = MAX_RW_COUNT */, len);
> +	const unsigned long page_size = 1UL << CONFIG_PAGE_SHIFT;
> +	const unsigned long page_mask = ~(page_size - 1);
> +	ssize_t ret = min_t(size_t, INT_MAX & page_mask /* = MAX_RW_COUNT */, len);

I'm really not a fan of making the code less idiomatic...

> An easy solution would be to define PAGE_SIZE and PAGE_MASK in vDSO
> when they do not exist already, but this can be misleading.

Why would what tglx and I suggested be misleading? That seems pretty
normal... Are you worried they might mismatch somehow? (If so, why?) 

Jason


  reply	other threads:[~2024-08-27  7:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27  7:31 [PATCH 0/4] Fixups for random vDSO Christophe Leroy
2024-08-27  7:31 ` [PATCH 1/4] asm-generic/unaligned.h: Extract common header for vDSO Christophe Leroy
2024-08-27  7:31 ` [PATCH 2/4] random: vDSO: Don't use PAGE_SIZE and PAGE_MASK Christophe Leroy
2024-08-27  7:49   ` Jason A. Donenfeld [this message]
2024-08-27  8:16     ` Christophe Leroy
2024-08-27  8:23       ` Jason A. Donenfeld
2024-08-27  8:26   ` [PATCH] random: vDSO: Redefine " Christophe Leroy
2024-08-27  8:40     ` Jason A. Donenfeld
2024-08-27  8:55       ` Christophe Leroy
2024-08-27  9:59       ` Arnd Bergmann
2024-08-27 10:49         ` Christophe Leroy
2024-08-27 16:05           ` Vincenzo Frascino
2024-08-27 17:14             ` Christophe Leroy
2024-08-29 12:01               ` Vincenzo Frascino
2024-08-29 15:00                 ` Christophe Leroy
2024-08-29 15:34                   ` Vincenzo Frascino
2024-08-27 17:38             ` LEROY Christophe
2024-08-29 14:07               ` Vincenzo Frascino
2024-08-27  7:31 ` [PATCH 3/4] random: vDSO: Clean header inclusion in getrandom Christophe Leroy
2024-08-27  7:31 ` [PATCH 4/4] random: vDSO: don't use 64 bits atomics on 32 bits architectures Christophe Leroy
2024-08-27  8:03   ` Jason A. Donenfeld

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=Zs2FJku2hM2bp4ik@zx2c4.com \
    --to=jason@zx2c4$(echo .)com \
    --cc=arnd@arndb$(echo .)de \
    --cc=bp@alien8$(echo .)de \
    --cc=christophe.leroy@csgroup$(echo .)eu \
    --cc=dave.hansen@linux$(echo .)intel.com \
    --cc=hpa@zytor$(echo .)com \
    --cc=linux-arch@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=luto@kernel$(echo .)org \
    --cc=mingo@redhat$(echo .)com \
    --cc=tglx@linutronix$(echo .)de \
    --cc=tytso@mit$(echo .)edu \
    --cc=vincenzo.frascino@arm$(echo .)com \
    --cc=x86@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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