[PATCH] xen: support changed item in struct domain
                                
                                
                                
                                    
                                        by Dietmar Hahn
                                    
                                
                                
                                        Hi,
with xen version 4.2.5 in struct domain the item is_paused_by_controller
got changed to controller_pause_count and hence crash doesn't work on
newer xen environments.
This patch allows to support older and newer xen versions.
Dietmar.
diff -pNaur crash-7.1.0-org/xen_hyper.c crash-7.1.0/xen_hyper.c
--- crash-7.1.0-org/xen_hyper.c	2015-02-06 19:44:11.000000000 +0100
+++ crash-7.1.0/xen_hyper.c	2015-03-11 12:02:17.000000000 +0100
@@ -218,7 +218,12 @@ xen_hyper_domain_init(void)
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_polling, "domain", "is_polling");
 
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_dying, "domain", "is_dying");
+	/*
+	 * With Xen 4.2.5 is_paused_by_controller changed to
+	 * controller_pause_count.
+	 */
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_paused_by_controller, "domain", "is_paused_by_controller");
+	XEN_HYPER_MEMBER_OFFSET_INIT(domain_controller_pause_count, "domain", "controller_pause_count");
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_shutting_down, "domain", "is_shutting_down");
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_shut_down, "domain", "is_shut_down");
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_vcpu, "domain", "vcpu");
@@ -1269,7 +1274,12 @@ xen_hyper_store_domain_context(struct xe
 				*(dp + XEN_HYPER_OFFSET(domain_is_polling))) {
 			dc->domain_flags |= XEN_HYPER_DOMS_polling;
 		}
-		if (*(dp + XEN_HYPER_OFFSET(domain_is_paused_by_controller))) {
+		if (XEN_HYPER_VALID_MEMBER(domain_is_paused_by_controller) &&
+			*(dp + XEN_HYPER_OFFSET(domain_is_paused_by_controller))) {
+			dc->domain_flags |= XEN_HYPER_DOMS_ctrl_pause;
+		}
+		if (XEN_HYPER_VALID_MEMBER(domain_controller_pause_count) &&
+			*(dp + XEN_HYPER_OFFSET(domain_controller_pause_count))) {
 			dc->domain_flags |= XEN_HYPER_DOMS_ctrl_pause;
 		}
 		if (*(dp + XEN_HYPER_OFFSET(domain_is_dying))) {
diff -pNaur crash-7.1.0-org/xen_hyper_defs.h crash-7.1.0/xen_hyper_defs.h
--- crash-7.1.0-org/xen_hyper_defs.h	2015-02-06 19:44:11.000000000 +0100
+++ crash-7.1.0/xen_hyper_defs.h	2015-03-11 12:02:17.000000000 +0100
@@ -678,6 +678,10 @@ struct xen_hyper_offset_table {
 	long domain_debugger_attached;
 	long domain_is_polling;
 	long domain_is_dying;
+	/*
+	 * This changed from xen-4.2.5 to domain_controller_pause_count.
+	 * See below!
+	 */
 	long domain_is_paused_by_controller;
 	long domain_is_shutting_down;
 	long domain_is_shut_down;
@@ -752,6 +756,8 @@ struct xen_hyper_offset_table {
 	long vcpu_runstate_info_state;
 	long vcpu_runstate_info_state_entry_time;
 	long vcpu_runstate_info_time;
+	/* domain - changed item see domain_is_paused_by_controller */
+	long domain_controller_pause_count;
 };
 
 /*
diff -pNaur crash-7.1.0-org/xen_hyper_dump_tables.c crash-7.1.0/xen_hyper_dump_tables.c
--- crash-7.1.0-org/xen_hyper_dump_tables.c	2015-02-06 19:44:11.000000000 +0100
+++ crash-7.1.0/xen_hyper_dump_tables.c	2015-03-11 12:05:59.000000000 +0100
@@ -784,8 +784,11 @@ xen_hyper_dump_xen_hyper_offset_table(ch
 	}
 	XEN_HYPER_PRI(fp, len, "domain_is_dying: ", buf, flag,
 		(buf, "%ld\n", xen_hyper_offset_table.domain_is_dying));
+	/* Only one of next both exists but print both, ones value is -1. */
 	XEN_HYPER_PRI(fp, len, "domain_is_paused_by_controller: ", buf, flag,
 		(buf, "%ld\n", xen_hyper_offset_table.domain_is_paused_by_controller));
+	XEN_HYPER_PRI(fp, len, "domain_controller_pause_count: ", buf, flag,
+		(buf, "%ld\n", xen_hyper_offset_table.domain_controller_pause_count));
 	XEN_HYPER_PRI(fp, len, "domain_is_shutting_down: ", buf, flag,
 		(buf, "%ld\n", xen_hyper_offset_table.domain_is_shutting_down));
 	XEN_HYPER_PRI(fp, len, "domain_is_shut_down: ", buf, flag,
-- 
Company details: http://ts.fujitsu.com/imprint.html
                                
                         
                        
                                
                                10 years, 7 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                                
                                
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Crash problems with Xen
                                
                                
                                
                                    
                                        by Dietmar Hahn
                                    
                                
                                
                                        Hi,
for me crash failed to debug xen environments with:
crash: invalid structure member offset: domain_is_paused_by_controller
       FILE: xen_hyper.c  LINE: 1255  FUNCTION: xen_hyper_store_domain_context()
[/usr/bin/crash] error trace: 546170 => 545bc9 => 545a81 => 510fd0
  510fd0: OFFSET_verify+224
  545a81: xen_hyper_store_domain_context+1265
  545bc9: xen_hyper_refresh_domain_context_space+153
  546170: xen_hyper_domain_init+864
The problem is a change of an item in struct domain in xen version 4.2
I tried to fix the problem for me so I can debug the old and the newer
xen versions. I'm not sure this was the right way to fix this.
Thanks.
Dietmar.
diff -pNaur crash-7.1.0-org/xen_hyper.c crash-7.1.0/xen_hyper.c
--- crash-7.1.0-org/xen_hyper.c	2015-02-06 19:44:11.000000000 +0100
+++ crash-7.1.0/xen_hyper.c	2015-03-10 13:57:48.000000000 +0100
@@ -218,7 +218,12 @@ xen_hyper_domain_init(void)
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_polling, "domain", "is_polling");
 
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_dying, "domain", "is_dying");
+	/*
+	 * In Xen 4.2 is_paused_by_controller changed to
+	 * controller_pause_count.
+	 */
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_paused_by_controller, "domain", "is_paused_by_controller");
+	XEN_HYPER_MEMBER_OFFSET_INIT(domain_controller_pause_count, "domain", "controller_pause_count");
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_shutting_down, "domain", "is_shutting_down");
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_shut_down, "domain", "is_shut_down");
 	XEN_HYPER_MEMBER_OFFSET_INIT(domain_vcpu, "domain", "vcpu");
@@ -1269,9 +1274,15 @@ xen_hyper_store_domain_context(struct xe
 				*(dp + XEN_HYPER_OFFSET(domain_is_polling))) {
 			dc->domain_flags |= XEN_HYPER_DOMS_polling;
 		}
-		if (*(dp + XEN_HYPER_OFFSET(domain_is_paused_by_controller))) {
+		if (XEN_HYPER_VALID_MEMBER(domain_is_paused_by_controller) &&
+			*(dp + XEN_HYPER_OFFSET(domain_is_paused_by_controller))) {
 			dc->domain_flags |= XEN_HYPER_DOMS_ctrl_pause;
 		}
+		if (XEN_HYPER_VALID_MEMBER(domain_controller_pause_count) &&
+			*(dp + XEN_HYPER_OFFSET(domain_controller_pause_count))) {
+			dc->domain_flags |= XEN_HYPER_DOMS_ctrl_pause;
+		}
+
 		if (*(dp + XEN_HYPER_OFFSET(domain_is_dying))) {
 			dc->domain_flags |= XEN_HYPER_DOMS_dying;
 		}
diff -pNaur crash-7.1.0-org/xen_hyper_defs.h crash-7.1.0/xen_hyper_defs.h
--- crash-7.1.0-org/xen_hyper_defs.h	2015-02-06 19:44:11.000000000 +0100
+++ crash-7.1.0/xen_hyper_defs.h	2015-03-10 13:52:37.000000000 +0100
@@ -679,6 +679,7 @@ struct xen_hyper_offset_table {
 	long domain_is_polling;
 	long domain_is_dying;
 	long domain_is_paused_by_controller;
+	long domain_controller_pause_count;
 	long domain_is_shutting_down;
 	long domain_is_shut_down;
 	long domain_vcpu;
diff -pNaur crash-7.1.0-org/xen_hyper_dump_tables.c crash-7.1.0/xen_hyper_dump_tables.c
--- crash-7.1.0-org/xen_hyper_dump_tables.c	2015-02-06 19:44:11.000000000 +0100
+++ crash-7.1.0/xen_hyper_dump_tables.c	2015-03-10 14:00:20.000000000 +0100
@@ -784,8 +784,14 @@ xen_hyper_dump_xen_hyper_offset_table(ch
 	}
 	XEN_HYPER_PRI(fp, len, "domain_is_dying: ", buf, flag,
 		(buf, "%ld\n", xen_hyper_offset_table.domain_is_dying));
-	XEN_HYPER_PRI(fp, len, "domain_is_paused_by_controller: ", buf, flag,
-		(buf, "%ld\n", xen_hyper_offset_table.domain_is_paused_by_controller));
+	if (XEN_HYPER_VALID_MEMBER(domain_is_paused_by_controller)) {
+		XEN_HYPER_PRI(fp, len, "domain_is_paused_by_controller: ", buf, flag,
+			(buf, "%ld\n", xen_hyper_offset_table.domain_is_paused_by_controller));
+	}
+	if (XEN_HYPER_VALID_MEMBER(domain_controller_pause_count)) {
+		XEN_HYPER_PRI(fp, len, "domain_controller_pause_count: ", buf, flag,
+			(buf, "%ld\n", xen_hyper_offset_table.domain_controller_pause_count));
+	}
 	XEN_HYPER_PRI(fp, len, "domain_is_shutting_down: ", buf, flag,
 		(buf, "%ld\n", xen_hyper_offset_table.domain_is_shutting_down));
 	XEN_HYPER_PRI(fp, len, "domain_is_shut_down: ", buf, flag,
-- 
Company details: http://ts.fujitsu.com/imprint.html
                                
                         
                        
                                
                                10 years, 8 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        [PATCH] MIPS: fix native build
                                
                                
                                
                                    
                                        by Rabin Vincent
                                    
                                
                                
                                        I've now managed to tested HOST==TARGET MIPS builds of crash (with
Debian running on top of QEMU's full-system MIPS emulation), and the
following fix is needed.  The preprocessor macro check for MIPS in
configure.c is incorrect and should be checking for __mips__, not
__mipsel___.  This allows native build on both big-endian and
little-endian MIPS systems.
---
 configure.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.c b/configure.c
index 800173a..9fe9f81 100644
--- a/configure.c
+++ b/configure.c
@@ -375,7 +375,7 @@ get_current_configuration(struct supported_gdb_version *sp)
 #ifdef __aarch64__
         target_data.target = ARM64;
 #endif
-#ifdef __mipsel___
+#ifdef __mips__
         target_data.target = MIPS;
 #endif
 
-- 
2.1.4
                                
                         
                        
                                
                                10 years, 8 months