public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Samuel Holland" <samuel.holland@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	linux-riscv@lists.infradead.org
Cc: "Mark Rutland" <mark.rutland@arm.com>,
	"David Laight" <David.Laight@ACULAB.COM>,
	"Alexandre Ghiti" <alexghiti@rivosinc.com>
Subject: Re: [PATCH v2 2/2] riscv: Define TASK_SIZE_MAX for __access_ok()
Date: Wed, 27 Mar 2024 17:24:06 +0100	[thread overview]
Message-ID: <4d2fa4cd-4e21-4504-b29b-cfabe90693aa@app.fastmail.com> (raw)
In-Reply-To: <20240327143858.711792-3-samuel.holland@sifive.com>

On Wed, Mar 27, 2024, at 15:38, Samuel Holland wrote:
> TASK_SIZE_MAX should be set to a constant value, at least the largest
> valid userspace address under any runtime configuration. This optimizes
> the check in __access_ok(), which no longer needs to compute the runtime
> value of TASK_SIZE. The check does not need to be exact, as long as it
> accepts all valid userspace addresses and rejects all valid kernel
> addresses; well-behaved programs will never fail the access_ok() check.
>
> For RISC-V, which requires all virtual addresses to be sign extended,
> the optimal choice is LONG_MAX because it simplifies the limit
> comparison to a sign bit test.
>
> This removes about half of the references to pgtable_l[45]_enabled.
>
> Signed-off-by: Samuel Holland <samuel.holland@sifive.com>

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2024-03-27 16:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 14:38 [PATCH v2 0/2] riscv: access_ok() optimization Samuel Holland
2024-03-27 14:38 ` [PATCH v2 1/2] riscv: Remove PGDIR_SIZE_L3 and TASK_SIZE_MIN Samuel Holland
2024-03-27 16:24   ` Arnd Bergmann
2024-04-04  7:33   ` Alexandre Ghiti
2024-03-27 14:38 ` [PATCH v2 2/2] riscv: Define TASK_SIZE_MAX for __access_ok() Samuel Holland
2024-03-27 16:24   ` Arnd Bergmann [this message]
2024-04-04  7:38   ` Alexandre Ghiti
2024-05-22 14:10 ` [PATCH v2 0/2] riscv: access_ok() optimization patchwork-bot+linux-riscv

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=4d2fa4cd-4e21-4504-b29b-cfabe90693aa@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=David.Laight@ACULAB.COM \
    --cc=alexghiti@rivosinc.com \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=palmer@dabbelt.com \
    --cc=samuel.holland@sifive.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