From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH] KVM: x86: Use "checked" versions of get_user() and put_user()
Date: Thu, 13 Nov 2025 16:46:03 -0800 [thread overview]
Message-ID: <176305665095.1602845.9274238002903506152.b4-ty@google.com> (raw)
In-Reply-To: <20251106210206.221558-1-seanjc@google.com>
On Thu, 06 Nov 2025 13:02:06 -0800, Sean Christopherson wrote:
> Use the normal, checked versions for get_user() and put_user() instead of
> the double-underscore versions that omit range checks, as the checked
> versions are actually measurably faster on modern CPUs (12%+ on Intel,
> 25%+ on AMD).
>
> The performance hit on the unchecked versions is almost entirely due to
> the added LFENCE on CPUs where LFENCE is serializing (which is effectively
> all modern CPUs), which was added by commit 304ec1b05031 ("x86/uaccess:
> Use __uaccess_begin_nospec() and uaccess_try_nospec"). The small
> optimizations done by commit b19b74bc99b1 ("x86/mm: Rework address range
> check in get_user() and put_user()") likely shave a few cycles off, but
> the bulk of the extra latency comes from the LFENCE.
>
> [...]
Applied to kvm-x86 misc, with a call out in the changelog that the Hyper-V
path isn't performance sensitive, and that the motiviation is consistency and
the purging of __{get,put}_user().
[1/1] KVM: x86: Use "checked" versions of get_user() and put_user()
https://github.com/kvm-x86/linux/commit/d1bc00483759
--
https://github.com/kvm-x86/linux/tree/next
prev parent reply other threads:[~2025-11-14 0:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 21:02 Sean Christopherson
2025-11-07 0:48 ` Linus Torvalds
2025-11-07 13:09 ` Vitaly Kuznetsov
2025-11-14 0:46 ` Sean Christopherson [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=176305665095.1602845.9274238002903506152.b4-ty@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=vkuznets@redhat.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
all inboxes | Powered by JetHome®