netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Jon Kohler" <jon@nutanix.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"virtualization@lists.linux.dev" <virtualization@lists.linux.dev>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Borislav Petkov" <bp@alien8.de>,
	"Sean Christopherson" <seanjc@google.com>
Subject: Re: [PATCH net-next] vhost: use "checked" versions of get_user() and put_user()
Date: Fri, 14 Nov 2025 19:08:56 +0000	[thread overview]
Message-ID: <20251114190856.7e438d9d@pumpkin> (raw)
In-Reply-To: <CAHk-=whkVPGpfNFLnBv7YG__P4uGYWtG6AXLS5xGpjXGn8=orA@mail.gmail.com>

On Fri, 14 Nov 2025 09:48:02 -0800
Linus Torvalds <torvalds@linux-foundation.org> wrote:

...
> But then get_user() gets optimized to do the address space check using
> a data dependency instead of the "access_ok()" control dependency, and
> so get_user() doesn't need LFENCE at all, and now get_user() is
> *faster* than __get_user().

I think that is currently only x86-64?
There are patches in the pipeline for ppc.
I don't think I've seen anything for arm32 or arm64.

arm64 has the issue that the hardware looks at the wrong address bit,
so might need an explicit guard page at the end of user addresses.

Changing x86-32 to have a guard page ought to be straightforward.
But I think the user stack ends right at 0xc000000 (with argv[] and env[])
so it might be safer to also reduce the stack size by 4k (pretending
env[] is larger) to avoid problems with code that is trying to map
things at fixed addresses just below the stack (or do we care about that?).

I'm sure I should be able to build and test the x86-32 code.
I guess there are instruction for doing that under qemu somewhere?
Might be time to drop support for cpu that don't support cmov?

	David

  reply	other threads:[~2025-11-14 19:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-13  0:55 [PATCH net-next] vhost: use "checked" versions of get_user() and put_user() Jon Kohler
2025-11-13  1:09 ` Jason Wang
2025-11-14 14:53   ` Jon Kohler
2025-11-14 17:48     ` Linus Torvalds
2025-11-14 19:08       ` David Laight [this message]
2025-11-14 20:48         ` Linus Torvalds
2025-11-14 21:38           ` David Laight
2025-11-17  4:32     ` Jason Wang
2025-11-17 17:34       ` Jon Kohler
2025-11-20  1:57         ` Jason Wang
2025-11-25 19:45           ` Jon Kohler
2025-11-26  6:04             ` Jason Wang
2025-11-26 10:25               ` Arnd Bergmann
2025-11-26 19:47                 ` Jon Kohler
2025-11-26 19:58                   ` Arnd Bergmann
2025-11-26 21:42                     ` Jon Kohler
2025-11-26 21:45                       ` Linus Torvalds
2025-11-27  2:58                         ` Jon Kohler
2025-11-27  1:08                   ` Jason Wang
2025-11-27  3:11                     ` Jon Kohler
2025-11-27  6:31                       ` Michael S. Tsirkin
2025-11-27  6:32                       ` Michael S. Tsirkin
2025-12-02 16:54                         ` Jon Kohler
2025-11-14 18:54 ` David Laight
2025-11-14 19:30   ` Jon Kohler
2025-11-14 20:32     ` David Laight
2025-11-16  6:32     ` Michael S. Tsirkin

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=20251114190856.7e438d9d@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=bp@alien8.de \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=jon@nutanix.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=seanjc@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=virtualization@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).