lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2CD22CA1-FAFA-493A-8F41-A5798C33D103@nutanix.com>
Date: Fri, 14 Nov 2025 19:30:32 +0000
From: Jon Kohler <jon@...anix.com>
To: David Laight <david.laight.linux@...il.com>
CC: "Michael S. Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>,
        Eugenio Pérez <eperezma@...hat.com>,
        "kvm@...r.kernel.org"
	<kvm@...r.kernel.org>,
        "virtualization@...ts.linux.dev"
	<virtualization@...ts.linux.dev>,
        "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>,
        Linus Torvalds
	<torvalds@...ux-foundation.org>,
        Borislav Petkov <bp@...en8.de>,
        Sean
 Christopherson <seanjc@...gle.com>
Subject: Re: [PATCH net-next] vhost: use "checked" versions of get_user() and
 put_user()



> On Nov 14, 2025, at 1:54 PM, David Laight <david.laight.linux@...il.com> wrote:
> 
> !-------------------------------------------------------------------|
>  CAUTION: External Email
> 
> |-------------------------------------------------------------------!
> 
> On Wed, 12 Nov 2025 17:55:28 -0700
> Jon Kohler <jon@...anix.com> wrote:
> 
>> vhost_get_user and vhost_put_user leverage __get_user and __put_user,
>> respectively, which were both added in 2016 by commit 6b1e6cc7855b
>> ("vhost: new device IOTLB API"). In a heavy UDP transmit workload on a
>> vhost-net backed tap device, these functions showed up as ~11.6% of
>> samples in a flamegraph of the underlying vhost worker thread.
>> 
>> Quoting Linus from [1]:
>>    Anyway, every single __get_user() call I looked at looked like
>>    historical garbage. [...] End result: I get the feeling that we
>>    should just do a global search-and-replace of the __get_user/
>>    __put_user users, replace them with plain get_user/put_user instead,
>>    and then fix up any fallout (eg the coco code).
>> 
>> Switch to plain get_user/put_user in vhost, which results in a slight
>> throughput speedup. get_user now about ~8.4% of samples in flamegraph.
>> 
>> Basic iperf3 test on a Intel 5416S CPU with Ubuntu 25.10 guest:
>> TX: taskset -c 2 iperf3 -c <rx_ip> -t 60 -p 5200 -b 0 -u -i 5
>> RX: taskset -c 2 iperf3 -s -p 5200 -D
>> Before: 6.08 Gbits/sec
>> After:  6.32 Gbits/sec
>> 
>> As to what drives the speedup, Sean's patch [2] explains:
>> 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).
> 
> Is there an associated access_ok() that can also be removed?
> 
> David

Hey David - IIUC, the access_ok() for non-iotlb setups is done at
initial setup time, not per event, see vhost_vring_set_addr and
for the vhost net side see vhost_net_set_backend -> 
vhost_vq_access_ok.

Will lean on MST/Jason to help sanity check my understanding.

In the iotlb case, that’s handled differently (Jason can speak to
that side), but I dont think there is something we’d remove there?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