All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vhost: Do not actively send a config interrupt
@ 2025-09-23 15:49 ` Li Zhaoxin via
  0 siblings, 0 replies; 6+ messages in thread
From: Li Zhaoxin via @ 2025-09-22 15:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S . Tsirkin, Stefano Garzarella, Li Zhaoxin, Gao Shiyuan

From: lizhaoxin <lizhaoxin04@baidu.com>

After the VM is suspended/resumed or live-migrated,
we do not want the guest to output information such as
the capacity of the block device, as this is noticeable to the tenant.
Also, there is no need to immediately send a config notifier
for the virtio device after vhost_dev_start.

Co-developed-by: Gao Shiyuan <gaoshiyuan@baidu.com>
Signed-off-by: Gao Shiyuan <gaoshiyuan@baidu.com>
Signed-off-by: Li Zhaoxin <lizhaoxin04@baidu.com>
---
 hw/virtio/vhost.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 6557c58d12..1f8a495ef8 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1847,15 +1847,10 @@ static void vhost_stop_config_intr(struct vhost_dev *dev)
 
 static void vhost_start_config_intr(struct vhost_dev *dev)
 {
-    int r;
-
     assert(dev->vhost_ops);
     int fd = event_notifier_get_fd(&dev->vdev->config_notifier);
     if (dev->vhost_ops->vhost_set_config_call) {
-        r = dev->vhost_ops->vhost_set_config_call(dev, fd);
-        if (!r) {
-            event_notifier_set(&dev->vdev->config_notifier);
-        }
+        dev->vhost_ops->vhost_set_config_call(dev, fd);
     }
 }
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] vhost: Do not actively send a config interrupt
  2025-09-23 15:49 ` Li Zhaoxin via
  (?)
@ 2025-09-23  9:06 ` Stefano Garzarella
  -1 siblings, 0 replies; 6+ messages in thread
From: Stefano Garzarella @ 2025-09-23  9:06 UTC (permalink / raw)
  To: Li Zhaoxin, Cindy Lu; +Cc: qemu-devel, Michael S . Tsirkin, Gao Shiyuan

CCing Cindy since she introduced this code with commit
f9a09ca3ea ("vhost: add support for configure interrupt"), so she can 
help to review this, since I don't really get this change.

On Mon, Sep 22, 2025 at 11:19:32PM +0800, Li Zhaoxin wrote:
>From: lizhaoxin <lizhaoxin04@baidu.com>
>
>After the VM is suspended/resumed or live-migrated,
>we do not want the guest to output information such as
>the capacity of the block device, as this is noticeable to the tenant.
>Also, there is no need to immediately send a config notifier
>for the virtio device after vhost_dev_start.

Can you explain more clearly what your problem is and why this patch 
solves it?

Thanks,
Stefano

>
>Co-developed-by: Gao Shiyuan <gaoshiyuan@baidu.com>
>Signed-off-by: Gao Shiyuan <gaoshiyuan@baidu.com>
>Signed-off-by: Li Zhaoxin <lizhaoxin04@baidu.com>
>---
> hw/virtio/vhost.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
>diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
>index 6557c58d12..1f8a495ef8 100644
>--- a/hw/virtio/vhost.c
>+++ b/hw/virtio/vhost.c
>@@ -1847,15 +1847,10 @@ static void vhost_stop_config_intr(struct vhost_dev *dev)
>
> static void vhost_start_config_intr(struct vhost_dev *dev)
> {
>-    int r;
>-
>     assert(dev->vhost_ops);
>     int fd = event_notifier_get_fd(&dev->vdev->config_notifier);
>     if (dev->vhost_ops->vhost_set_config_call) {
>-        r = dev->vhost_ops->vhost_set_config_call(dev, fd);
>-        if (!r) {
>-            event_notifier_set(&dev->vdev->config_notifier);
>-        }
>+        dev->vhost_ops->vhost_set_config_call(dev, fd);
>     }
> }
>
>-- 
>2.34.1
>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] vhost: Do not actively send a config interrupt
@ 2025-09-23 11:32 Li,Zhaoxin(ACG CCN) via
  2025-09-24  2:10 ` Cindy Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Li,Zhaoxin(ACG CCN) via @ 2025-09-23 11:32 UTC (permalink / raw)
  To: Stefano Garzarella, Cindy Lu
  Cc: qemu-devel, Michael S . Tsirkin, Gao, Shiyuan,
	Li, Zhaoxin(ACG CCN)

On 2025/9/23 17:06,“Stefano Garzarella”<sgarzare@redhat.com <mailto:sgarzare@redhat.com>> wrote:

