[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 1/2] vhost: dirty log should be per backend type
From: |
Jason Wang |
Subject: |
Re: [PATCH v4 1/2] vhost: dirty log should be per backend type |
Date: |
Fri, 15 Mar 2024 11:50:55 +0800 |
On Fri, Mar 15, 2024 at 5:39 AM Si-Wei Liu <si-wei.liu@oracle.com> wrote:
>
> There could be a mix of both vhost-user and vhost-kernel clients
> in the same QEMU process, where separate vhost loggers for the
> specific vhost type have to be used. Make the vhost logger per
> backend type, and have them properly reference counted.
It's better to describe what's the advantage of doing this.
>
> Suggested-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
>
> ---
> v3->v4:
> - remove checking NULL return value from vhost_log_get
>
> v2->v3:
> - remove non-effective assertion that never be reached
> - do not return NULL from vhost_log_get()
> - add neccessary assertions to vhost_log_get()
> ---
> hw/virtio/vhost.c | 45 +++++++++++++++++++++++++++++++++------------
> 1 file changed, 33 insertions(+), 12 deletions(-)
>
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index 2c9ac79..612f4db 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -43,8 +43,8 @@
> do { } while (0)
> #endif
>
> -static struct vhost_log *vhost_log;
> -static struct vhost_log *vhost_log_shm;
> +static struct vhost_log *vhost_log[VHOST_BACKEND_TYPE_MAX];
> +static struct vhost_log *vhost_log_shm[VHOST_BACKEND_TYPE_MAX];
>
> /* Memslots used by backends that support private memslots (without an fd).
> */
> static unsigned int used_memslots;
> @@ -287,6 +287,10 @@ static int vhost_set_backend_type(struct vhost_dev *dev,
> r = -1;
> }
>
> + if (r == 0) {
> + assert(dev->vhost_ops->backend_type == backend_type);
> + }
> +
Under which condition could we hit this? It seems not good to assert a
local logic.
Thanks
- Re: [PATCH v4 2/2] vhost: Perform memory section dirty scans once per iteration, (continued)
- Re: [PATCH v4 2/2] vhost: Perform memory section dirty scans once per iteration, Si-Wei Liu, 2024/03/18
- Re: [PATCH v4 2/2] vhost: Perform memory section dirty scans once per iteration, Jason Wang, 2024/03/19
- Re: [PATCH v4 2/2] vhost: Perform memory section dirty scans once per iteration, Si-Wei Liu, 2024/03/20
- Re: [PATCH v4 2/2] vhost: Perform memory section dirty scans once per iteration, Jason Wang, 2024/03/20
- Re: [PATCH v4 2/2] vhost: Perform memory section dirty scans once per iteration, Si-Wei Liu, 2024/03/21
- Re: [PATCH v4 2/2] vhost: Perform memory section dirty scans once per iteration, Jason Wang, 2024/03/22
- Re: [PATCH v4 2/2] vhost: Perform memory section dirty scans once per iteration, Si-Wei Liu, 2024/03/22
- Re: [PATCH v4 2/2] vhost: Perform memory section dirty scans once per iteration, Jason Wang, 2024/03/25
- Re: [External] : Re: [PATCH v4 2/2] vhost: Perform memory section dirty scans once per iteration, Si-Wei Liu, 2024/03/25
- Re: [External] : Re: [PATCH v4 2/2] vhost: Perform memory section dirty scans once per iteration, Jason Wang, 2024/03/26
Re: [PATCH v4 1/2] vhost: dirty log should be per backend type,
Jason Wang <=
- Re: [PATCH v4 1/2] vhost: dirty log should be per backend type, Si-Wei Liu, 2024/03/15
- Re: [PATCH v4 1/2] vhost: dirty log should be per backend type, Jason Wang, 2024/03/17
- Re: [PATCH v4 1/2] vhost: dirty log should be per backend type, Si-Wei Liu, 2024/03/18
- Re: [PATCH v4 1/2] vhost: dirty log should be per backend type, Jason Wang, 2024/03/19
- Re: [PATCH v4 1/2] vhost: dirty log should be per backend type, Si-Wei Liu, 2024/03/20
- Re: [PATCH v4 1/2] vhost: dirty log should be per backend type, Jason Wang, 2024/03/21