Skip to contentSkip to conversation

x86: Make debug output consistent in hvm_set_callback_via

PATCH In review Malcolm Crossley 2 participants 2 messages Dec 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: Make debug output consistent in hvm_set_callback_via

The unconditional printks in the switch statement of the hvm_set_callback_via function results in Xen log spam in non debug versions of Xen. The printks are for debug output only so conditionally compile the entire switch statement on debug versions of Xen only.

---
 xen/arch/x86/hvm/irq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/irq.c +3 -1
index 0f3ab6c..54f9701 100644
@@ -386,7 +386,8 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)
 
     spin_unlock(&d->arch.hvm_domain.irq_lock);
 
-    dprintk(XENLOG_G_INFO, "Dom%u callback via changed to ", d->domain_id);
+#ifndef NDEBUG
+    printk(XENLOG_G_INFO, "Dom%u callback via changed to ", d->domain_id);
     switch ( via_type )
     {
     case HVMIRQ_callback_gsi:
@@ -402,6 +403,7 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)
         printk("None\n");
         break;
     }
+#endif
 }
 
 struct hvm_intack hvm_vcpu_has_pending_irq(struct vcpu *v)
Signature · 1 line
1.7.12.4
#1 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 16.12.15 at 17:10, <[email protected]> wrote:

The unconditional printks in the switch statement of the hvm_set_callback_via function results in Xen log spam in non debug versions of Xen.

Oh, now I see - that's because dprintk() is a no-op inline nowadays.

xen/arch/x86/hvm/irq.c void hvm_set_callback_via(struct domain *d, uint64_t via) · line 390

Quoted 9 lines
xen/arch/x86/hvm/irq.c +2 -1
@@ -386,7 +386,8 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)
 
     spin_unlock(&d->arch.hvm_domain.irq_lock);
 
-    dprintk(XENLOG_G_INFO, "Dom%u callback via changed to ", d->domain_id);
+#ifndef NDEBUG
+    printk(XENLOG_G_INFO, "Dom%u callback via changed to ", d->domain_id);

This won't compile without warnings due to the extra comma.

The right solution here seems to be to clone Linux'es "continue" log level, and then make dprintk() avoid adding its prefix in that case.

Jan