>CCing Cindy since she introduced this code with commit
>f9a09ca3ea ("vhost: add support for configure interrupt"), so she can 
>help to review this, since I don't really get this change.

>On Mon, Sep 22, 2025 at 11:19:32PM +0800, Li Zhaoxin wrote:
>>From: lizhaoxin <lizhaoxin04@baidu.com <mailto:lizhaoxin04@baidu.com>>
>>
>>After the VM is suspended/resumed or live-migrated,
>>we do not want the guest to output information such as
>>the capacity of the block device, as this is noticeable to the tenant.
>>Also, there is no need to immediately send a config notifier
>>for the virtio device after vhost_dev_start.

>Can you explain more clearly what your problem is and why this patch 
>solves it?

>Thanks,
>Stefano

Hi Stefano and Cindy,

In the vhost-vdpa scenario, after executing virsh suspend vm followed by virsh resume vm, or when live migrating the VM to the destination host, the guest kernel will output the following additional logs:

[Tue Sep 23 19:07:04 2025] virtio_blk virtio1: [vda] new size: 20971520 512-byte logical blocks (10.7 GB/10.0 GiB)
[Tue Sep 23 19:07:04 2025] virtio_blk virtio3: [vdb] new size: 20971520 512-byte logical blocks (10.7 GB/10.0 GiB)

This occurs because when the vhost device is started, the sequence vhost_dev_start -> vhost_start_config_intr -> event_notifier_set(&dev->vdev->config_notifier) is triggered, which sends a configuration change notification (config notification) to the guest. However, it appears that actively sending this notification is currently unnecessary, and no additional processing is performed in the event of a sending failure. So, we removed the call to event_notifier_set(&dev->vdev->config_notifier).

Thanks,
Li Zhaoxin

>>
>>Co-developed-by: Gao Shiyuan <gaoshiyuan@baidu.com <mailto:gaoshiyuan@baidu.com>>
>>Signed-off-by: Gao Shiyuan <gaoshiyuan@baidu.com <mailto:gaoshiyuan@baidu.com>>
>>Signed-off-by: Li Zhaoxin <lizhaoxin04@baidu.com <mailto:lizhaoxin04@baidu.com>>
>>---
>> hw/virtio/vhost.c | 7 +------
>> 1 file changed, 1 insertion(+), 6 deletions(-)
>>
>>diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
>>index 6557c58d12..1f8a495ef8 100644
>>--- a/hw/virtio/vhost.c
>>+++ b/hw/virtio/vhost.c
>>@@ -1847,15 +1847,10 @@ static void vhost_stop_config_intr(struct vhost_dev *dev)
>>
>> static void vhost_start_config_intr(struct vhost_dev *dev)
>> {
>>- int r;
>>-
>> assert(dev->vhost_ops);
>> int fd = event_notifier_get_fd(&dev->vdev->config_notifier);
>> if (dev->vhost_ops->vhost_set_config_call) {
>>- r = dev->vhost_ops->vhost_set_config_call(dev, fd);
>>- if (!r) {
>>- event_notifier_set(&dev->vdev->config_notifier);
>>- }
>>+ dev->vhost_ops->vhost_set_config_call(dev, fd);
>> }
>> }
>>
>>-- 
>>2.34.1
>>






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] vhost: Do not actively send a config interrupt
@ 2025-09-23 15:49 ` Li Zhaoxin via
  0 siblings, 0 replies; 6+ messages in thread
From: Li Zhaoxin via @ 2025-09-23 15:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S . Tsirkin, Stefano Garzarella, Cindy Lu, Li Zhaoxin,
	Gao Shiyuan

From: lizhaoxin <lizhaoxin04@baidu.com>

>CCing Cindy since she introduced this code with commit
>f9a09ca3ea ("vhost: add support for configure interrupt"), so she can
>help to review this, since I don't really get this change.
>
>On Mon, Sep 22, 2025 at 11:19:32PM +0800, Li Zhaoxin wrote:
>>From: lizhaoxin <lizhaoxin04@baidu.com>
>>
>>After the VM is suspended/resumed or live-migrated,
>>we do not want the guest to output information such as
>>the capacity of the block device, as this is noticeable to the tenant.
>>Also, there is no need to immediately send a config notifier
>>for the virtio device after vhost_dev_start.
>
>Can you explain more clearly what your problem is and why this patch
>solves it?
>
>Thanks,
>Stefano
>

Hi Stefano and Cindy,

In the vhost-vdpa scenario, after executing virsh suspend vm followed by virsh resume vm, or when live migrating the VM to the destination host, the guest kernel will output the following additional logs:

[Tue Sep 23 19:07:04 2025] virtio_blk virtio1: [vda] new size: 20971520 512-byte logical blocks (10.7 GB/10.0 GiB)
[Tue Sep 23 19:07:04 2025] virtio_blk virtio3: [vdb] new size: 20971520 512-byte logical blocks (10.7 GB/10.0 GiB)

This occurs because when the vhost device is started, the sequence vhost_dev_start -> vhost_start_config_intr -> event_notifier_set(&dev->vdev->config_notifier) is triggered, which sends a configuration change notification (config notification) to the guest. However, it appears that actively sending this notification is currently unnecessary, and no additional processing is performed in the event of a sending failure. So, we removed the call to event_notifier_set(&dev->vdev->config_notifier).

Thanks,
Li Zhaoxin

>>
>>Co-developed-by: Gao Shiyuan <gaoshiyuan@baidu.com>
>>Signed-off-by: Gao Shiyuan <gaoshiyuan@baidu.com>
>>Signed-off-by: Li Zhaoxin <lizhaoxin04@baidu.com>
>>---
>> hw/virtio/vhost.c | 7 +------
>> 1 file changed, 1 insertion(+), 6 deletions(-)
>>
>>diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
>>index 6557c58d12..1f8a495ef8 100644
>>--- a/hw/virtio/vhost.c
>>+++ b/hw/virtio/vhost.c
>>@@ -1847,15 +1847,10 @@ static void vhost_stop_config_intr(struct vhost_dev *dev)
>>
>> static void vhost_start_config_intr(struct vhost_dev *dev)
>> {
>>-    int r;
>>-
>>     assert(dev->vhost_ops);
>>     int fd = event_notifier_get_fd(&dev->vdev->config_notifier);
>>     if (dev->vhost_ops->vhost_set_config_call) {
>>-        r = dev->vhost_ops->vhost_set_config_call(dev, fd);
>>-        if (!r) {
>>-            event_notifier_set(&dev->vdev->config_notifier);
>>-        }
>>+        dev->vhost_ops->vhost_set_config_call(dev, fd);
>>     }
>> }
>>
>>--
>>2.34.1
>>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] vhost: Do not actively send a config interrupt
  2025-09-23 11:32 Li,Zhaoxin(ACG CCN) via
@ 2025-09-24  2:10 ` Cindy Lu
  0 siblings, 0 replies; 6+ messages in thread
From: Cindy Lu @ 2025-09-24  2:10 UTC (permalink / raw)
  To: Li,Zhaoxin(ACG CCN)
  Cc: Stefano Garzarella, qemu-devel, Michael S . Tsirkin, Gao,Shiyuan

On Tue, Sep 23, 2025 at 7:48 PM Li,Zhaoxin(ACG CCN)
<lizhaoxin04@baidu.com> wrote:
>
> On 2025/9/23 17:06,“Stefano Garzarella”<sgarzare@redhat.com <mailto:sgarzare@redhat.com>> wrote:
>
> >CCing Cindy since she introduced this code with commit
> >f9a09ca3ea ("vhost: add support for configure interrupt"), so she can
> >help to review this, since I don't really get this change.
>
> >On Mon, Sep 22, 2025 at 11:19:32PM +0800, Li Zhaoxin wrote:
> >>From: lizhaoxin <lizhaoxin04@baidu.com <mailto:lizhaoxin04@baidu.com>>
> >>
> >>After the VM is suspended/resumed or live-migrated,
> >>we do not want the guest to output information such as
> >>the capacity of the block device, as this is noticeable to the tenant.
> >>Also, there is no need to immediately send a config notifier
> >>for the virtio device after vhost_dev_start.
>
> >Can you explain more clearly what your problem is and why this patch
> >solves it?
>
> >Thanks,
> >Stefano
>
> Hi Stefano and Cindy,
>
> In the vhost-vdpa scenario, after executing virsh suspend vm followed by virsh resume vm, or when live migrating the VM to the destination host, the guest kernel will output the following additional logs:
>
> [Tue Sep 23 19:07:04 2025] virtio_blk virtio1: [vda] new size: 20971520 512-byte logical blocks (10.7 GB/10.0 GiB)
> [Tue Sep 23 19:07:04 2025] virtio_blk virtio3: [vdb] new size: 20971520 512-byte logical blocks (10.7 GB/10.0 GiB)
>
> This occurs because when the vhost device is started, the sequence vhost_dev_start -> vhost_start_config_intr -> event_notifier_set(&dev->vdev->config_notifier) is triggered, which sends a configuration change notification (config notification) to the guest. However, it appears that actively sending this notification is currently unnecessary, and no additional processing is performed in the event of a sending failure. So, we removed the call to event_notifier_set(&dev->vdev->config_notifier).
>
> Thanks,
> Li Zhaoxin
>
Hi Zhaoxin

