On Wed, Feb 17, 2016 at 04:10:12AM -0700, Jan Beulich wrote: > >>> On 16.02.16 at 21:20, <andrew.coop...@citrix.com> wrote: > > On 12/02/16 18:05, Konrad Rzeszutek Wilk wrote: > >> +static void xsplice_print_build_id(char *id, unsigned int len) > >> +{ > >> + unsigned int i; > >> + > >> + if ( !len ) > >> + return; > >> + > >> + for ( i = 0; i < len; i++ ) > >> + { > >> + uint8_t c = id[i]; > >> + printk("%02x", c); > > > > What about the already existing %*ph custom format? If the spaces are a > > problem we could introduce %*phN from Linux which has no spaces. > > > > The advantage of this is that it is a single call to printk, rather than > > many, and avoids the ability for a different cpu to interleave in the > > middle of a line. > > I don't think this ability exists anymore after we've switched to > per-CPU there. Which isn't to say, though, that I wouldn't also > like to see this be just a single printk().
Would this work for folks: commit e1905ecf7034635f2a82cd2bbc4f5ff03ee957b0 Author: Konrad Rzeszutek Wilk <konrad.w...@oracle.com> Date: Wed Feb 24 15:06:15 2016 -0500 xsplice: Print build_id in keyhandler and on bootup. As it should be an useful debug mechanism. Signed-off-by: Konrad Rzeszutek Wilk <konrad.w...@oracle.com> diff --git a/xen/common/xsplice.c b/xen/common/xsplice.c index da26b58..b15a2de 100644 --- a/xen/common/xsplice.c +++ b/xen/common/xsplice.c @@ -13,6 +13,7 @@ #include <xen/smp.h> #include <xen/softirq.h> #include <xen/spinlock.h> +#include <xen/version.h> #include <xen/vmap.h> #include <xen/wait.h> #include <xen/xsplice_elf.h> @@ -1079,10 +1080,33 @@ static const char *state2str(uint32_t state) return names[state]; } +static void xsplice_print_build_id(const char *hdr, const char *id, + unsigned int len) +{ + unsigned int i; + + if ( !len ) + return; + + /* Each byte is two ASCII characters. */ + if ( len*2 + 1 > sizeof(keyhandler_scratch) ) + return; + + memset(keyhandler_scratch, 0, len * 2 + 1); + for ( i = 0; i < len; i++ ) + snprintf(&keyhandler_scratch[i * 2], 3, "%02x", (uint8_t)id[i]); + + printk("%s%s\n", hdr, keyhandler_scratch); +} + static void xsplice_printall(unsigned char key) { struct payload *data; - unsigned int i; + char *binary_id = NULL; + unsigned int len = 0, i; + + if ( !xen_build_id(&binary_id, &len) ) + xsplice_print_build_id("build-id: ", binary_id, len); spin_lock_recursive(&payload_lock); @@ -1106,8 +1130,14 @@ static void xsplice_printall(unsigned char key) static int __init xsplice_init(void) { + char *binary_id = NULL; + unsigned int len = 0; BUILD_BUG_ON( sizeof(struct xsplice_patch_func) != 64 ); + if ( !xen_build_id(&binary_id, &len) ) + xsplice_print_build_id("build-id: ", binary_id, len); + + xsplice_print_build_id("Hypervisor build-id: ", binary_id, len); register_keyhandler('x', xsplice_printall, "print xsplicing info", 1); return 0; } > > Jan > _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel