Skip to contentSkip to conversation

VT-d: reduce default verbosity

PATCH New Jan Beulich 1 participant 1 message Mar 16, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VT-d: reduce default verbosity

Introduce a new sub-option "verbose" to "iommu=", and hide most (debugging) messages when that option is not specified. Particularly messages printed after time management was initialized can, on sufficiently large systems and with a graphical console, lead to time management issues (therefore a call to process_pending_softirqs() also gets added in case the new sub-option is being used).

While touching that code, also convert all improper uses of gdprintk() to dprintk(), and convert all boolean iommu config variables to bool_t residing in the .data.read_mostly section.

xen/arch/x86/x86_64/mmconfig-shared.c +0 -5
@@ -454,12 +454,7 @@ int pci_find_ext_capability(int seg, int
      * cap version and next pointer all being 0.
      */
     if ( (header == 0) || (header == -1) )
-    {
-        dprintk(XENLOG_INFO VTDPREFIX,
-                "next cap:%x:%x.%x:  no extended config\n",
-                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         return 0;
-    }
 
     while ( ttl-- > 0 ) {
         if ( PCI_EXT_CAP_ID(header) == cap )
xen/drivers/passthrough/amd/iommu_init.c +2 -2
@@ -355,7 +355,7 @@ static void iommu_msi_set_affinity(unsig
 
     dest = set_desc_affinity(desc, mask);
     if (dest == BAD_APICID){
-        gdprintk(XENLOG_ERR, "Set iommu interrupt affinity error!\n");
+        dprintk(XENLOG_ERR, "Set iommu interrupt affinity error!\n");
         return;
     }
 
@@ -531,7 +531,7 @@ static int set_iommu_interrupt_handler(s
     irq = create_irq();
     if ( irq <= 0 )
     {
-        gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: no irqs\n");
+        dprintk(XENLOG_ERR, "IOMMU: no irqs\n");
         return 0;
     }
     
xen/drivers/passthrough/io.c +15 -10
@@ -292,10 +292,12 @@ int pt_irq_create_bind_vtd(
             }
         }
 
-        gdprintk(XENLOG_INFO VTDPREFIX,
-                 "VT-d irq bind: m_irq = %x device = %x intx = %x\n",
-                 machine_gsi, device, intx);
         spin_unlock(&d->event_lock);
+
+        if ( iommu_verbose )
+            dprintk(VTDPREFIX,
+                    "d%d: bind: m_gsi=%u g_gsi=%u device=%u intx=%u\n",
+                    d->domain_id, machine_gsi, guest_gsi, device, intx);
     }
     return 0;
 }
@@ -316,10 +318,11 @@ int pt_irq_destroy_bind_vtd(
     guest_gsi = hvm_pci_intx_gsi(device, intx);
     link = hvm_pci_intx_link(device, intx);
 
-    gdprintk(XENLOG_INFO,
-             "pt_irq_destroy_bind_vtd: machine_gsi=%d "
-             "guest_gsi=%d, device=%d, intx=%d.\n",
-             machine_gsi, guest_gsi, device, intx);
+    if ( iommu_verbose )
+        dprintk(VTDPREFIX,
+                "d%d: unbind: m_gsi=%u g_gsi=%u device=%u intx=%u\n",
+                d->domain_id, machine_gsi, guest_gsi, device, intx);
+
     spin_lock(&d->event_lock);
 
     hvm_irq_dpci = domain_get_irq_dpci(d);
@@ -372,9 +375,11 @@ int pt_irq_destroy_bind_vtd(
         }
     }
     spin_unlock(&d->event_lock);
-    gdprintk(XENLOG_INFO,
-             "XEN_DOMCTL_irq_unmapping: m_irq = 0x%x device = 0x%x intx = 0x%x\n",
-             machine_gsi, device, intx);
+
+    if ( iommu_verbose )
+        dprintk(VTDPREFIX,
+                "d%d unmap: m_irq=%u device=%u intx=%u\n",
+                d->domain_id, machine_gsi, device, intx);
 
     return 0;
 }
xen/drivers/passthrough/iommu.c +18 -15
@@ -39,16 +39,17 @@ static int iommu_populate_page_table(str
  *   no-intremap                Disable VT-d Interrupt Remapping
  */
 custom_param("iommu", parse_iommu_param);
-int iommu_enabled = 1;
-int iommu_pv_enabled;
-int force_iommu;
-int iommu_workaround_bios_bug;
-int iommu_passthrough;
-int iommu_snoop = 1;
-int iommu_qinval = 1;
-int iommu_intremap = 1;
-int amd_iommu_debug;
-int amd_iommu_perdev_intremap;
+bool_t __read_mostly iommu_enabled = 1;
+bool_t __read_mostly iommu_pv_enabled;
+bool_t __read_mostly force_iommu;
+bool_t __read_mostly iommu_verbose;
+bool_t __read_mostly iommu_workaround_bios_bug;
+bool_t __read_mostly iommu_passthrough;
+bool_t __read_mostly iommu_snoop = 1;
+bool_t __read_mostly iommu_qinval = 1;
+bool_t __read_mostly iommu_intremap = 1;
+bool_t __read_mostly amd_iommu_debug;
+bool_t __read_mostly amd_iommu_perdev_intremap;
 
 static void __init parse_iommu_param(char *s)
 {
@@ -72,6 +73,8 @@ static void __init parse_iommu_param(cha
             iommu_workaround_bios_bug = 1;
         else if ( !strcmp(s, "passthrough") )
             iommu_passthrough = 1;
+        else if ( !strcmp(s, "verbose") )
+            iommu_verbose = 1;
         else if ( !strcmp(s, "no-snoop") )
             iommu_snoop = 0;
         else if ( !strcmp(s, "no-qinval") )
@@ -251,17 +254,17 @@ int deassign_device(struct domain *d, u8
 
     if ( pdev->domain != d )
     {
-        gdprintk(XENLOG_ERR VTDPREFIX,
-                "IOMMU: deassign a device not owned\n");
+        dprintk(XENLOG_ERR VTDPREFIX,
+                "d%d: deassign a device not owned\n", d->domain_id);
         return -EINVAL;
     }
 
     ret = hd->platform_ops->reassign_device(d, dom0, bus, devfn);
     if ( ret )
     {
-        gdprintk(XENLOG_ERR VTDPREFIX,
-                 "Deassign device (%x:%x.%x) failed!\n",
-                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_ERR VTDPREFIX,
+                "d%d: Deassign device (%x:%x.%x) failed!\n",
+                d->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         return ret;
     }
 
xen/drivers/passthrough/vtd/dmar.c +48 -29

154 lines not on this page · raw message

xen/drivers/passthrough/vtd/intremap.c +3 -3
@@ -475,9 +475,9 @@ static void set_msi_source_id(struct pci
         break;
 
     default:
-        gdprintk(XENLOG_WARNING VTDPREFIX,
-                 "set_msi_source_id: unknown type : bdf = %x:%x.%x\n",
-                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_WARNING VTDPREFIX, "d%d: unknown(%u): bdf = %x:%x.%x\n",
+                pdev->domain->domain_id, type,
+                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         break;
    }
 }
xen/drivers/passthrough/vtd/iommu.c +43 -36

163 lines not on this page · raw message

xen/include/xen/iommu.h +4 -8
@@ -26,14 +26,10 @@
 #include <public/hvm/ioreq.h>
 #include <public/domctl.h>
 
-extern int iommu_enabled;
-extern int iommu_pv_enabled;
-extern int force_iommu;
-extern int iommu_workaround_bios_bug;
-extern int iommu_passthrough;
-extern int iommu_snoop;
-extern int iommu_qinval;
-extern int iommu_intremap;
+extern bool_t iommu_enabled, iommu_pv_enabled;
+extern bool_t force_iommu, iommu_verbose;
+extern bool_t iommu_workaround_bios_bug, iommu_passthrough;
+extern bool_t iommu_snoop, iommu_qinval, iommu_intremap;
 
 #define domain_hvm_iommu(d)     (&d->arch.hvm_domain.hvm_iommu)
 

Introduce a new sub-option "verbose" to "iommu=", and hide most (debugging) messages when that option is not specified. Particularly messages printed after time management was initialized can, on sufficiently large systems and with a graphical console, lead to time management issues (therefore a call to process_pending_softirqs() also gets added in case the new sub-option is being used).

While touching that code, also convert all improper uses of gdprintk() to dprintk(), and convert all boolean iommu config variables to bool_t residing in the .data.read_mostly section.

xen/arch/x86/x86_64/mmconfig-shared.c +0 -5
@@ -454,12 +454,7 @@ int pci_find_ext_capability(int seg, int
      * cap version and next pointer all being 0.
      */
     if ( (header == 0) || (header == -1) )
-    {
-        dprintk(XENLOG_INFO VTDPREFIX,
-                "next cap:%x:%x.%x:  no extended config\n",
-                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         return 0;
-    }
 
     while ( ttl-- > 0 ) {
         if ( PCI_EXT_CAP_ID(header) == cap )
xen/drivers/passthrough/amd/iommu_init.c +2 -2
@@ -355,7 +355,7 @@ static void iommu_msi_set_affinity(unsig
 
     dest = set_desc_affinity(desc, mask);
     if (dest == BAD_APICID){
-        gdprintk(XENLOG_ERR, "Set iommu interrupt affinity error!\n");
+        dprintk(XENLOG_ERR, "Set iommu interrupt affinity error!\n");
         return;
     }
 
@@ -531,7 +531,7 @@ static int set_iommu_interrupt_handler(s
     irq = create_irq();
     if ( irq <= 0 )
     {
-        gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: no irqs\n");
+        dprintk(XENLOG_ERR, "IOMMU: no irqs\n");
         return 0;
     }
     
xen/drivers/passthrough/io.c +15 -10
@@ -292,10 +292,12 @@ int pt_irq_create_bind_vtd(
             }
         }
 
-        gdprintk(XENLOG_INFO VTDPREFIX,
-                 "VT-d irq bind: m_irq = %x device = %x intx = %x\n",
-                 machine_gsi, device, intx);
         spin_unlock(&d->event_lock);
+
+        if ( iommu_verbose )
+            dprintk(VTDPREFIX,
+                    "d%d: bind: m_gsi=%u g_gsi=%u device=%u intx=%u\n",
+                    d->domain_id, machine_gsi, guest_gsi, device, intx);
     }
     return 0;
 }
@@ -316,10 +318,11 @@ int pt_irq_destroy_bind_vtd(
     guest_gsi = hvm_pci_intx_gsi(device, intx);
     link = hvm_pci_intx_link(device, intx);
 
-    gdprintk(XENLOG_INFO,
-             "pt_irq_destroy_bind_vtd: machine_gsi=%d "
-             "guest_gsi=%d, device=%d, intx=%d.\n",
-             machine_gsi, guest_gsi, device, intx);
+    if ( iommu_verbose )
+        dprintk(VTDPREFIX,
+                "d%d: unbind: m_gsi=%u g_gsi=%u device=%u intx=%u\n",
+                d->domain_id, machine_gsi, guest_gsi, device, intx);
+
     spin_lock(&d->event_lock);
 
     hvm_irq_dpci = domain_get_irq_dpci(d);
@@ -372,9 +375,11 @@ int pt_irq_destroy_bind_vtd(
         }
     }
     spin_unlock(&d->event_lock);
-    gdprintk(XENLOG_INFO,
-             "XEN_DOMCTL_irq_unmapping: m_irq = 0x%x device = 0x%x intx = 0x%x\n",
-             machine_gsi, device, intx);
+
+    if ( iommu_verbose )
+        dprintk(VTDPREFIX,
+                "d%d unmap: m_irq=%u device=%u intx=%u\n",
+                d->domain_id, machine_gsi, device, intx);
 
     return 0;
 }
xen/drivers/passthrough/iommu.c +18 -15
@@ -39,16 +39,17 @@ static int iommu_populate_page_table(str
  *   no-intremap                Disable VT-d Interrupt Remapping
  */
 custom_param("iommu", parse_iommu_param);
-int iommu_enabled = 1;
-int iommu_pv_enabled;
-int force_iommu;
-int iommu_workaround_bios_bug;
-int iommu_passthrough;
-int iommu_snoop = 1;
-int iommu_qinval = 1;
-int iommu_intremap = 1;
-int amd_iommu_debug;
-int amd_iommu_perdev_intremap;
+bool_t __read_mostly iommu_enabled = 1;
+bool_t __read_mostly iommu_pv_enabled;
+bool_t __read_mostly force_iommu;
+bool_t __read_mostly iommu_verbose;
+bool_t __read_mostly iommu_workaround_bios_bug;
+bool_t __read_mostly iommu_passthrough;
+bool_t __read_mostly iommu_snoop = 1;
+bool_t __read_mostly iommu_qinval = 1;
+bool_t __read_mostly iommu_intremap = 1;
+bool_t __read_mostly amd_iommu_debug;
+bool_t __read_mostly amd_iommu_perdev_intremap;
 
 static void __init parse_iommu_param(char *s)
 {
@@ -72,6 +73,8 @@ static void __init parse_iommu_param(cha
             iommu_workaround_bios_bug = 1;
         else if ( !strcmp(s, "passthrough") )
             iommu_passthrough = 1;
+        else if ( !strcmp(s, "verbose") )
+            iommu_verbose = 1;
         else if ( !strcmp(s, "no-snoop") )
             iommu_snoop = 0;
         else if ( !strcmp(s, "no-qinval") )
@@ -251,17 +254,17 @@ int deassign_device(struct domain *d, u8
 
     if ( pdev->domain != d )
     {
-        gdprintk(XENLOG_ERR VTDPREFIX,
-                "IOMMU: deassign a device not owned\n");
+        dprintk(XENLOG_ERR VTDPREFIX,
+                "d%d: deassign a device not owned\n", d->domain_id);
         return -EINVAL;
     }
 
     ret = hd->platform_ops->reassign_device(d, dom0, bus, devfn);
     if ( ret )
     {
-        gdprintk(XENLOG_ERR VTDPREFIX,
-                 "Deassign device (%x:%x.%x) failed!\n",
-                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_ERR VTDPREFIX,
+                "d%d: Deassign device (%x:%x.%x) failed!\n",
+                d->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         return ret;
     }
 
xen/drivers/passthrough/vtd/dmar.c +48 -29

154 lines not on this page · raw message

xen/drivers/passthrough/vtd/intremap.c +3 -3
@@ -475,9 +475,9 @@ static void set_msi_source_id(struct pci
         break;
 
     default:
-        gdprintk(XENLOG_WARNING VTDPREFIX,
-                 "set_msi_source_id: unknown type : bdf = %x:%x.%x\n",
-                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_WARNING VTDPREFIX, "d%d: unknown(%u): bdf = %x:%x.%x\n",
+                pdev->domain->domain_id, type,
+                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         break;
    }
 }
xen/drivers/passthrough/vtd/iommu.c +43 -36

163 lines not on this page · raw message

xen/include/xen/iommu.h +4 -8
@@ -26,14 +26,10 @@
 #include <public/hvm/ioreq.h>
 #include <public/domctl.h>
 
-extern int iommu_enabled;
-extern int iommu_pv_enabled;
-extern int force_iommu;
-extern int iommu_workaround_bios_bug;
-extern int iommu_passthrough;
-extern int iommu_snoop;
-extern int iommu_qinval;
-extern int iommu_intremap;
+extern bool_t iommu_enabled, iommu_pv_enabled;
+extern bool_t force_iommu, iommu_verbose;
+extern bool_t iommu_workaround_bios_bug, iommu_passthrough;
+extern bool_t iommu_snoop, iommu_qinval, iommu_intremap;
 
 #define domain_hvm_iommu(d)     (&d->arch.hvm_domain.hvm_iommu)
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel