qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 13/13] virtio/vhost-user: dynamically assign VhostUserHost


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v1 13/13] virtio/vhost-user: dynamically assign VhostUserHostNotifiers
Date: Tue, 6 Dec 2022 11:54:03 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1

Hi Alex,

On 21/3/22 16:30, Alex Bennée wrote:
At a couple of hundred bytes per notifier allocating one for every
potential queue is very wasteful as most devices only have a few
queues. Instead of having this handled statically dynamically assign
them and track in a GPtrArray.

[AJB: it's hard to trigger the vhost notifiers code, I assume as it
requires a KVM guest with appropriate backend]

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
  include/hw/virtio/vhost-user.h | 42 ++++++++++++++++-
  hw/virtio/vhost-user.c         | 83 +++++++++++++++++++++++++++-------
  hw/virtio/trace-events         |  1 +
  3 files changed, 108 insertions(+), 18 deletions(-)


  void vhost_user_cleanup(VhostUserState *user)
  {
-    int i;
-    VhostUserHostNotifier *n;
-
      if (!user->chr) {
          return;
      }
      memory_region_transaction_begin();
-    for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
-        n = &user->notifier[i];
-        vhost_user_host_notifier_remove(user, NULL, i);
-        object_unparent(OBJECT(&n->mr));
-    }
+    user->notifiers = (GPtrArray *) g_ptr_array_free(user->notifiers, true);

Since you replaced an iteration by a single function call, the MR transaction guards can be removed now, right?

      memory_region_transaction_commit();
      user->chr = NULL;
  }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]