Re: [PATCH v1 16/20] node_device_udev: Use a worker pool for processing events and emitting nodedev event

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

 



On 4/19/24 11:04 AM, Marc Hartmayer wrote:
On Fri, Apr 19, 2024 at 04:49 PM +0200, Marc Hartmayer <mhartmay@xxxxxxxxxxxxx> wrote:
Use a worker pool for processing the events (e.g. udev, mdevctl config changes)
and the initialization instead of a separate initThread and a mdevctl-thread.
This has the large advantage that we can leverage the job API and now this
thread pool is responsible to do all the "costly-work" and emitting the libvirt
nodedev events.

Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx>
---
  src/node_device/node_device_udev.c | 244 +++++++++++++++++++++--------
  1 file changed, 179 insertions(+), 65 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index e4b1532dc385..67a8b5cd7132 100644

[…snip…]

  }
@@ -2278,11 +2380,19 @@ nodeStateShutdownWait(void)
          return 0;
VIR_WITH_OBJECT_LOCK_GUARD(priv) {
-        if (priv->initThread)
-            virThreadJoin(priv->initThread);
-        if (priv->udevThread)
-            virThreadJoin(priv->udevThread);

+        if (priv->mdevctlTimeout != -1) {
+            virEventRemoveTimeout(priv->mdevctlTimeout);
+            priv->mdevctlTimeout = -1;
+        }
+
+        if (priv->watch) {
+            virEventRemoveHandle(priv->watch);
+            priv->watch = -1;
+        }

Too many rebases… the diff should read as follows:

@@ -2278,11 +2380,12 @@ nodeStateShutdownWait(void)
          return 0;

      VIR_WITH_OBJECT_LOCK_GUARD(priv) {
-        if (priv->initThread)
-            virThreadJoin(priv->initThread);
          if (priv->udevThread)
              virThreadJoin(priv->udevThread);
      }
+
+    if (priv->workerPool)
+        virThreadPoolDrain(priv->workerPool);
      return 0;
  }

[…snip]




Reviewed-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux