[PATCH] argo: Fixes to argo_dprintk()

Andrew Cooper posted 1 patch 1 year, 6 months ago
Test gitlab-ci failed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20221014140221.31966-1-andrew.cooper3@citrix.com
xen/common/argo.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
[PATCH] argo: Fixes to argo_dprintk()
Posted by Andrew Cooper 1 year, 6 months ago
Rewrite argo_dprintk() so printk() format typechecking can always be
performed.  This also fixes the evaluation of parameters.  Emit the messages
at XENLOG_DEBUG.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jason Andryuk <jandryuk@gmail.com>
CC: Christopher Clark <christopher.w.clark@gmail.com>
---
 xen/common/argo.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/xen/common/argo.c b/xen/common/argo.c
index 9ad2ecaa1e42..f29fa720fc48 100644
--- a/xen/common/argo.c
+++ b/xen/common/argo.c
@@ -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
-- 
2.11.0
Re: [PATCH] argo: Fixes to argo_dprintk()
Posted by Jan Beulich 1 year, 6 months ago
On 14.10.2022 16:02, Andrew Cooper wrote:
> 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
Re: [PATCH] argo: Fixes to argo_dprintk()
Posted by Jason Andryuk 1 year, 6 months ago
On Fri, Oct 14, 2022 at 10:02 AM Andrew Cooper
<andrew.cooper3@citrix.com> wrote:
>
> Rewrite argo_dprintk() so printk() format typechecking can always be
> performed.  This also fixes the evaluation of parameters.  Emit the messages
> at XENLOG_DEBUG.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jason Andryuk <jandryuk@gmail.com>

Thanks,
Jason