Skip to contentSkip to conversation

XSA-169 follow-up

PATCH In review Jan Beulich 4 participants 10 messages Dec 21, 2015 – Dec 22, 2015 Arm Samsung Exynos

lore
Share & tools
lore
#0 lore raw

cover XSA-169 follow-up

While auditing code for further similar issues, a couple of oddities were found:

1: arm: add missing newlines to printk()s
2: x86: misc printk() adjustments
3: VT-d: unhide messages needed for diagnosing firmware issues 4: IOMMU: unhide messages useful for diagnostics

#1 lore raw

PATCH 1/4 arm: add missing newlines to printk()s

xen/arch/arm/platforms/brcm.c +1 -1
@@ -162,7 +162,7 @@ static int brcm_cpu_power_on(int cpu)
 
     if ( timeout == 0 )
     {
-        dprintk(XENLOG_ERR, "CPU%d power enable failed", cpu);
+        dprintk(XENLOG_ERR, "CPU%d power enable failed\n", cpu);
         return -ETIMEDOUT;
     }
 
xen/arch/arm/platforms/exynos5.c +1 -1
@@ -183,7 +183,7 @@ static int exynos5_cpu_power_up(void __i
 
         if ( timeout == 0 )
         {
-            dprintk(XENLOG_ERR, "CPU%d power enable failed", cpu);
+            dprintk(XENLOG_ERR, "CPU%d power enable failed\n", cpu);
             return -ETIMEDOUT;
         }
     }

arm: add missing newlines to printk()s

xen/arch/arm/platforms/brcm.c +1 -1
@@ -162,7 +162,7 @@ static int brcm_cpu_power_on(int cpu)
 
     if ( timeout == 0 )
     {
-        dprintk(XENLOG_ERR, "CPU%d power enable failed", cpu);
+        dprintk(XENLOG_ERR, "CPU%d power enable failed\n", cpu);
         return -ETIMEDOUT;
     }
 
xen/arch/arm/platforms/exynos5.c +1 -1
@@ -183,7 +183,7 @@ static int exynos5_cpu_power_up(void __i
 
         if ( timeout == 0 )
         {
-            dprintk(XENLOG_ERR, "CPU%d power enable failed", cpu);
+            dprintk(XENLOG_ERR, "CPU%d power enable failed\n", cpu);
             return -ETIMEDOUT;
         }
     }

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

Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] arm: add missing newlines to printk()s

Quoted 1 line · Jan Beulich
Quoted 26 lines
xen/arch/arm/platforms/brcm.c +1 -1
@@ -162,7 +162,7 @@ static int brcm_cpu_power_on(int cpu)
 
     if ( timeout == 0 )
     {
-        dprintk(XENLOG_ERR, "CPU%d power enable failed", cpu);
+        dprintk(XENLOG_ERR, "CPU%d power enable failed\n", cpu);
         return -ETIMEDOUT;
     }
 
xen/arch/arm/platforms/exynos5.c +1 -1
@@ -183,7 +183,7 @@ static int exynos5_cpu_power_up(void __i
 
         if ( timeout == 0 )
         {
-            dprintk(XENLOG_ERR, "CPU%d power enable failed", cpu);
+            dprintk(XENLOG_ERR, "CPU%d power enable failed\n", cpu);
             return -ETIMEDOUT;
         }
     }
#3 lore raw

PATCH 2/4 x86: misc printk() adjustments

In reply to Jan Beulich

- a missing newline
- missing log levels (in Dom0-only messages)
- one dprintk() -> printk() conversion

xen/arch/x86/acpi/power.c +1 -1
@@ -268,7 +268,7 @@ int acpi_enter_sleep(struct xenpf_enter_
     else if ( sleep->val_b &&
               ((sleep->val_a ^ sleep->val_b) & ACPI_BITMASK_SLEEP_ENABLE) )
     {
-        gdprintk(XENLOG_ERR, "Mismatched pm1a/pm1b setting.");
+        gdprintk(XENLOG_ERR, "Mismatched pm1a/pm1b setting\n");
         return -EINVAL;
     }
 
xen/arch/x86/io_apic.c +9 -8
@@ -2310,13 +2310,14 @@ int ioapic_guest_read(unsigned long phys
     return 0;
 }
 
-#define WARN_BOGUS_WRITE(f, a...)                                       \
-    dprintk(XENLOG_INFO, "\n%s: "                                        \
-            "apic=%d, pin=%d, irq=%d\n"                 \
-            "%s: new_entry=%08x\n"                      \
-            "%s: " f, __FUNCTION__, apic, pin, irq,        \
-            __FUNCTION__, *(u32 *)&rte,           \
-            __FUNCTION__ , ##a )
+#define WARN_BOGUS_WRITE(f, a...)                       \
+    dprintk(XENLOG_INFO, "\n"                           \
+            XENLOG_INFO "%s: apic=%d, pin=%d, irq=%d\n" \
+            XENLOG_INFO "%s: new_entry=%08x\n"          \
+            XENLOG_INFO "%s: " f "\n",                  \
+            __func__, apic, pin, irq,                   \
+            __func__, *(u32 *)&rte,                     \
+            __func__, ##a )
 
 int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
 {
@@ -2388,7 +2389,7 @@ int ioapic_guest_write(unsigned long phy
         rte.vector = desc->arch.vector;
         if ( *(u32*)&rte != ret )
             WARN_BOGUS_WRITE("old_entry=%08x pirq=%d\n%s: "
-                             "Attempt to modify IO-APIC pin for in-use IRQ!\n",
+                             "Attempt to modify IO-APIC pin for in-use IRQ!",
                              ret, pirq, __FUNCTION__);
         return 0;
     }
xen/arch/x86/x86_64/mm.c +3 -2
@@ -1366,8 +1366,9 @@ int memory_add(unsigned long spfn, unsig
 
     if ( !valid_numa_range(spfn << PAGE_SHIFT, epfn << PAGE_SHIFT, node) )
     {
-        dprintk(XENLOG_WARNING, "spfn %lx ~ epfn %lx pxm %x node %x"
-            "is not numa valid", spfn, epfn, pxm, node);
+        printk(XENLOG_WARNING
+               "pfn range %lx..%lx PXM %x node %x is not NUMA-valid\n",
+               spfn, epfn, pxm, node);
         return -EINVAL;
     }
 

x86: misc printk() adjustments

- a missing newline
- missing log levels (in Dom0-only messages)
- one dprintk() -> printk() conversion

xen/arch/x86/acpi/power.c +1 -1
@@ -268,7 +268,7 @@ int acpi_enter_sleep(struct xenpf_enter_
     else if ( sleep->val_b &&
               ((sleep->val_a ^ sleep->val_b) & ACPI_BITMASK_SLEEP_ENABLE) )
     {
-        gdprintk(XENLOG_ERR, "Mismatched pm1a/pm1b setting.");
+        gdprintk(XENLOG_ERR, "Mismatched pm1a/pm1b setting\n");
         return -EINVAL;
     }
 
xen/arch/x86/io_apic.c +9 -8
@@ -2310,13 +2310,14 @@ int ioapic_guest_read(unsigned long phys
     return 0;
 }
 
-#define WARN_BOGUS_WRITE(f, a...)                                       \
-    dprintk(XENLOG_INFO, "\n%s: "                                        \
-            "apic=%d, pin=%d, irq=%d\n"                 \
-            "%s: new_entry=%08x\n"                      \
-            "%s: " f, __FUNCTION__, apic, pin, irq,        \
-            __FUNCTION__, *(u32 *)&rte,           \
-            __FUNCTION__ , ##a )
+#define WARN_BOGUS_WRITE(f, a...)                       \
+    dprintk(XENLOG_INFO, "\n"                           \
+            XENLOG_INFO "%s: apic=%d, pin=%d, irq=%d\n" \
+            XENLOG_INFO "%s: new_entry=%08x\n"          \
+            XENLOG_INFO "%s: " f "\n",                  \
+            __func__, apic, pin, irq,                   \
+            __func__, *(u32 *)&rte,                     \
+            __func__, ##a )
 
 int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
 {
@@ -2388,7 +2389,7 @@ int ioapic_guest_write(unsigned long phy
         rte.vector = desc->arch.vector;
         if ( *(u32*)&rte != ret )
             WARN_BOGUS_WRITE("old_entry=%08x pirq=%d\n%s: "
-                             "Attempt to modify IO-APIC pin for in-use IRQ!\n",
+                             "Attempt to modify IO-APIC pin for in-use IRQ!",
                              ret, pirq, __FUNCTION__);
         return 0;
     }
xen/arch/x86/x86_64/mm.c +3 -2
@@ -1366,8 +1366,9 @@ int memory_add(unsigned long spfn, unsig
 
     if ( !valid_numa_range(spfn << PAGE_SHIFT, epfn << PAGE_SHIFT, node) )
     {
-        dprintk(XENLOG_WARNING, "spfn %lx ~ epfn %lx pxm %x node %x"
-            "is not numa valid", spfn, epfn, pxm, node);
+        printk(XENLOG_WARNING
+               "pfn range %lx..%lx PXM %x node %x is not NUMA-valid\n",
+               spfn, epfn, pxm, node);
         return -EINVAL;
     }
 

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

#4 lore raw

Re: [PATCH 2/4] x86: misc printk() adjustments

Quoted 25 lines · Jan Beulich
xen/arch/x86/io_apic.c +8 -7
@@ -2310,13 +2310,14 @@ int ioapic_guest_read(unsigned long phys
     return 0;
 }
 
-#define WARN_BOGUS_WRITE(f, a...)                                       \
-    dprintk(XENLOG_INFO, "\n%s: "                                        \
-            "apic=%d, pin=%d, irq=%d\n"                 \
-            "%s: new_entry=%08x\n"                      \
-            "%s: " f, __FUNCTION__, apic, pin, irq,        \
-            __FUNCTION__, *(u32 *)&rte,           \
-            __FUNCTION__ , ##a )
+#define WARN_BOGUS_WRITE(f, a...)                       \
+    dprintk(XENLOG_INFO, "\n"                           \
+            XENLOG_INFO "%s: apic=%d, pin=%d, irq=%d\n" \
+            XENLOG_INFO "%s: new_entry=%08x\n"          \
+            XENLOG_INFO "%s: " f "\n",                  \
+            __func__, apic, pin, irq,                   \
+            __func__, *(u32 *)&rte,                     \
+            __func__, ##a )
 
 int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
 {

xen/arch/x86/io_apic.c int ioapic_guest_write(unsigned long phy · line 2393

Quoted 6 lines
xen/arch/x86/io_apic.c +1 -1
@@ -2388,7 +2389,7 @@ int ioapic_guest_write(unsigned long phy
         rte.vector = desc->arch.vector;
         if ( *(u32*)&rte != ret )
             WARN_BOGUS_WRITE("old_entry=%08x pirq=%d\n%s: "
-                             "Attempt to modify IO-APIC pin for in-use IRQ!\n",
+                             "Attempt to modify IO-APIC pin for in-use IRQ!",
                              ret, pirq, __FUNCTION__);

Given that this is the sole user of WARN_BOGUS_WRITE(), I would recommend folding it all together in a simple dprintk(), and remove some of the redundant information, and fixing the resulting message to take up fewer lines.

~Andrew

#5 lore raw

Re: [PATCH 2/4] x86: misc printk() adjustments

Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 21.12.15 at 15:41, <[email protected]> wrote:
Quoted 22 lines · Jan Beulich
xen/arch/x86/io_apic.c +8 -7
@@ -2310,13 +2310,14 @@ int ioapic_guest_read(unsigned long phys
     return 0;
 }
 
-#define WARN_BOGUS_WRITE(f, a...)                                       \
-    dprintk(XENLOG_INFO, "\n%s: "                                        \
-            "apic=%d, pin=%d, irq=%d\n"                 \
-            "%s: new_entry=%08x\n"                      \
-            "%s: " f, __FUNCTION__, apic, pin, irq,        \
-            __FUNCTION__, *(u32 *)&rte,           \
-            __FUNCTION__ , ##a )
+#define WARN_BOGUS_WRITE(f, a...)                       \
+    dprintk(XENLOG_INFO, "\n"                           \
+            XENLOG_INFO "%s: apic=%d, pin=%d, irq=%d\n" \
+            XENLOG_INFO "%s: new_entry=%08x\n"          \
+            XENLOG_INFO "%s: " f "\n",                  \
+            __func__, apic, pin, irq,                   \
+            __func__, *(u32 *)&rte,                     \
+            __func__, ##a )
 
Quoted 14 lines

xen/arch/x86/io_apic.c int ioapic_guest_write(unsigned long phy · line 2393

Quoted 9 lines
xen/arch/x86/io_apic.c +1 -1
 int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
 {
@@ -2388,7 +2389,7 @@ int ioapic_guest_write(unsigned long phy
         rte.vector = desc->arch.vector;
         if ( *(u32*)&rte != ret )
             WARN_BOGUS_WRITE("old_entry=%08x pirq=%d\n%s: "
-                             "Attempt to modify IO-APIC pin for in-use IRQ!\n",
+                             "Attempt to modify IO-APIC pin for in-use IRQ!",
                              ret, pirq, __FUNCTION__);

Given that this is the sole user of WARN_BOGUS_WRITE(), I would recommend folding it all together in a simple dprintk(), and remove some of the redundant information, and fixing the resulting message to take up fewer lines.

If you feel strongly about this I could certainly do so, but I did consider that option and decided against it to retain the option of using the macro (again?) in a second place.

Jan

#6 lore raw

Re: [PATCH 2/4] x86: misc printk() adjustments

Quoted 37 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 21.12.15 at 15:41, <[email protected]> wrote:
Quoted 22 lines · Jan Beulich
xen/arch/x86/io_apic.c +8 -7
@@ -2310,13 +2310,14 @@ int ioapic_guest_read(unsigned long phys
     return 0;
 }
 
-#define WARN_BOGUS_WRITE(f, a...)                                       \
-    dprintk(XENLOG_INFO, "\n%s: "                                        \
-            "apic=%d, pin=%d, irq=%d\n"                 \
-            "%s: new_entry=%08x\n"                      \
-            "%s: " f, __FUNCTION__, apic, pin, irq,        \
-            __FUNCTION__, *(u32 *)&rte,           \
-            __FUNCTION__ , ##a )
+#define WARN_BOGUS_WRITE(f, a...)                       \
+    dprintk(XENLOG_INFO, "\n"                           \
+            XENLOG_INFO "%s: apic=%d, pin=%d, irq=%d\n" \
+            XENLOG_INFO "%s: new_entry=%08x\n"          \
+            XENLOG_INFO "%s: " f "\n",                  \
+            __func__, apic, pin, irq,                   \
+            __func__, *(u32 *)&rte,                     \
+            __func__, ##a )
 
Quoted 13 lines

xen/arch/x86/io_apic.c int ioapic_guest_write(unsigned long phy · line 2393

Quoted 9 lines
xen/arch/x86/io_apic.c +1 -1
 int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
 {
@@ -2388,7 +2389,7 @@ int ioapic_guest_write(unsigned long phy
         rte.vector = desc->arch.vector;
         if ( *(u32*)&rte != ret )
             WARN_BOGUS_WRITE("old_entry=%08x pirq=%d\n%s: "
-                             "Attempt to modify IO-APIC pin for in-use IRQ!\n",
+                             "Attempt to modify IO-APIC pin for in-use IRQ!",
                              ret, pirq, __FUNCTION__);

Given that this is the sole user of WARN_BOGUS_WRITE(), I would recommend folding it all together in a simple dprintk(), and remove some of the redundant information, and fixing the resulting message to take up fewer lines.

Quoted 3 lines

If you feel strongly about this I could certainly do so, but I did consider that option and decided against it to retain the option of using the macro (again?) in a second place.

I don't forsee it being useful to use again.

Either way, Reviewed-by: Andrew Cooper <[email protected]>

~Andrew

#7 lore raw

PATCH 3/4 VT-d: unhide messages needed for diagnosing firmware issues

In reply to Jan Beulich

Undue use of dprintk() lead to many messages useful in diagnosing issues in the field now being hidden in non-debug (i.e. production) builds. Re-surface them, namely when init-time only and/or already guarded by iommu_{verbose,debug} conditionals. Switch from using iommu_verbose to iommu_debug in a couple of runtime cases.

xen/drivers/passthrough/vtd/dmar.c +55 -66
@@ -298,7 +298,7 @@ static int __init scope_device_count(con
         scope = start;
         if ( scope->length < MIN_SCOPE_LEN )
         {
-            dprintk(XENLOG_WARNING VTDPREFIX, "Invalid device scope.\n");
+            printk(XENLOG_WARNING VTDPREFIX "Invalid device scope\n");
             return -EINVAL;
         }
 
@@ -360,18 +360,18 @@ static int __init acpi_parse_dev_scope(
             sub_bus = pci_conf_read8(seg, bus, path->dev, path->fn,
                                      PCI_SUBORDINATE_BUS);
             if ( iommu_verbose )
-                dprintk(VTDPREFIX,
-                        " bridge: %04x:%02x:%02x.%u start=%x sec=%x sub=%x\n",
-                        seg, bus, path->dev, path->fn,
-                        acpi_scope->bus, sec_bus, sub_bus);
+                printk(VTDPREFIX
+                       " bridge: %04x:%02x:%02x.%u start=%x sec=%x sub=%x\n",
+                       seg, bus, path->dev, path->fn,
+                       acpi_scope->bus, sec_bus, sub_bus);
 
             dmar_scope_add_buses(scope, sec_bus, sub_bus);
             break;
 
         case ACPI_DMAR_SCOPE_TYPE_HPET:
             if ( iommu_verbose )
-                dprintk(VTDPREFIX, " MSI HPET: %04x:%02x:%02x.%u\n",
-                        seg, bus, path->dev, path->fn);
+                printk(VTDPREFIX " MSI HPET: %04x:%02x:%02x.%u\n",
+                       seg, bus, path->dev, path->fn);
 
             if ( drhd )
             {
@@ -392,8 +392,8 @@ static int __init acpi_parse_dev_scope(
 
         case ACPI_DMAR_SCOPE_TYPE_ENDPOINT:
             if ( iommu_verbose )
-                dprintk(VTDPREFIX, " endpoint: %04x:%02x:%02x.%u\n",
-                        seg, bus, path->dev, path->fn);
+                printk(VTDPREFIX " endpoint: %04x:%02x:%02x.%u\n",
+                       seg, bus, path->dev, path->fn);
 
             if ( drhd )
             {
@@ -406,8 +406,8 @@ static int __init acpi_parse_dev_scope(
 
         case ACPI_DMAR_SCOPE_TYPE_IOAPIC:
             if ( iommu_verbose )
-                dprintk(VTDPREFIX, " IOAPIC: %04x:%02x:%02x.%u\n",
-                        seg, bus, path->dev, path->fn);
+                printk(VTDPREFIX " IOAPIC: %04x:%02x:%02x.%u\n",
+                       seg, bus, path->dev, path->fn);
 
             if ( drhd )
             {
@@ -449,9 +449,8 @@ static int __init acpi_dmar_check_length
 {
     if ( h->length >= min_len )
         return 0;
-    dprintk(XENLOG_ERR VTDPREFIX,
-            "Invalid ACPI DMAR entry length: %#x\n",
-            h->length);
+    printk(XENLOG_ERR VTDPREFIX "Invalid ACPI DMAR entry length: %#x\n",
+           h->length);
     return -EINVAL;
 }
 
@@ -481,8 +480,7 @@ acpi_parse_one_drhd(struct acpi_dmar_hea
     INIT_LIST_HEAD(&dmaru->ioapic_list);
     INIT_LIST_HEAD(&dmaru->hpet_list);
     if ( iommu_verbose )
-        dprintk(VTDPREFIX, "  dmaru->address = %"PRIx64"\n",
-                dmaru->address);
+        printk(VTDPREFIX "  dmaru->address = %"PRIx64"\n", dmaru->address);
 
     ret = iommu_alloc(dmaru);
     if ( ret )
@@ -496,12 +494,12 @@ acpi_parse_one_drhd(struct acpi_dmar_hea
     if ( dmaru->include_all )
     {
         if ( iommu_verbose )
-            dprintk(VTDPREFIX, "  flags: INCLUDE_ALL\n");
+            printk(VTDPREFIX "  flags: INCLUDE_ALL\n");
         /* Only allow one INCLUDE_ALL */
         if ( drhd->segment == 0 && include_all )
         {
-            dprintk(XENLOG_WARNING VTDPREFIX,
-                    "Only one INCLUDE_ALL device scope is allowed\n");
+            printk(XENLOG_WARNING VTDPREFIX
+                   "Only one INCLUDE_ALL device scope is allowed\n");
             ret = -EINVAL;
         }
         if ( drhd->segment == 0 )
@@ -538,9 +536,9 @@ acpi_parse_one_drhd(struct acpi_dmar_hea
 
             if ( !pci_device_detect(drhd->segment, b, d, f) )
             {
-                dprintk(XENLOG_WARNING VTDPREFIX,
-                        " Non-existent device (%04x:%02x:%02x.%u) is reported"
-                        " in this DRHD's scope!\n", drhd->segment, b, d, f);
+                printk(XENLOG_WARNING VTDPREFIX
+                       " Non-existent device (%04x:%02x:%02x.%u) in this DRHD's scope!\n",
+                       drhd->segment, b, d, f);
                 invalid_cnt++;
             }
         }
@@ -550,9 +548,8 @@ acpi_parse_one_drhd(struct acpi_dmar_hea
             if ( iommu_workaround_bios_bug &&
                  invalid_cnt == dmaru->scope.devices_cnt )
             {
-                dprintk(XENLOG_WARNING VTDPREFIX,
-                    "  Workaround BIOS bug: ignore the DRHD due to all "
-                    "devices under its scope are not PCI discoverable!\n");
+                printk(XENLOG_WARNING VTDPREFIX
+                       "  Workaround BIOS bug: ignoring DRHD (no devices in its scope are PCI discoverable)\n");
 
                 scope_devices_free(&dmaru->scope);
                 iommu_free(dmaru);
@@ -560,11 +557,10 @@ acpi_parse_one_drhd(struct acpi_dmar_hea
             }
             else
             {
-                dprintk(XENLOG_WARNING VTDPREFIX,
-                    "  The DRHD is invalid due to there are devices under "
-                    "its scope are not PCI discoverable! Pls try option "
-                    "iommu=force or iommu=workaround_bios_bug if you "
-                    "really want VT-d\n");
+                printk(XENLOG_WARNING VTDPREFIX
+                       "  DRHD is invalid (some devices in its scope are not PCI discoverable)\n");
+                printk(XENLOG_WARNING VTDPREFIX
+                       "  Try \"iommu=force\" or \"iommu=workaround_bios_bug\" if you really want VT-d\n");
                 ret = -EINVAL;
             }
         }
@@ -613,10 +609,9 @@ acpi_parse_one_rmrr(struct acpi_dmar_hea
     if ( (!page_is_ram_type(paddr_to_pfn(base_addr), RAM_TYPE_RESERVED)) ||
          (!page_is_ram_type(paddr_to_pfn(end_addr), RAM_TYPE_RESERVED)) )
     {
-        dprintk(XENLOG_WARNING VTDPREFIX,
-                "  RMRR address range not in reserved memory "
-                "base = %"PRIx64" end = %"PRIx64"; "
-                "iommu_inclusive_mapping=1 parameter may be needed.\n",
+        printk(XENLOG_WARNING VTDPREFIX
+               "  RMRR address range %"PRIx64"..%"PRIx64" not in reserved memory;"
+               " need \"iommu_inclusive_mapping=1\"?\n",
                 base_addr, end_addr);
     }
 
@@ -653,11 +648,10 @@ acpi_parse_one_rmrr(struct acpi_dmar_hea
 
             if ( !pci_device_detect(rmrr->segment, b, d, f) )
             {
-                dprintk(XENLOG_WARNING VTDPREFIX,
-                        " Non-existent device (%04x:%02x:%02x.%u) is reported"
-                        " in RMRR (%"PRIx64", %"PRIx64")'s scope!\n",
-                        rmrr->segment, b, d, f,
-                        rmrru->base_address, rmrru->end_address);
+                printk(XENLOG_WARNING VTDPREFIX
+                       " Non-existent device (%04x:%02x:%02x.%u) reported in RMRR (%"PRIx64", %"PRIx64")'s scope!\n",
+                       rmrr->segment, b, d, f,
+                       rmrru->base_address, rmrru->end_address);
                 ignore = 1;
             }
             else
@@ -669,18 +663,17 @@ acpi_parse_one_rmrr(struct acpi_dmar_hea
 
         if ( ignore )
         {
-            dprintk(XENLOG_WARNING VTDPREFIX,
-                "  Ignore the RMRR (%"PRIx64", %"PRIx64") due to "
-                "devices under its scope are not PCI discoverable!\n",
-                rmrru->base_address, rmrru->end_address);
+            printk(XENLOG_WARNING VTDPREFIX
+                   "  Ignore RMRR (%"PRIx64", %"PRIx64") (some devices in its scope are not PCI discoverable)\n",
+                   rmrru->base_address, rmrru->end_address);
             scope_devices_free(&rmrru->scope);
             xfree(rmrru);
         }
         else if ( base_addr > end_addr )
         {
-            dprintk(XENLOG_WARNING VTDPREFIX,
-                "  The RMRR (%"PRIx64", %"PRIx64") is incorrect!\n",
-                rmrru->base_address, rmrru->end_address);
+            printk(XENLOG_WARNING VTDPREFIX
+                   "  RMRR (%"PRIx64", %"PRIx64") is incorrect\n",
+                   rmrru->base_address, rmrru->end_address);
             scope_devices_free(&rmrru->scope);
             xfree(rmrru);
             ret = -EFAULT;
@@ -688,10 +681,9 @@ acpi_parse_one_rmrr(struct acpi_dmar_hea
         else
         {
             if ( iommu_verbose )
-                dprintk(VTDPREFIX,
-                        "  RMRR region: base_addr %"PRIx64
-                        " end_address %"PRIx64"\n",
-                        rmrru->base_address, rmrru->end_address);
+                printk(VTDPREFIX
+                       "  RMRR region: base_addr %"PRIx64" end_address %"PRIx64"\n",
+                       rmrru->base_address, rmrru->end_address);
             acpi_register_rmrr_unit(rmrru);
         }
     }
@@ -719,8 +711,7 @@ acpi_parse_one_atsr(struct acpi_dmar_hea
     atsru->segment = atsr->segment;
     atsru->all_ports = atsr->flags & ACPI_DMAR_ALL_PORTS;
     if ( iommu_verbose )
-        dprintk(VTDPREFIX,
-                "  atsru->all_ports: %x\n", atsru->all_ports);
+        printk(VTDPREFIX "  atsru->all_ports: %x\n", atsru->all_ports);
     if ( !atsru->all_ports )
     {
         dev_scope_start = (void *)(atsr + 1);
@@ -731,12 +722,12 @@ acpi_parse_one_atsr(struct acpi_dmar_hea
     else
     {
         if ( iommu_verbose )
-            dprintk(VTDPREFIX, "  flags: ALL_PORTS\n");
+            printk(VTDPREFIX "  flags: ALL_PORTS\n");
         /* Only allow one ALL_PORTS */
         if ( atsr->segment == 0 && all_ports )
         {
-            dprintk(XENLOG_WARNING VTDPREFIX,
-                    "Only one ALL_PORTS device scope is allowed\n");
+            printk(XENLOG_WARNING VTDPREFIX
+                   "Only one ALL_PORTS device scope is allowed\n");
             ret = -EINVAL;
         }
         if ( atsr->segment == 0 )
@@ -772,10 +763,9 @@ acpi_parse_one_rhsa(struct acpi_dmar_hea
     rhsau->proximity_domain = rhsa->proximity_domain;
     list_add_tail(&rhsau->list, &acpi_rhsa_units);
     if ( iommu_verbose )
-        dprintk(VTDPREFIX,
-                "  rhsau->address: %"PRIx64
-                " rhsau->proximity_domain: %"PRIx32"\n",
-                rhsau->address, rhsau->proximity_domain);
+        printk(VTDPREFIX
+               "  rhsau->address: %"PRIx64" rhsau->proximity_domain: %"PRIx32"\n",
+               rhsau->address, rhsau->proximity_domain);
 
     return ret;
 }
@@ -798,15 +788,14 @@ static int __init acpi_parse_dmar(struct
 
     if ( !dmar->width )
     {
-        dprintk(XENLOG_WARNING VTDPREFIX, "Zero: Invalid DMAR width\n");
+        printk(XENLOG_WARNING VTDPREFIX "Zero: Invalid DMAR width\n");
         ret = -EINVAL;
         goto out;
     }
 
     dmar_host_address_width = dmar->width + 1;
     if ( iommu_verbose )
-        dprintk(VTDPREFIX, "Host address width %d\n",
-                dmar_host_address_width);
+        printk(VTDPREFIX "Host address width %d\n", dmar_host_address_width);
 
     entry_header = (void *)(dmar + 1);
     while ( ((unsigned long)entry_header) <
@@ -820,22 +809,22 @@ static int __init acpi_parse_dmar(struct
         {
         case ACPI_DMAR_TYPE_HARDWARE_UNIT:
             if ( iommu_verbose )
-                dprintk(VTDPREFIX, "found ACPI_DMAR_DRHD:\n");
+                printk(VTDPREFIX "found ACPI_DMAR_DRHD:\n");
             ret = acpi_parse_one_drhd(entry_header);
             break;
         case ACPI_DMAR_TYPE_RESERVED_MEMORY:
             if ( iommu_verbose )
-                dprintk(VTDPREFIX, "found ACPI_DMAR_RMRR:\n");
+                printk(VTDPREFIX "found ACPI_DMAR_RMRR:\n");
             ret = acpi_parse_one_rmrr(entry_header);
             break;
         case ACPI_DMAR_TYPE_ATSR:
             if ( iommu_verbose )
-                dprintk(VTDPREFIX, "found ACPI_DMAR_ATSR:\n");
+                printk(VTDPREFIX "found ACPI_DMAR_ATSR:\n");
             ret = acpi_parse_one_atsr(entry_header);
             break;
         case ACPI_DMAR_HARDWARE_AFFINITY:
             if ( iommu_verbose )
-                dprintk(VTDPREFIX, "found ACPI_DMAR_RHSA:\n");
+                printk(VTDPREFIX "found ACPI_DMAR_RHSA:\n");
             ret = acpi_parse_one_rhsa(entry_header);
             break;
         default:
xen/drivers/passthrough/vtd/iommu.c +35 -39

140 lines not on this page · raw message

VT-d: unhide messages needed for diagnosing firmware issues

Undue use of dprintk() lead to many messages useful in diagnosing issues in the field now being hidden in non-debug (i.e. production) builds. Re-surface them, namely when init-time only and/or already guarded by iommu_{verbose,debug} conditionals. Switch from using iommu_verbose to iommu_debug in a couple of runtime cases.

xen/drivers/passthrough/vtd/dmar.c +55 -66

270 lines not on this page · raw message

xen/drivers/passthrough/vtd/iommu.c +35 -39

140 lines not on this page · raw message

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

Acked-by on v1 3/4
#8 lore raw

Re: [PATCH 3/4] VT-d: unhide messages needed for diagnosing firmware issues

Quoted 10 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Monday, December 21, 2015 10:35 PM
To: xen-devel <[email protected]>
Cc: Wu, Feng <[email protected]>; Tian, Kevin <[email protected]>
Subject: [PATCH 3/4] VT-d: unhide messages needed for diagnosing firmware issues

Quoted 7 lines

Undue use of dprintk() lead to many messages useful in diagnosing issues in the field now being hidden in non-debug (i.e. production) builds. Re-surface them, namely when init-time only and/or already guarded by iommu_{verbose,debug} conditionals. Switch from using iommu_verbose to iommu_debug in a couple of runtime cases.

Thanks,
Feng

#9 lore raw

PATCH 4/4 IOMMU: unhide messages useful for diagnostics

In reply to Jan Beulich

Undue use of dprintk() lead to many messages useful in diagnosing issues in the field now being hidden in non-debug (i.e. production) builds. Re-surface them.

xen/drivers/passthrough/io.c +13 -13
@@ -543,10 +543,10 @@ int pt_irq_create_bind(
         spin_unlock(&d->event_lock);
 
         if ( iommu_verbose )
-            dprintk(XENLOG_G_INFO,
-                    "d%d: bind: m_gsi=%u g_gsi=%u dev=%02x.%02x.%u intx=%u\n",
-                    d->domain_id, pirq, guest_gsi, bus,
-                    PCI_SLOT(device), PCI_FUNC(device), intx);
+            printk(XENLOG_G_INFO
+                   "d%d: bind: m_gsi=%u g_gsi=%u dev=%02x.%02x.%u intx=%u\n",
+                   d->domain_id, pirq, guest_gsi, bus,
+                   PCI_SLOT(device), PCI_FUNC(device), intx);
         break;
     }
 
@@ -576,11 +576,11 @@ int pt_irq_destroy_bind(
             unsigned int device = pt_irq_bind->u.pci.device;
             unsigned int intx = pt_irq_bind->u.pci.intx;
 
-            dprintk(XENLOG_G_INFO,
-                    "d%d: unbind: m_gsi=%u g_gsi=%u dev=%02x:%02x.%u intx=%u\n",
-                    d->domain_id, machine_gsi, hvm_pci_intx_gsi(device, intx),
-                    pt_irq_bind->u.pci.bus,
-                    PCI_SLOT(device), PCI_FUNC(device), intx);
+            printk(XENLOG_G_INFO
+                   "d%d: unbind: m_gsi=%u g_gsi=%u dev=%02x:%02x.%u intx=%u\n",
+                   d->domain_id, machine_gsi, hvm_pci_intx_gsi(device, intx),
+                   pt_irq_bind->u.pci.bus,
+                   PCI_SLOT(device), PCI_FUNC(device), intx);
         }
         break;
     case PT_IRQ_TYPE_MSI:
@@ -676,10 +676,10 @@ int pt_irq_destroy_bind(
     {
         unsigned int device = pt_irq_bind->u.pci.device;
 
-        dprintk(XENLOG_G_INFO,
-                "d%d %s unmap: m_irq=%u dev=%02x:%02x.%u intx=%u\n",
-                d->domain_id, what, machine_gsi, pt_irq_bind->u.pci.bus,
-                PCI_SLOT(device), PCI_FUNC(device), pt_irq_bind->u.pci.intx);
+        printk(XENLOG_G_INFO
+               "d%d %s unmap: m_irq=%u dev=%02x:%02x.%u intx=%u\n",
+               d->domain_id, what, machine_gsi, pt_irq_bind->u.pci.bus,
+               PCI_SLOT(device), PCI_FUNC(device), pt_irq_bind->u.pci.intx);
     }
 
     return 0;

IOMMU: unhide messages useful for diagnostics

Undue use of dprintk() lead to many messages useful in diagnosing issues in the field now being hidden in non-debug (i.e. production) builds. Re-surface them.

xen/drivers/passthrough/io.c +13 -13
@@ -543,10 +543,10 @@ int pt_irq_create_bind(
         spin_unlock(&d->event_lock);
 
         if ( iommu_verbose )
-            dprintk(XENLOG_G_INFO,
-                    "d%d: bind: m_gsi=%u g_gsi=%u dev=%02x.%02x.%u intx=%u\n",
-                    d->domain_id, pirq, guest_gsi, bus,
-                    PCI_SLOT(device), PCI_FUNC(device), intx);
+            printk(XENLOG_G_INFO
+                   "d%d: bind: m_gsi=%u g_gsi=%u dev=%02x.%02x.%u intx=%u\n",
+                   d->domain_id, pirq, guest_gsi, bus,
+                   PCI_SLOT(device), PCI_FUNC(device), intx);
         break;
     }
 
@@ -576,11 +576,11 @@ int pt_irq_destroy_bind(
             unsigned int device = pt_irq_bind->u.pci.device;
             unsigned int intx = pt_irq_bind->u.pci.intx;
 
-            dprintk(XENLOG_G_INFO,
-                    "d%d: unbind: m_gsi=%u g_gsi=%u dev=%02x:%02x.%u intx=%u\n",
-                    d->domain_id, machine_gsi, hvm_pci_intx_gsi(device, intx),
-                    pt_irq_bind->u.pci.bus,
-                    PCI_SLOT(device), PCI_FUNC(device), intx);
+            printk(XENLOG_G_INFO
+                   "d%d: unbind: m_gsi=%u g_gsi=%u dev=%02x:%02x.%u intx=%u\n",
+                   d->domain_id, machine_gsi, hvm_pci_intx_gsi(device, intx),
+                   pt_irq_bind->u.pci.bus,
+                   PCI_SLOT(device), PCI_FUNC(device), intx);
         }
         break;
     case PT_IRQ_TYPE_MSI:
@@ -676,10 +676,10 @@ int pt_irq_destroy_bind(
     {
         unsigned int device = pt_irq_bind->u.pci.device;
 
-        dprintk(XENLOG_G_INFO,
-                "d%d %s unmap: m_irq=%u dev=%02x:%02x.%u intx=%u\n",
-                d->domain_id, what, machine_gsi, pt_irq_bind->u.pci.bus,
-                PCI_SLOT(device), PCI_FUNC(device), pt_irq_bind->u.pci.intx);
+        printk(XENLOG_G_INFO
+               "d%d %s unmap: m_irq=%u dev=%02x:%02x.%u intx=%u\n",
+               d->domain_id, what, machine_gsi, pt_irq_bind->u.pci.bus,
+               PCI_SLOT(device), PCI_FUNC(device), pt_irq_bind->u.pci.intx);
     }
 
     return 0;

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