[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 4/6] iommu: Remove dependency on __LINE__ for release builds



When using LivePatch, use of __LINE__ can generate spurious changes in
functions due to embedded line numbers.  For release builds with
LivePatch enabled, remove the use of these line numbers in
IOMMU_WAIT_OP() and print the current text address instead.

Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
---

Changes in v2:
* Simplified macros.
* Use %pS.

 xen/drivers/passthrough/vtd/dmar.h | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.h 
b/xen/drivers/passthrough/vtd/dmar.h
index 729b603..c3d4adc 100644
--- a/xen/drivers/passthrough/vtd/dmar.h
+++ b/xen/drivers/passthrough/vtd/dmar.h
@@ -108,6 +108,19 @@ struct acpi_atsr_unit *acpi_find_matched_atsr_unit(const 
struct pci_dev *);
 
 #define DMAR_OPERATION_TIMEOUT MILLISECS(1000)
 
+#if defined(NDEBUG) && defined(CONFIG_LIVEPATCH)
+#define iommu_wait_op_panic()                                              \
+    do {                                                                   \
+        panic("%pS: DMAR hardware is malfunctional", current_text_addr()); \
+    } while (0)
+#else
+#define iommu_wait_op_panic()                                              \
+    do {                                                                   \
+        panic("%s:%d:%s: DMAR hardware is malfunctional",                  \
+              __FILE__, __LINE__, __func__);                               \
+    } while (0)
+#endif
+
 #define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \
 do {                                                \
     s_time_t start_time = NOW();                    \
@@ -117,8 +130,7 @@ do {                                                \
             break;                                  \
         if ( NOW() > start_time + DMAR_OPERATION_TIMEOUT ) {    \
             if ( !kexecing )                                    \
-                panic("%s:%d:%s: DMAR hardware is malfunctional",\
-                      __FILE__, __LINE__, __func__);            \
+                iommu_wait_op_panic();                          \
             else                                                \
                 break;                                          \
         }                                                       \
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.