Skip to contentSkip to conversation

vhost-user-bridge: Fix stdbuf and ASAN interaction

PATCH In review Yodel Eldar 3 participants 6 messages Sep 14 – Sep 21

lore
Share & tools
lore
#0 lore raw

cover vhost-user-bridge: Fix stdbuf and ASAN interaction

From: Yodel Eldar <[email protected]>

Hi,

As reported by Marc-André in (1), the functional test of vhost-user-bridge (vubr) encounters a runtime error when vubr is built with ASAN, because the "ASan runtime does not come first in initial library list."

Upon Michael's suggestion, this series converts the DPRINT debug output macro in vubr to use stderr instead of stdout for output. With that change, the functional test no longer needs to invoke stdbuf, so it is removed.

Thanks,
Yodel

(1) https://lore.kernel.org/qemu-devel/[email protected]/

Yodel Eldar (2):
contrib/vhost-user-bridge: Use stderr for debug output tests/functional/x86_64/test_vhost_user_bridge: Eliminate stdbuf usage

 contrib/vhost-user-bridge/vhost-user-bridge.c     | 2 +-
 tests/functional/x86_64/test_vhost_user_bridge.py | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)
Signature · 1 line
2.55.0
#1 lore raw

PATCH 1/2 contrib/vhost-user-bridge: Use stderr for debug output

From: Yodel Eldar <[email protected]>

Since vhost-user-bridge is solely used for testing, and logging to stderr ensures proper interleaving of debug output in automated testing, modify the DPRINT macro to write to stderr instead of stdout.

Message ID of relevant thread:
<[email protected]>

---
 contrib/vhost-user-bridge/vhost-user-bridge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/vhost-user-bridge/vhost-user-bridge.c +1 -1
index 3f0fd0fa49..a6f7ec226c 100644
@@ -41,7 +41,7 @@
 #define DPRINT(...) \
     do { \
         if (VHOST_USER_BRIDGE_DEBUG) { \
-            printf(__VA_ARGS__); \
+            fprintf(stderr, __VA_ARGS__); \
         } \
     } while (0)
 
Signature · 1 line
2.55.0
#2 lore raw

PATCH 2/2 tests/functional/x86_64/test_vhost_user_bridge: Eliminate stdbuf usage

In reply to Yodel Eldar

From: Yodel Eldar <[email protected]>

Usage of stdbuf triggers a runtime error when vhost-user-bridge is built with ASAN. Now that vhost-user-bridge writes debug output to stderr, stdbuf is obviated; remove its invocation.

Message ID of relevant thread:
<[email protected]>

---
 tests/functional/x86_64/test_vhost_user_bridge.py | 6 ------
 1 file changed, 6 deletions(-)
tests/functional/x86_64/test_vhost_user_bridge.py +0 -6
index c36c625420..5e1db48884 100755
@@ -76,12 +76,6 @@ def configure_vm(self, ud_socket_path, lport, rport, hostfwd_port, tftpdir):
     def assemble_vubr_args(self, vubr_path, ud_socket_path, lport, rport):
         vubr_args = []
 
-        if (stdbuf_path := which("stdbuf")) is None:
-            self.log.info("Could not find stdbuf: vhost-user-bridge "
-                          "log lines may appear out of order")
-        else:
-            vubr_args += [stdbuf_path, "-o0", "-e0"]
-
         vubr_args += [vubr_path, "-u", f"{ud_socket_path}",
                       "-l", f"127.0.0.1:{lport}", "-r", f"127.0.0.1:{rport}"]
 
Signature · 1 line
2.55.0
Reviewed-by on the v1 series
#3 lore raw
In reply to Yodel Eldar
Quoted 20 lines · Yodel Eldar

From: Yodel Eldar <[email protected]>

Hi,

As reported by Marc-André in (1), the functional test of vhost-user-bridge (vubr) encounters a runtime error when vubr is built with ASAN, because the "ASan runtime does not come first in initial library list."

Upon Michael's suggestion, this series converts the DPRINT debug output macro in vubr to use stderr instead of stdout for output. With that change, the functional test no longer needs to invoke stdbuf, so it is removed.

Thanks,
Yodel

(1) https://lore.kernel.org/qemu-devel/[email protected]/

Quoted 8 lines

Yodel Eldar (2):
contrib/vhost-user-bridge: Use stderr for debug output tests/functional/x86_64/test_vhost_user_bridge: Eliminate stdbuf usage

 contrib/vhost-user-bridge/vhost-user-bridge.c     | 2 +-
 tests/functional/x86_64/test_vhost_user_bridge.py | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

thanks

Quoted 4 lines

--
2.55.0

#4 lore raw
In reply to Yodel Eldar

Hi,

Quoted 19 lines · Yodel Eldar

From: Yodel Eldar <[email protected]>

Hi,

As reported by Marc-André in (1), the functional test of vhost-user-bridge (vubr) encounters a runtime error when vubr is built with ASAN, because the "ASan runtime does not come first in initial library list."

Upon Michael's suggestion, this series converts the DPRINT debug output macro in vubr to use stderr instead of stdout for output. With that change, the functional test no longer needs to invoke stdbuf, so it is removed.

Thanks,
Yodel

(1) https://lore.kernel.org/qemu-devel/[email protected]/

Quoted 8 lines

Yodel Eldar (2):
contrib/vhost-user-bridge: Use stderr for debug output tests/functional/x86_64/test_vhost_user_bridge: Eliminate stdbuf usage

  contrib/vhost-user-bridge/vhost-user-bridge.c     | 2 +-
  tests/functional/x86_64/test_vhost_user_bridge.py | 6 ------
  2 files changed, 1 insertion(+), 7 deletions(-)

Ping?

Note: Series is fully reviewed (thanks Marc-André).

Link:
https://lore.kernel.org/qemu-devel/[email protected]/

Thanks,
Yodel

#5 lore raw
Quoted 33 lines · Yodel Eldar

Hi,

Quoted 19 lines · Yodel Eldar

From: Yodel Eldar <[email protected]>

Hi,

As reported by Marc-André in (1), the functional test of vhost-user-bridge (vubr) encounters a runtime error when vubr is built with ASAN, because the "ASan runtime does not come first in initial library list."

Upon Michael's suggestion, this series converts the DPRINT debug output macro in vubr to use stderr instead of stdout for output. With that change, the functional test no longer needs to invoke stdbuf, so it is removed.

Thanks,
Yodel

(1) https://lore.kernel.org/qemu-devel/[email protected]/

Quoted 8 lines

Yodel Eldar (2):
contrib/vhost-user-bridge: Use stderr for debug output tests/functional/x86_64/test_vhost_user_bridge: Eliminate stdbuf usage

  contrib/vhost-user-bridge/vhost-user-bridge.c     | 2 +-
  tests/functional/x86_64/test_vhost_user_bridge.py | 6 ------
  2 files changed, 1 insertion(+), 7 deletions(-)

Ping?

Quoted 7 lines

Note: Series is fully reviewed (thanks Marc-André).

Link:
https://lore.kernel.org/qemu-devel/[email protected]/

Thanks,
Yodel

Hi!
Review delayed due to lots of holidays. I'll get back on the treadmill beginning of Oct. Sorry.