linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing
@ 2019-03-27 14:12 Vitaly Kuznetsov
  2019-04-11 13:14 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Vitaly Kuznetsov @ 2019-03-27 14:12 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini, Radim Krčmář, Liran Alon, linux-kernel

In __apic_accept_irq() interface trig_mode is int and actually on some code
paths it is set above u8:

kvm_apic_set_irq() extracts it from 'struct kvm_lapic_irq' where trig_mode
is u16. This is done on purpose as e.g. kvm_set_msi_irq() sets it to
(1 << 15) & e->msi.data

kvm_apic_local_deliver sets it to reg & (1 << 15).

Fix the immediate issue by making 'tm' into u16. We may also want to adjust
__apic_accept_irq() interface and use proper sizes for vector, level,
trig_mode but this is not urgent.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 arch/x86/kvm/trace.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index 6432d08c7de7..4d47a2631d1f 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -438,13 +438,13 @@ TRACE_EVENT(kvm_apic_ipi,
 );
 
 TRACE_EVENT(kvm_apic_accept_irq,
-	    TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec),
+	    TP_PROTO(__u32 apicid, __u16 dm, __u16 tm, __u8 vec),
 	    TP_ARGS(apicid, dm, tm, vec),
 
 	TP_STRUCT__entry(
 		__field(	__u32,		apicid		)
 		__field(	__u16,		dm		)
-		__field(	__u8,		tm		)
+		__field(	__u16,		tm		)
 		__field(	__u8,		vec		)
 	),
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing
  2019-03-27 14:12 [PATCH] KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing Vitaly Kuznetsov
@ 2019-04-11 13:14 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2019-04-11 13:14 UTC (permalink / raw)
  To: Vitaly Kuznetsov, kvm
  Cc: Radim Krčmář, Liran Alon, linux-kernel

On 27/03/19 15:12, Vitaly Kuznetsov wrote:
> In __apic_accept_irq() interface trig_mode is int and actually on some code
> paths it is set above u8:
> 
> kvm_apic_set_irq() extracts it from 'struct kvm_lapic_irq' where trig_mode
> is u16. This is done on purpose as e.g. kvm_set_msi_irq() sets it to
> (1 << 15) & e->msi.data
> 
> kvm_apic_local_deliver sets it to reg & (1 << 15).
> 
> Fix the immediate issue by making 'tm' into u16. We may also want to adjust
> __apic_accept_irq() interface and use proper sizes for vector, level,
> trig_mode but this is not urgent.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
>  arch/x86/kvm/trace.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
> index 6432d08c7de7..4d47a2631d1f 100644
> --- a/arch/x86/kvm/trace.h
> +++ b/arch/x86/kvm/trace.h
> @@ -438,13 +438,13 @@ TRACE_EVENT(kvm_apic_ipi,
>  );
>  
>  TRACE_EVENT(kvm_apic_accept_irq,
> -	    TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec),
> +	    TP_PROTO(__u32 apicid, __u16 dm, __u16 tm, __u8 vec),
>  	    TP_ARGS(apicid, dm, tm, vec),
>  
>  	TP_STRUCT__entry(
>  		__field(	__u32,		apicid		)
>  		__field(	__u16,		dm		)
> -		__field(	__u8,		tm		)
> +		__field(	__u16,		tm		)
>  		__field(	__u8,		vec		)
>  	),
>  
> 

Queued, thanks.

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-11 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27 14:12 [PATCH] KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing Vitaly Kuznetsov
2019-04-11 13:14 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).