diff mbox

[v3,17/23] xsplice: Print dependency and payloads build_id in the keyhandler.

Message ID 1455300361-13092-18-git-send-email-konrad.wilk@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk Feb. 12, 2016, 6:05 p.m. UTC
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 xen/common/xsplice.c | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)

Comments

Andrew Cooper Feb. 16, 2016, 8:20 p.m. UTC | #1
On 12/02/16 18:05, Konrad Rzeszutek Wilk wrote:
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  xen/common/xsplice.c | 36 ++++++++++++++++++++++++++++--------
>  1 file changed, 28 insertions(+), 8 deletions(-)
>
> diff --git a/xen/common/xsplice.c b/xen/common/xsplice.c
> index 2ba5bb5..8c5557e 100644
> --- a/xen/common/xsplice.c
> +++ b/xen/common/xsplice.c
> @@ -101,6 +101,21 @@ static const char *state2str(int32_t state)
>      return names[state];
>  }
>  
> +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.

~Andrew
Jan Beulich Feb. 17, 2016, 11:10 a.m. UTC | #2
>>> On 16.02.16 at 21:20, <andrew.cooper3@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().

Jan
diff mbox

Patch

diff --git a/xen/common/xsplice.c b/xen/common/xsplice.c
index 2ba5bb5..8c5557e 100644
--- a/xen/common/xsplice.c
+++ b/xen/common/xsplice.c
@@ -101,6 +101,21 @@  static const char *state2str(int32_t state)
     return names[state];
 }
 
+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);
+    }
+    printk("\n");
+}
+
 static void xsplice_printall(unsigned char key)
 {
     struct payload *data;
@@ -111,14 +126,9 @@  static void xsplice_printall(unsigned char key)
     rc = xen_build_id(&binary_id, &len);
     printk("build-id: ");
     if ( !rc )
-    {
-        for ( i = 0; i < len; i++ )
-        {
-                   uint8_t c = binary_id[i];
-                   printk("%02x", c);
-        }
-           printk("\n");
-    } else if ( rc < 0 )
+        xsplice_print_build_id(binary_id, len);
+
+    else if ( rc < 0 )
         printk("rc = %d\n", rc);
 
     spin_lock(&payload_lock);
@@ -135,6 +145,16 @@  static void xsplice_printall(unsigned char key)
             printk("    %s patch 0x%"PRIx64"(%u) with 0x%"PRIx64"(%u)\n",
                    f->name, f->old_addr, f->old_size, f->new_addr, f->new_size);
         }
+        if ( data->id.len )
+        {
+            printk(" build_id=");
+            xsplice_print_build_id(data->id.p, data->id.len);
+        }
+        if ( data->dep.len )
+        {
+            printk(" depend on=");
+            xsplice_print_build_id(data->dep.p, data->dep.len);
+        }
     }
     spin_unlock(&payload_lock);
 }