From: "Fima Shevrin" <efim.shev...@virtuozzo.com>

RPC client implementation uses the following paradigm. The critical
section is organized via virObjectLock(client)/virObjectUnlock(client)
braces. Though this is potentially problematic as
    main thread:                            side thread:
    virObjectUnlock(client);
                                        virObjectLock(client);
                                        g_main_loop_quit(client->eventLoop);
                                        virObjectUnlock(client);
    g_main_loop_run(client->eventLoop);

This means in particular that is the main thread is executing very long
request like VM migration, the wakeup from the side thread could be
stuck until the main request will be fully completed.

Discrubed case is easily reproducible with the simple python scripts doing slow
and fast requests in parallel from two different threads.

Our idea is to release the lock at the prepare stage and avoid libvirt stuck
during the interaction between main and side threads.

Changes: Add cover letter and versions


From 2d1a5f094101808216970dbf90383ffeadae7fe9 Mon Sep 17 00:00:00 2001
From: "Denis V. Lunev" <d...@openvz.org>
Date: Sat, 25 Nov 2023 14:11:56 +0300
Subject: [PATCH v2 1/3] rpc: mark GSourceFuncs functions in vireventglibwatch.c
 as static

They are not exported from the module and thus should be static.

Signed-off-by: Denis V. Lunev <d...@openvz.org>
Signed-off-by: Fima Shevrin <efim.shev...@virtuozzo.com>
---
 src/util/vireventglibwatch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/vireventglibwatch.c b/src/util/vireventglibwatch.c
index b7f3a8786a..b21e505731 100644
--- a/src/util/vireventglibwatch.c
+++ b/src/util/vireventglibwatch.c
@@ -71,7 +71,7 @@ virEventGLibFDSourceFinalize(GSource *source G_GNUC_UNUSED)
 }
 
 
-GSourceFuncs virEventGLibFDSourceFuncs = {
+static GSourceFuncs virEventGLibFDSourceFuncs = {
     .prepare = virEventGLibFDSourcePrepare,
     .check = virEventGLibFDSourceCheck,
     .dispatch = virEventGLibFDSourceDispatch,
@@ -194,7 +194,7 @@ virEventGLibSocketSourceFinalize(GSource *source)
 }
 
 
-GSourceFuncs virEventGLibSocketSourceFuncs = {
+static GSourceFuncs virEventGLibSocketSourceFuncs = {
     .prepare = virEventGLibSocketSourcePrepare,
     .check = virEventGLibSocketSourceCheck,
     .dispatch = virEventGLibSocketSourceDispatch,
-- 
2.34.1
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-le...@lists.libvirt.org

Reply via email to