diff mbox

[v5,22/28] xsplice: Print build_id in keyhandler and on bootup.

Message ID 1458849640-22588-23-git-send-email-konrad.wilk@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk March 24, 2016, 8 p.m. UTC
As it should be an useful debug mechanism.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
--
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>

v2: s/char */const void *
v5: s/ssize_t/unsigned int/
---
 xen/common/xsplice.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Jan Beulich April 4, 2016, 1:38 p.m. UTC | #1
>>> On 24.03.16 at 21:00, <konrad.wilk@oracle.com> wrote:
> @@ -1414,10 +1420,16 @@ static void xsplice_printall(unsigned char key)
>  
>  static int __init xsplice_init(void)
>  {
> +    const void *binary_id = NULL;
> +    unsigned int len = 0;

Pointless initializer.

>      BUILD_BUG_ON( sizeof(struct xsplice_patch_func) != 64 );
>      BUILD_BUG_ON( offsetof(struct xsplice_patch_func, new_addr) != 8 );
>      BUILD_BUG_ON( offsetof(struct xsplice_patch_func, new_size) != 24 );
>  
> +    if ( !xen_build_id(&binary_id, &len) )
> +        printk(XENLOG_INFO "%s: build-id: %*phN\n", XSPLICE, len, binary_id);

With the above corrected and the string literal not handed to %s
Acked-by: Jan Beulich <jbeulich@suse.com>
diff mbox

Patch

diff --git a/xen/common/xsplice.c b/xen/common/xsplice.c
index bf8cb1c..ec47f31 100644
--- a/xen/common/xsplice.c
+++ b/xen/common/xsplice.c
@@ -16,6 +16,7 @@ 
 #include <xen/spinlock.h>
 #include <xen/string.h>
 #include <xen/symbols.h>
+#include <xen/version.h>
 #include <xen/virtual_region.h>
 #include <xen/vmap.h>
 #include <xen/wait.h>
@@ -1385,8 +1386,13 @@  static const char *state2str(uint32_t state)
 static void xsplice_printall(unsigned char key)
 {
     struct payload *data;
+    const void *binary_id = NULL;
+    unsigned int len = 0;
     unsigned int i;
 
+    if ( !xen_build_id(&binary_id, &len) )
+        printk("build-id: %*phN\n", len, binary_id);
+
     if ( !spin_trylock_recursive(&payload_lock) )
     {
         printk("Lock held. Try again.\n");
@@ -1414,10 +1420,16 @@  static void xsplice_printall(unsigned char key)
 
 static int __init xsplice_init(void)
 {
+    const void *binary_id = NULL;
+    unsigned int len = 0;
+
     BUILD_BUG_ON( sizeof(struct xsplice_patch_func) != 64 );
     BUILD_BUG_ON( offsetof(struct xsplice_patch_func, new_addr) != 8 );
     BUILD_BUG_ON( offsetof(struct xsplice_patch_func, new_size) != 24 );
 
+    if ( !xen_build_id(&binary_id, &len) )
+        printk(XENLOG_INFO "%s: build-id: %*phN\n", XSPLICE, len, binary_id);
+
     register_keyhandler('x', xsplice_printall, "print xsplicing info", 1);
 
     arch_xsplice_register_find_space(&find_hole);