[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220113110506-mutt-send-email-mst@kernel.org>
Date: Thu, 13 Jan 2022 11:05:44 -0500
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Stefano Garzarella <sgarzare@...hat.com>
Cc: virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
stefanha@...hat.com, Jason Wang <jasowang@...hat.com>,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: Re: [RFC PATCH] vhost: cache avail index in vhost_enable_notify()
On Thu, Jan 13, 2022 at 04:44:47PM +0100, Stefano Garzarella wrote:
> On Thu, Jan 13, 2022 at 10:19:46AM -0500, Michael S. Tsirkin wrote:
> > On Thu, Jan 13, 2022 at 03:56:42PM +0100, Stefano Garzarella 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>
> >
> > I guess we can ... but what's the point?
> >
>
> That without this patch if avail index is new, then device when will call
> vhost_get_vq_desc() will find old value in cache and will read it again.
>
> With this patch we also do the same path and update the cache every time we
> read avail index.
>
> I marked it RFC because I don't know if it's worth it :-)
>
> Stefano
Pls include info like this in commit log. Thanks!
--
MST
Powered by blists - more mailing lists