On 4/19/24 11:04 AM, Marc Hartmayer wrote:
On Fri, Apr 19, 2024 at 04:49 PM +0200, Marc Hartmayer
<mhartmay(a)linux.ibm.com> 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(a)linux.ibm.com>
> ---
> 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(a)redhat.com>