Skip to contentSkip to conversation

argo: Fixes to argo_dprintk()

PATCH In review Andrew Cooper 3 participants 3 messages Oct 14, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 argo: Fixes to argo_dprintk()

Rewrite argo_dprintk() so printk() format typechecking can always be performed. This also fixes the evaluation of parameters. Emit the messages at XENLOG_DEBUG.

---
CC: Jason Andryuk <[email protected]>
CC: Christopher Clark <[email protected]>

---
 xen/common/argo.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
xen/common/argo.c +6 -8
index 9ad2ecaa1e42..f29fa720fc48 100644
@@ -313,14 +313,12 @@ static DEFINE_RWLOCK(L1_global_argo_rwlock); /* L1 */
     ((LOCKING_Read_L1 && spin_is_locked(&(d)->argo->send_L2_lock)) || \
      LOCKING_Write_L1)
 
-/* Change this to #define ARGO_DEBUG here to enable more debug messages */
-#undef ARGO_DEBUG
-
-#ifdef ARGO_DEBUG
-#define argo_dprintk(format, args...) printk("argo: " format, ## args )
-#else
-#define argo_dprintk(format, ... ) ((void)0)
-#endif
+#define ARGO_DEBUG 0
+#define argo_dprintk(fmt, args...)                      \
+    do {                                                \
+        if ( ARGO_DEBUG )                               \
+            printk(XENLOG_DEBUG "argo: " fmt, ##args);  \
+    } while ( 0 )
 
 /*
  * This hash function is used to distribute rings within the per-domain
Signature · 1 line
2.11.0
#2 lore raw
In reply to Andrew Cooper
Quoted 3 lines · Andrew Cooper

Rewrite argo_dprintk() so printk() format typechecking can always be performed. This also fixes the evaluation of parameters. Emit the messages at XENLOG_DEBUG.

I guess I don't really understand the "fixes the evaluation of parameters"
aspect: What is it that works differently now compared to before? If ARGO_DEBUG is 0, none of the arguments will be evaluated, just like was the case already.

Jan