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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 14 Jan 2022 09:02:05 +0100 From: Stefano Garzarella <sgarzare@...hat.com> To: Jason Wang <jasowang@...hat.com> Cc: virtualization <virtualization@...ts.linux-foundation.org>, netdev <netdev@...r.kernel.org>, Stefan Hajnoczi <stefanha@...hat.com>, linux-kernel <linux-kernel@...r.kernel.org>, kvm <kvm@...r.kernel.org>, "Michael S. Tsirkin" <mst@...hat.com> Subject: Re: [RFC PATCH] vhost: cache avail index in vhost_enable_notify() On Fri, Jan 14, 2022 at 02:18:01PM +0800, Jason Wang wrote: >On Thu, Jan 13, 2022 at 10:57 PM Stefano Garzarella <sgarzare@...hat.com> wrote: >> >> In vhost_enable_notify() we enable the notifications and we read >> the avail index to check if new buffers have become available in >> the meantime. In this case, the device would go to re-read avail >> index to access the descriptor. >> >> As we already do in other place, we can cache the value in `avail_idx` >> and compare it with `last_avail_idx` to check if there are new >> buffers available. >> >> Signed-off-by: Stefano Garzarella <sgarzare@...hat.com> > >Patch looks fine but I guess we won't get performance improvement >since it doesn't save any userspace/VM memory access? It should save the memory access when vhost_enable_notify() find something new in the VQ, so in this path: vhost_enable_notify() <- VM memory access for avail index == true vhost_disable_notify() ... vhost_get_vq_desc() <- VM memory access for avail index with the patch applied, this access is avoided since avail index is cached In any case, I don't expect this to be a very common path, indeed we usually use unlikely() for this path: if (unlikely(vhost_enable_notify(dev, vq))) { vhost_disable_notify(dev, vq); continue; } So I don't expect a significant performance increase. v1 coming with a better commit description. Thanks, Stefano
Powered by blists - more mailing lists