this function tests and prevents event loss, I  think maybe we should
not remove it simply
maybe you can do something while it print the log?
Thanks
cindy

> >>
> >>Co-developed-by: Gao Shiyuan <gaoshiyuan@baidu.com <mailto:gaoshiyuan@baidu.com>>
> >>Signed-off-by: Gao Shiyuan <gaoshiyuan@baidu.com <mailto:gaoshiyuan@baidu.com>>
> >>Signed-off-by: Li Zhaoxin <lizhaoxin04@baidu.com <mailto:lizhaoxin04@baidu.com>>
> >>---
> >> hw/virtio/vhost.c | 7 +------
> >> 1 file changed, 1 insertion(+), 6 deletions(-)
> >>
> >>diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> >>index 6557c58d12..1f8a495ef8 100644
> >>--- a/hw/virtio/vhost.c
> >>+++ b/hw/virtio/vhost.c
> >>@@ -1847,15 +1847,10 @@ static void vhost_stop_config_intr(struct vhost_dev *dev)
> >>
> >> static void vhost_start_config_intr(struct vhost_dev *dev)
> >> {
> >>- int r;
> >>-
> >> assert(dev->vhost_ops);
> >> int fd = event_notifier_get_fd(&dev->vdev->config_notifier);
> >> if (dev->vhost_ops->vhost_set_config_call) {
> >>- r = dev->vhost_ops->vhost_set_config_call(dev, fd);
> >>- if (!r) {
> >>- event_notifier_set(&dev->vdev->config_notifier);
> >>- }
> >>+ dev->vhost_ops->vhost_set_config_call(dev, fd);
> >> }
> >> }
> >>
> >>--
> >>2.34.1
> >>
>
>
>
>
>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] vhost: Do not actively send a config interrupt
  2025-09-23 15:49 ` Li Zhaoxin via
  (?)
  (?)
@ 2026-02-03 13:04 ` Michael S. Tsirkin
  -1 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2026-02-03 13:04 UTC (permalink / raw)
  To: Li Zhaoxin; +Cc: qemu-devel, Stefano Garzarella, Gao Shiyuan

On Mon, Sep 22, 2025 at 11:19:32PM +0800, Li Zhaoxin wrote:
> From: lizhaoxin <lizhaoxin04@baidu.com>
> 
> After the VM is suspended/resumed or live-migrated,
> we do not want the guest to output information such as
> the capacity of the block device, as this is noticeable to the tenant.
> Also, there is no need to immediately send a config notifier
> for the virtio device after vhost_dev_start.
> 
> Co-developed-by: Gao Shiyuan <gaoshiyuan@baidu.com>
> Signed-off-by: Gao Shiyuan <gaoshiyuan@baidu.com>
> Signed-off-by: Li Zhaoxin <lizhaoxin04@baidu.com>

Just to close the circle and complete the picture for you here, the reason we do it
is because with vhost
source could have queued an interrupt and the state is
not migrated.

if you want to optimize this, you need to check on source and
migrate the extra state.



> ---
>  hw/virtio/vhost.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index 6557c58d12..1f8a495ef8 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -1847,15 +1847,10 @@ static void vhost_stop_config_intr(struct vhost_dev *dev)
>  
>  static void vhost_start_config_intr(struct vhost_dev *dev)
>  {
> -    int r;
> -
>      assert(dev->vhost_ops);
>      int fd = event_notifier_get_fd(&dev->vdev->config_notifier);
>      if (dev->vhost_ops->vhost_set_config_call) {
> -        r = dev->vhost_ops->vhost_set_config_call(dev, fd);
> -        if (!r) {
> -            event_notifier_set(&dev->vdev->config_notifier);
> -        }
> +        dev->vhost_ops->vhost_set_config_call(dev, fd);
>      }
>  }
>  
> -- 
> 2.34.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-03 13:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-22 15:19 [PATCH] vhost: Do not actively send a config interrupt Li Zhaoxin via
2025-09-23 15:49 ` Li Zhaoxin via
2025-09-23  9:06 ` Stefano Garzarella
2026-02-03 13:04 ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2025-09-23 11:32 Li,Zhaoxin(ACG CCN) via
2025-09-24  2:10 ` Cindy Lu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.