[RFC PATCH v1 0/2] vhost-vdpa: cache Virtio states

Shao-Chien Chiang posted 2 patches 1 year ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/cover.1681819697.git.ray90514@gmail.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>
hw/virtio/vhost-vdpa.c         | 60 ++++++++++++++++++++++++++--------
include/hw/virtio/vhost-vdpa.h |  4 +++
2 files changed, 50 insertions(+), 14 deletions(-)
[RFC PATCH v1 0/2] vhost-vdpa: cache Virtio states
Posted by Shao-Chien Chiang 1 year ago
Repetitive ioctls makes vdpa devices initialization and startup slow.
This patch series is to cache Virtio status, features, and config.
For each latency test, I use vdpa-sim-net as my vdpa device.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1579

Shao-Chien Chiang (2):
  vhost-vdpa: cache device status and features
  vhost-vdpa: cache device config

 hw/virtio/vhost-vdpa.c         | 60 ++++++++++++++++++++++++++--------
 include/hw/virtio/vhost-vdpa.h |  4 +++
 2 files changed, 50 insertions(+), 14 deletions(-)

-- 
2.25.1
Re: [RFC PATCH v1 0/2] vhost-vdpa: cache Virtio states
Posted by Shao-Chien Chiang 1 year ago
Hi,

I found a problem about cache.

If there are several devices operating the same backend device, the
cache might be inconsistent.

I think we could handle this by checking if a device is the first
device, but I'm not sure it will be feasible.

Is there any better approach to this problem?

Thank you!
Re: [RFC PATCH v1 0/2] vhost-vdpa: cache Virtio states
Posted by Eugenio Perez Martin 1 year ago
On Sat, Apr 22, 2023 at 8:39 AM Shao-Chien Chiang <ray90514@gmail.com> wrote:
>
> Hi,
>
> I found a problem about cache.
>
> If there are several devices operating the same backend device, the
> cache might be inconsistent.
>

Hi Shao-Chien,

What do you mean by "several devices operating the same backend
device". The guest only sees "one virtio device per vhost-vdpa backend
device".

Thanks!

> I think we could handle this by checking if a device is the first
> device, but I'm not sure it will be feasible.
>
> Is there any better approach to this problem?
>
> Thank you!
>
Re: [RFC PATCH v1 0/2] vhost-vdpa: cache Virtio states
Posted by Shao-Chien Chiang 1 year ago
Hi,
The "devices" means there are multiple vhost_dev.
After further research, I found the problem only happens in status.
Vhot-vdpa layer set status ACKNOWLEDGE,  DRIVER, and FEATURES_OK
only once by checking vhost_vdpa_first_dev().
However, it set status DRIVER_OK only once by checking if the device
is the last,
whose code is dev->vq_index + dev->nvqs != dev->vq_index_end in
vhost_vdpa_dev_start().
I think these are the causes of the problem.
Thank you!

On Mon, Apr 24, 2023 at 3:04 PM Eugenio Perez Martin
<eperezma@redhat.com> wrote:
>
> On Sat, Apr 22, 2023 at 8:39 AM Shao-Chien Chiang <ray90514@gmail.com> wrote:
> >
> > Hi,
> >
> > I found a problem about cache.
> >
> > If there are several devices operating the same backend device, the
> > cache might be inconsistent.
> >
>
> Hi Shao-Chien,
>
> What do you mean by "several devices operating the same backend
> device". The guest only sees "one virtio device per vhost-vdpa backend
> device".
>
> Thanks!
>
> > I think we could handle this by checking if a device is the first
> > device, but I'm not sure it will be feasible.
> >
> > Is there any better approach to this problem?
> >
> > Thank you!
> >
>
Re: [RFC PATCH v1 0/2] vhost-vdpa: cache Virtio states
Posted by Eugenio Perez Martin 1 year ago
On Tue, Apr 18, 2023 at 3:22 PM Shao-Chien Chiang <ray90514@gmail.com> wrote:
>
> Repetitive ioctls makes vdpa devices initialization and startup slow.
> This patch series is to cache Virtio status, features, and config.
> For each latency test, I use vdpa-sim-net as my vdpa device.
>

This one should be version 2.
* Please don't send it as a reply to the previous version, as it
confuses the tooling. I've been there myself :).
* Please include a changelog with the updates between the different
versions of the series, like:
v2: Add latency profiled numbers with virtio_sim_net.

CCing Jason.

Thanks!

> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1579
>
> Shao-Chien Chiang (2):
>   vhost-vdpa: cache device status and features
>   vhost-vdpa: cache device config
>
>  hw/virtio/vhost-vdpa.c         | 60 ++++++++++++++++++++++++++--------
>  include/hw/virtio/vhost-vdpa.h |  4 +++
>  2 files changed, 50 insertions(+), 14 deletions(-)
>
> --
> 2.25.1
>
>