Skip to contentSkip to conversation

xen/VT-d: Remove the use of __LINE__ from IOMMU_WAIT_OP()

PATCH In review Andrew Cooper 3 participants 4 messages Jan 24, 2018 – Jan 25, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/VT-d: Remove the use of __LINE__ from IOMMU_WAIT_OP()

The use of __LINE__ in printk()'s is problematic for livepatching, as it tends to cause unnecessary binary differences.

Take this opportunity to provide some rather more useful information than just file/line/func in the form of the full register/stack trace leading to the problem (which I've needed in the past for debugging).

---
CC: Jan Beulich <[email protected]>
CC: Kevin Tian <[email protected]>

---
 xen/drivers/passthrough/vtd/dmar.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
xen/drivers/passthrough/vtd/dmar.h +4 -2
index 729b603..c3f2685 100644
@@ -117,8 +117,10 @@ do {                                                \
             break;                                  \
         if ( NOW() > start_time + DMAR_OPERATION_TIMEOUT ) {    \
             if ( !kexecing )                                    \
-                panic("%s:%d:%s: DMAR hardware is malfunctional",\
-                      __FILE__, __LINE__, __func__);            \
+            {                                                   \
+                dump_execution_state();                         \
+                panic("DMAR hardware malfunction");             \
+            }                                                   \
             else                                                \
                 break;                                          \
         }                                                       \
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 24.01.18 at 15:11, <[email protected]> wrote:

The use of __LINE__ in printk()'s is problematic for livepatching, as it tends to cause unnecessary binary differences.

Take this opportunity to provide some rather more useful information than just file/line/func in the form of the full register/stack trace leading to the problem (which I've needed in the past for debugging).

Quoted 4 lines
xen/drivers/passthrough/vtd/dmar.h +0 -0
@@ -117,8 +117,10 @@ do {                                                \
             break;                                  \

xen/drivers/passthrough/vtd/dmar.h do { \ · line 125

Quoted 10 lines
xen/drivers/passthrough/vtd/dmar.h +4 -2
         if ( NOW() > start_time + DMAR_OPERATION_TIMEOUT ) {    \
             if ( !kexecing )                                    \
-                panic("%s:%d:%s: DMAR hardware is malfunctional",\
-                      __FILE__, __LINE__, __func__);            \
+            {                                                   \
+                dump_execution_state();                         \
+                panic("DMAR hardware malfunction");             \
+            }                                                   \
             else                                                \
                 break;                                          \

Perhaps a good opportunity to take out the pointless "else" as well?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 11 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 24.01.18 at 15:11, <[email protected]> wrote:

The use of __LINE__ in printk()'s is problematic for livepatching, as it tends to cause unnecessary binary differences.

Take this opportunity to provide some rather more useful information than just file/line/func in the form of the full register/stack trace leading to the problem (which I've needed in the past for debugging).

Quoted 15 lines
Quoted 4 lines
xen/drivers/passthrough/vtd/dmar.h +0 -0
@@ -117,8 +117,10 @@ do {                                                \
             break;                                  \

xen/drivers/passthrough/vtd/dmar.h do { \ · line 125

Quoted 10 lines
xen/drivers/passthrough/vtd/dmar.h +4 -2
         if ( NOW() > start_time + DMAR_OPERATION_TIMEOUT ) {    \
             if ( !kexecing )                                    \
-                panic("%s:%d:%s: DMAR hardware is malfunctional",\
-                      __FILE__, __LINE__, __func__);            \
+            {                                                   \
+                dump_execution_state();                         \
+                panic("DMAR hardware malfunction");             \
+            }                                                   \
             else                                                \
                 break;                                          \

Perhaps a good opportunity to take out the pointless "else" as well?

Can do (although I'm not going to repost for just that).

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 1/1
#3 lore raw
In reply to Andrew Cooper
Quoted 6 lines

From: Andrew Cooper [mailto:[email protected]]
Sent: Wednesday, January 24, 2018 10:12 PM

The use of __LINE__ in printk()'s is problematic for livepatching, as it tends to cause unnecessary binary differences.

Quoted 6 lines

Take this opportunity to provide some rather more useful information than just
file/line/func in the form of the full register/stack trace leading to the problem (which I've needed in the past for debugging).

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel