diff mbox series

[2/2] KVM: arm/arm64: Print the EC hex value with its exact width

Message ID 1568169216-12632-3-git-send-email-yuzenghui@huawei.com (mailing list archive)
State New, archived
Headers show
Series KVM: arm/arm64: Two minor tracing changes | expand

Commit Message

Zenghui Yu Sept. 11, 2019, 2:33 a.m. UTC
EC is the bits [31:26] of ESR_ELx on arm64 (HSR on arm). Print the
hex value with its exact width (8).

Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
---
 virt/kvm/arm/trace.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marc Zyngier Sept. 11, 2019, 8:31 a.m. UTC | #1
On Wed, 11 Sep 2019 03:33:36 +0100,
Zenghui Yu <yuzenghui@huawei.com> wrote:
> 
> EC is the bits [31:26] of ESR_ELx on arm64 (HSR on arm). Print the
> hex value with its exact width (8).
> 
> Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
> ---
>  virt/kvm/arm/trace.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/virt/kvm/arm/trace.h b/virt/kvm/arm/trace.h
> index 204d210d01c2..022b0a060034 100644
> --- a/virt/kvm/arm/trace.h
> +++ b/virt/kvm/arm/trace.h
> @@ -42,7 +42,7 @@ TRACE_EVENT(kvm_exit,
>  		__entry->vcpu_pc		= vcpu_pc;
>  	),
>  
> -	TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%08lx",
> +	TP_printk("%s: HSR_EC: 0x%02x (%s), PC: 0x%08lx",
>  		  __print_symbolic(__entry->ret, kvm_arm_exception_type),
>  		  __entry->esr_ec,
>  		  __print_symbolic(__entry->esr_ec, kvm_arm_exception_class),

Although you're right that 8 bits ought to be enough, this is a change
to the output of the tracepoint, which userspace could (does?) parse.
I'm thus reluctant to change anything there, knowing that we don't
lose any information, and just print two extra zeroes.

Am I missing anything?

Thanks,

	M.
Zenghui Yu Sept. 11, 2019, 9:19 a.m. UTC | #2
Hi Marc,

On 2019/9/11 16:31, Marc Zyngier wrote:
> On Wed, 11 Sep 2019 03:33:36 +0100,
> Zenghui Yu <yuzenghui@huawei.com> wrote:
>>
>> EC is the bits [31:26] of ESR_ELx on arm64 (HSR on arm). Print the
>> hex value with its exact width (8).
>>
>> Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
>> ---
>>   virt/kvm/arm/trace.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/virt/kvm/arm/trace.h b/virt/kvm/arm/trace.h
>> index 204d210d01c2..022b0a060034 100644
>> --- a/virt/kvm/arm/trace.h
>> +++ b/virt/kvm/arm/trace.h
>> @@ -42,7 +42,7 @@ TRACE_EVENT(kvm_exit,
>>   		__entry->vcpu_pc		= vcpu_pc;
>>   	),
>>   
>> -	TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%08lx",
>> +	TP_printk("%s: HSR_EC: 0x%02x (%s), PC: 0x%08lx",
>>   		  __print_symbolic(__entry->ret, kvm_arm_exception_type),
>>   		  __entry->esr_ec,
>>   		  __print_symbolic(__entry->esr_ec, kvm_arm_exception_class),
> 
> Although you're right that 8 bits ought to be enough, this is a change
> to the output of the tracepoint, which userspace could (does?) parse.

Well-written userspace tools should only parse the low 8 bits (if they
do parse). But even if the high bits are parsed, they're always 0.
So I don't think this change will have a bad impact on userspace.

> I'm thus reluctant to change anything there, knowing that we don't
> lose any information, and just print two extra zeroes.

Anyway this is not a fix, feel free to ignore it if you're worried about
that there might be some issues ;)

> Am I missing anything?

No.


Thanks,
zenghui
Marc Zyngier Sept. 11, 2019, 3:35 p.m. UTC | #3
On Wed, 11 Sep 2019 10:19:05 +0100,
Zenghui Yu <yuzenghui@huawei.com> wrote:
> 
> Hi Marc,
> 
> On 2019/9/11 16:31, Marc Zyngier wrote:
> > On Wed, 11 Sep 2019 03:33:36 +0100,
> > Zenghui Yu <yuzenghui@huawei.com> wrote:
> >> 
> >> EC is the bits [31:26] of ESR_ELx on arm64 (HSR on arm). Print the
> >> hex value with its exact width (8).
> >> 
> >> Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
> >> ---
> >>   virt/kvm/arm/trace.h | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/virt/kvm/arm/trace.h b/virt/kvm/arm/trace.h
> >> index 204d210d01c2..022b0a060034 100644
> >> --- a/virt/kvm/arm/trace.h
> >> +++ b/virt/kvm/arm/trace.h
> >> @@ -42,7 +42,7 @@ TRACE_EVENT(kvm_exit,
> >>   		__entry->vcpu_pc		= vcpu_pc;
> >>   	),
> >>   -	TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%08lx",
> >> +	TP_printk("%s: HSR_EC: 0x%02x (%s), PC: 0x%08lx",
> >>   		  __print_symbolic(__entry->ret, kvm_arm_exception_type),
> >>   		  __entry->esr_ec,
> >>   		  __print_symbolic(__entry->esr_ec, kvm_arm_exception_class),
> > 
> > Although you're right that 8 bits ought to be enough, this is a change
> > to the output of the tracepoint, which userspace could (does?) parse.
> 
> Well-written userspace tools should only parse the low 8 bits (if they
> do parse). But even if the high bits are parsed, they're always 0.
> So I don't think this change will have a bad impact on userspace.

The problem is that we don't only cater for well written SW. We also
support the broken stuff, unfortunately.

Thanks,

	M.
diff mbox series

Patch

diff --git a/virt/kvm/arm/trace.h b/virt/kvm/arm/trace.h
index 204d210d01c2..022b0a060034 100644
--- a/virt/kvm/arm/trace.h
+++ b/virt/kvm/arm/trace.h
@@ -42,7 +42,7 @@  TRACE_EVENT(kvm_exit,
 		__entry->vcpu_pc		= vcpu_pc;
 	),
 
-	TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%08lx",
+	TP_printk("%s: HSR_EC: 0x%02x (%s), PC: 0x%08lx",
 		  __print_symbolic(__entry->ret, kvm_arm_exception_type),
 		  __entry->esr_ec,
 		  __print_symbolic(__entry->esr_ec, kvm_arm_exception_class),