All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
To: qemu-block@nongnu.org, raphael@enfabrica.net, mst@redhat.com
Cc: kwolf@redhat.com, hreitz@redhat.com, pbonzini@redhat.com,
	berrange@redhat.com, eduardo@habkost.net, armbru@redhat.com,
	dave@treblig.org, eblake@redhat.com, qemu-devel@nongnu.org,
	vsementsov@yandex-team.ru, yc-core@yandex-team.ru,
	Raphael Norwitz <raphael.norwitz@nutanix.com>
Subject: [PATCH v3 1/5] vhost-user-blk: simplify and fix vhost_user_blk_handle_config_change
Date: Fri, 29 Mar 2024 21:37:54 +0300	[thread overview]
Message-ID: <20240329183758.3360733-2-vsementsov@yandex-team.ru> (raw)
In-Reply-To: <20240329183758.3360733-1-vsementsov@yandex-team.ru>

Let's not care about what was changed and update the whole config,
reasons:

1. config->geometry should be updated together with capacity, so we fix
   a bug.

2. Vhost-user protocol doesn't say anything about config change
   limitation. Silent ignore of changes doesn't seem to be correct.

3. vhost-user-vsock reads the whole config

4. on realize we don't do any checks on retrieved config, so no reason
   to care here

Comment "valid for resize only" exists since introduction the whole
hw/block/vhost-user-blk.c in commit
   00343e4b54ba0685e9ebe928ec5713b0cf7f1d1c
    "vhost-user-blk: introduce a new vhost-user-blk host device",
seems it was just an extra limitation.

Also, let's notify guest unconditionally:

1. So does vhost-user-vsock

2. We are going to reuse the functionality in new cases when we do want
   to notify the guest unconditionally. So, no reason to create extra
   branches in the logic.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Acked-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
---
 hw/block/vhost-user-blk.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 6a856ad51a..9e6bbc6950 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -91,7 +91,6 @@ static void vhost_user_blk_set_config(VirtIODevice *vdev, const uint8_t *config)
 static int vhost_user_blk_handle_config_change(struct vhost_dev *dev)
 {
     int ret;
-    struct virtio_blk_config blkcfg;
     VirtIODevice *vdev = dev->vdev;
     VHostUserBlk *s = VHOST_USER_BLK(dev->vdev);
     Error *local_err = NULL;
@@ -100,19 +99,15 @@ static int vhost_user_blk_handle_config_change(struct vhost_dev *dev)
         return 0;
     }
 
-    ret = vhost_dev_get_config(dev, (uint8_t *)&blkcfg,
+    ret = vhost_dev_get_config(dev, (uint8_t *)&s->blkcfg,
                                vdev->config_len, &local_err);
     if (ret < 0) {
         error_report_err(local_err);
         return ret;
     }
 
-    /* valid for resize only */
-    if (blkcfg.capacity != s->blkcfg.capacity) {
-        s->blkcfg.capacity = blkcfg.capacity;
-        memcpy(dev->vdev->config, &s->blkcfg, vdev->config_len);
-        virtio_notify_config(dev->vdev);
-    }
+    memcpy(dev->vdev->config, &s->blkcfg, vdev->config_len);
+    virtio_notify_config(dev->vdev);
 
     return 0;
 }
-- 
2.34.1



  reply	other threads:[~2024-03-29 18:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29 18:37 [PATCH v3 0/5] vhost-user-blk: live resize additional APIs Vladimir Sementsov-Ogievskiy
2024-03-29 18:37 ` Vladimir Sementsov-Ogievskiy [this message]
2024-03-29 18:37 ` [PATCH v3 2/5] qdev-monitor: fix error message in find_device_state() Vladimir Sementsov-Ogievskiy
2024-03-29 18:37 ` [PATCH v3 3/5] qdev-monitor: add option to report GenericError from find_device_state Vladimir Sementsov-Ogievskiy
2024-03-29 18:37 ` [PATCH v3 4/5] qapi: introduce device-sync-config Vladimir Sementsov-Ogievskiy
2024-04-24 11:48   ` Markus Armbruster
2024-04-29  8:18     ` Vladimir Sementsov-Ogievskiy
2024-04-29 10:51       ` Markus Armbruster
2024-04-29 12:22         ` Vladimir Sementsov-Ogievskiy
2024-04-29 13:04           ` Markus Armbruster
2024-04-29 14:49             ` Vladimir Sementsov-Ogievskiy
2024-04-24 12:05   ` Markus Armbruster
2024-03-29 18:37 ` [PATCH v3 5/5] qapi: introduce CONFIG_READ event Vladimir Sementsov-Ogievskiy
2024-04-24 12:11   ` Markus Armbruster
2024-04-29  9:02     ` Vladimir Sementsov-Ogievskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240329183758.3360733-2-vsementsov@yandex-team.ru \
    --to=vsementsov@yandex-team.ru \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dave@treblig.org \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=raphael.norwitz@nutanix.com \
    --cc=raphael@enfabrica.net \
    --cc=yc-core@yandex-team.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.