diff mbox series

[v2,2/2] KVM: s390: add tracepoint in gmap notifier

Message ID 20230510121822.546629-3-nrb@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series KVM: s390: add counters for vsie performance | expand

Commit Message

Nico Boehr May 10, 2023, 12:18 p.m. UTC
The gmap notifier is called for changes in table entries with the
notifier bit set. To diagnose performance issues, it can be useful to
see what causes certain changes in the gmap.

Hence, add a tracepoint in the gmap notifier.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 arch/s390/kvm/kvm-s390.c   |  2 ++
 arch/s390/kvm/trace-s390.h | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+)

Comments

David Hildenbrand July 27, 2023, 7:41 a.m. UTC | #1
On 10.05.23 14:18, Nico Boehr wrote:
> The gmap notifier is called for changes in table entries with the
> notifier bit set. To diagnose performance issues, it can be useful to
> see what causes certain changes in the gmap.
> 
> Hence, add a tracepoint in the gmap notifier.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
>   arch/s390/kvm/kvm-s390.c   |  2 ++
>   arch/s390/kvm/trace-s390.h | 23 +++++++++++++++++++++++
>   2 files changed, 25 insertions(+)
> 
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index ded4149e145b..e8476c023b07 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -3982,6 +3982,8 @@ static void kvm_gmap_notifier(struct gmap *gmap, unsigned long start,
>   	unsigned long prefix;
>   	unsigned long i;
>   
> +	trace_kvm_s390_gmap_notifier(start, end, gmap_is_shadow(gmap));
> +
>   	if (gmap_is_shadow(gmap))
>   		return;
>   	if (start >= 1UL << 31)
> diff --git a/arch/s390/kvm/trace-s390.h b/arch/s390/kvm/trace-s390.h
> index 6f0209d45164..5dabd0b64d6e 100644
> --- a/arch/s390/kvm/trace-s390.h
> +++ b/arch/s390/kvm/trace-s390.h
> @@ -333,6 +333,29 @@ TRACE_EVENT(kvm_s390_airq_suppressed,
>   		      __entry->id, __entry->isc)
>   	);
>   
> +/*
> + * Trace point for gmap notifier calls.
> + */
> +TRACE_EVENT(kvm_s390_gmap_notifier,
> +		TP_PROTO(unsigned long start, unsigned long end, unsigned int shadow),
> +		TP_ARGS(start, end, shadow),
> +
> +		TP_STRUCT__entry(
> +			__field(unsigned long, start)
> +			__field(unsigned long, end)
> +			__field(unsigned int, shadow)
> +			),
> +
> +		TP_fast_assign(
> +			__entry->start = start;
> +			__entry->end = end;
> +			__entry->shadow = shadow;
> +			),
> +
> +		TP_printk("gmap notified (start:0x%lx end:0x%lx shadow:%d)",
> +			__entry->start, __entry->end, __entry->shadow)
> +	);
> +
>   
>   #endif /* _TRACE_KVMS390_H */
>   

In the context of vsie, I'd have thought you'd be tracing 
kvm_s390_vsie_gmap_notifier() instead.

This should work as well, as all notifier are called.

Acked-by: David Hildenbrand <david@redhat.com>
Nico Boehr Aug. 4, 2023, 9:46 a.m. UTC | #2
Quoting David Hildenbrand (2023-07-27 09:41:51)
> On 10.05.23 14:18, Nico Boehr wrote:
> > The gmap notifier is called for changes in table entries with the
> > notifier bit set. To diagnose performance issues, it can be useful to
> > see what causes certain changes in the gmap.
> > 
> > Hence, add a tracepoint in the gmap notifier.
> > 
> > Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> > ---
> >   arch/s390/kvm/kvm-s390.c   |  2 ++
> >   arch/s390/kvm/trace-s390.h | 23 +++++++++++++++++++++++
> >   2 files changed, 25 insertions(+)
> > 
> > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> > index ded4149e145b..e8476c023b07 100644
> > --- a/arch/s390/kvm/kvm-s390.c
> > +++ b/arch/s390/kvm/kvm-s390.c
> > @@ -3982,6 +3982,8 @@ static void kvm_gmap_notifier(struct gmap *gmap, unsigned long start,
> >       unsigned long prefix;
> >       unsigned long i;
> >   
> > +     trace_kvm_s390_gmap_notifier(start, end, gmap_is_shadow(gmap));
> > +
> >       if (gmap_is_shadow(gmap))
> >               return;
> >       if (start >= 1UL << 31)
> > diff --git a/arch/s390/kvm/trace-s390.h b/arch/s390/kvm/trace-s390.h
> > index 6f0209d45164..5dabd0b64d6e 100644
> > --- a/arch/s390/kvm/trace-s390.h
> > +++ b/arch/s390/kvm/trace-s390.h
> > @@ -333,6 +333,29 @@ TRACE_EVENT(kvm_s390_airq_suppressed,
> >                     __entry->id, __entry->isc)
> >       );
> >   
> > +/*
> > + * Trace point for gmap notifier calls.
> > + */
> > +TRACE_EVENT(kvm_s390_gmap_notifier,
> > +             TP_PROTO(unsigned long start, unsigned long end, unsigned int shadow),
> > +             TP_ARGS(start, end, shadow),
> > +
> > +             TP_STRUCT__entry(
> > +                     __field(unsigned long, start)
> > +                     __field(unsigned long, end)
> > +                     __field(unsigned int, shadow)
> > +                     ),
> > +
> > +             TP_fast_assign(
> > +                     __entry->start = start;
> > +                     __entry->end = end;
> > +                     __entry->shadow = shadow;
> > +                     ),
> > +
> > +             TP_printk("gmap notified (start:0x%lx end:0x%lx shadow:%d)",
> > +                     __entry->start, __entry->end, __entry->shadow)
> > +     );
> > +
> >   
> >   #endif /* _TRACE_KVMS390_H */
> >   
> 
> In the context of vsie, I'd have thought you'd be tracing 
> kvm_s390_vsie_gmap_notifier() instead.

Right, I can change that if you / others have a preference for that.
David Hildenbrand Aug. 4, 2023, 9:59 a.m. UTC | #3
>>>    
>>>    #endif /* _TRACE_KVMS390_H */
>>>    
>>
>> In the context of vsie, I'd have thought you'd be tracing
>> kvm_s390_vsie_gmap_notifier() instead.
> 
> Right, I can change that if you / others have a preference for that.
> 

No strong opinion, just a thought.
diff mbox series

Patch

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index ded4149e145b..e8476c023b07 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -3982,6 +3982,8 @@  static void kvm_gmap_notifier(struct gmap *gmap, unsigned long start,
 	unsigned long prefix;
 	unsigned long i;
 
+	trace_kvm_s390_gmap_notifier(start, end, gmap_is_shadow(gmap));
+
 	if (gmap_is_shadow(gmap))
 		return;
 	if (start >= 1UL << 31)
diff --git a/arch/s390/kvm/trace-s390.h b/arch/s390/kvm/trace-s390.h
index 6f0209d45164..5dabd0b64d6e 100644
--- a/arch/s390/kvm/trace-s390.h
+++ b/arch/s390/kvm/trace-s390.h
@@ -333,6 +333,29 @@  TRACE_EVENT(kvm_s390_airq_suppressed,
 		      __entry->id, __entry->isc)
 	);
 
+/*
+ * Trace point for gmap notifier calls.
+ */
+TRACE_EVENT(kvm_s390_gmap_notifier,
+		TP_PROTO(unsigned long start, unsigned long end, unsigned int shadow),
+		TP_ARGS(start, end, shadow),
+
+		TP_STRUCT__entry(
+			__field(unsigned long, start)
+			__field(unsigned long, end)
+			__field(unsigned int, shadow)
+			),
+
+		TP_fast_assign(
+			__entry->start = start;
+			__entry->end = end;
+			__entry->shadow = shadow;
+			),
+
+		TP_printk("gmap notified (start:0x%lx end:0x%lx shadow:%d)",
+			__entry->start, __entry->end, __entry->shadow)
+	);
+
 
 #endif /* _TRACE_KVMS390_H */