Skip to contentSkip to conversation

xen/arm: traps: Add missing 0x in bad_trap

PATCH In review Julien Grall 4 participants 11 messages Apr 10, 2014 – May 2, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: traps: Add missing 0x in bad_trap

The syndrome value is printed in hexadecimal. Prefix it by 0x for less confusion.

---
 xen/arch/arm/traps.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/traps.c +1 -1
index 9eeed92..858abe5 100644
@@ -1616,7 +1616,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
         break;
     default:
  bad_trap:
-        printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=%"PRIx32"\n",
+        printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n",
                hsr.bits, hsr.ec, hsr.len, hsr.iss);
         do_unexpected_trap("Hypervisor", regs);
     }
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 4 lines · Julien Grall

The syndrome value is printed in hexadecimal. Prefix it by 0x for less confusion.

Xen is trying to converge on '%#' rather than an explicit 0x.

Also, it looks as if you want to do the same for IL

~Andrew

Quoted 17 lines
---
 xen/arch/arm/traps.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/traps.c +1 -1
index 9eeed92..858abe5 100644
@@ -1616,7 +1616,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
         break;
     default:
  bad_trap:
-        printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=%"PRIx32"\n",
+        printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n",
                hsr.bits, hsr.ec, hsr.len, hsr.iss);
         do_unexpected_trap("Hypervisor", regs);
     }
#2 lore raw
Quoted 7 lines · Andrew Cooper
Quoted 4 lines · Julien Grall

The syndrome value is printed in hexadecimal. Prefix it by 0x for less confusion.

Xen is trying to converge on '%#' rather than an explicit 0x.

I use to prefer explicit 0x :). Anyway, I will change to use %#.

Quoted 2 lines

Also, it looks as if you want to do the same for IL

Oh right, I forgot this one. I will send a new version of the patch.

Regards,

Signature · 1 line
Julien Grall
#3 lore raw
In reply to Andrew Cooper
Quoted 7 lines · Andrew Cooper
Quoted 4 lines · Julien Grall

The syndrome value is printed in hexadecimal. Prefix it by 0x for less confusion.

Xen is trying to converge on '%#' rather than an explicit 0x.

Really? I've been moving in the opposite direction because e.g. %010#lx does the wrong thing with zero (0000000000 instead of 0x00000000).

Not sure about plain %#x though...

Quoted 1 line

Also, it looks as if you want to do the same for IL

IL must be 2 or 4, for clarity it would be better as %d rather than 0x%x I think.

Quoted 21 lines

~Andrew

Quoted 17 lines
---
 xen/arch/arm/traps.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/traps.c +1 -1
index 9eeed92..858abe5 100644
@@ -1616,7 +1616,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
         break;
     default:
  bad_trap:
-        printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=%"PRIx32"\n",
+        printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n",
                hsr.bits, hsr.ec, hsr.len, hsr.iss);
         do_unexpected_trap("Hypervisor", regs);
     }
#4 lore raw
Quoted 11 lines · Ian Campbell
Quoted 6 lines · Andrew Cooper
Quoted 4 lines · Julien Grall

The syndrome value is printed in hexadecimal. Prefix it by 0x for less confusion.

Xen is trying to converge on '%#' rather than an explicit 0x.

Really? I've been moving in the opposite direction because e.g. %010#lx does the wrong thing with zero (0000000000 instead of 0x00000000).

Not sure about plain %#x though...

%#x DoesTheRightThing, and is a character shorter than its alternative. Jan appears to have replaced most of the x86 examples.

I also get slightly frustrated with Format strings with an explicit width do the specified thing (limit the length of the entire formatted entry), rather than the useful thing (sticking '0x' before a number with an explicit width).

By the time you have got a zero-extended explicitly-width'd format string, the 0x is hardly the end of the world

Quoted 4 lines
Quoted 2 lines

Also, it looks as if you want to do the same for IL

IL must be 2 or 4, for clarity it would be better as %d rather than 0x%x I think.

Agreed

~Andrew

#5 lore raw
In reply to Julien Grall
Quoted 4 lines · Julien Grall

The syndrome value is printed in hexadecimal. Prefix it by 0x for less confusion.

I've acked + applied this. Irrespective of any apparent move to prefer % #x this is an improvement.

Quoted 17 lines
---
 xen/arch/arm/traps.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/traps.c +1 -1
index 9eeed92..858abe5 100644
@@ -1616,7 +1616,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
         break;
     default:
  bad_trap:
-        printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=%"PRIx32"\n",
+        printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n",
                hsr.bits, hsr.ec, hsr.len, hsr.iss);
         do_unexpected_trap("Hypervisor", regs);
     }
#6 lore raw
Quoted 8 lines · Ian Campbell
Quoted 4 lines · Julien Grall

The syndrome value is printed in hexadecimal. Prefix it by 0x for less confusion.

I've acked + applied this. Irrespective of any apparent move to prefer % #x this is an improvement.

Thanks. So what was the conclusion about % vs #x. Which one shall we use?

Regards,

Signature · 1 line
Julien Grall
#7 lore raw
Quoted 11 lines · Julien Grall
Quoted 8 lines · Ian Campbell
Quoted 4 lines · Julien Grall

The syndrome value is printed in hexadecimal. Prefix it by 0x for less confusion.

I've acked + applied this. Irrespective of any apparent move to prefer % #x this is an improvement.

Thanks. So what was the conclusion about % vs #x. Which one shall we use?

I'm perfectly fine with 0x%x for ARM code. I think Andy's comment about "Xen moving towards" was overstating things somewhat.

Ian.

#8 lore raw
Quoted 8 lines · Ian Campbell
Quoted 7 lines · Julien Grall
Quoted 6 lines · Ian Campbell
Quoted 4 lines · Julien Grall

The syndrome value is printed in hexadecimal. Prefix it by 0x for less confusion.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I've acked + applied this. Irrespective of any apparent move to prefer % #x this is an improvement.

Thanks. So what was the conclusion about % vs #x. Which one shall we use?

I'm perfectly fine with 0x%x for ARM code. I think Andy's comment about "Xen moving towards" was overstating things somewhat.

Ok. FIY, Jan Beulich asked me to change some 0x%x into #x in common code when I sent patch a couple of month ago.

Signature · 1 line
Julien Grall
#9 lore raw
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 02.05.14 at 15:25, <[email protected]> wrote:
Quoted 11 lines · Ian Campbell
Quoted 10 lines · Julien Grall
Quoted 8 lines · Ian Campbell
Quoted 4 lines · Julien Grall

The syndrome value is printed in hexadecimal. Prefix it by 0x for less confusion.

I've acked + applied this. Irrespective of any apparent move to prefer % #x this is an improvement.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Thanks. So what was the conclusion about % vs #x. Which one shall we use?

I'm perfectly fine with 0x%x for ARM code. I think Andy's comment about "Xen moving towards" was overstating things somewhat.

Ok. FIY, Jan Beulich asked me to change some 0x%x into #x in common code when I sent patch a couple of month ago.

I can only repeat that: The format string is one byte shorter with the %#x form, and since this accumulates and we shouldn't be making the hypervisor image bigger than it needs to be, I think we should prefer that form. But of course - as everywhere - the maintainer(s) of a particular piece of code has/have the final say.

Jan

#10 lore raw
Quoted 18 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 02.05.14 at 15:25, <[email protected]> wrote:
Quoted 15 lines · Ian Campbell
Quoted 11 lines · Julien Grall
Quoted 8 lines · Ian Campbell
Quoted 4 lines · Julien Grall

The syndrome value is printed in hexadecimal. Prefix it by 0x for less confusion.

I've acked + applied this. Irrespective of any apparent move to prefer % #x this is an improvement.

Thanks. So what was the conclusion about % vs #x. Which one shall we use?

I'm perfectly fine with 0x%x for ARM code. I think Andy's comment about "Xen moving towards" was overstating things somewhat.

Quoted 7 lines
Quoted 2 lines

Ok. FIY, Jan Beulich asked me to change some 0x%x into #x in common code when I sent patch a couple of month ago.

I can only repeat that: The format string is one byte shorter with the %#x form, and since this accumulates and we shouldn't be making the hypervisor image bigger than it needs to be, I think we should prefer that form.

We'd need > 2000 of these before there was an even chance of pushing us into the next page. Is this really the lowest hanging fruit in terms of hypervisor size?

Quoted 2 lines

But of course - as everywhere - the
maintainer(s) of a particular piece of code has/have the final say.

TBH it's purely cosmetic, for values which one expects to see in hex I prefer to see 0x0 to 0, especially in e.g. a list of 0 and non-0 items.

Ian.