s390 cio: Rewrite trace point class s390_class_schib
authorThomas Richter <tmricht@linux.ibm.com>
Tue, 3 Jul 2018 09:21:06 +0000 (11:21 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 23 Jul 2018 11:49:56 +0000 (13:49 +0200)
Tools like 'perf stat' parse the trace point format files defined
in /sys/kernel/debug/tracing/events/s390/.../format to handle
the print fmt: statement. The kernel provides a library in
directory linux/tools/lib/traceevent/* for this reason.

This library can not handle structures or unions defined in
the TRACE_EVENT/TP_STRUCT__entry macros with __field_struct macro.
There is no possibility to extract a structure member
(which might be a bit field) since there is no packing
information nor bit field offset by parsing the printf fmt line.

Therefore rewrite the TRACE_EVENT macro and add the
__field macro for the necessary members.
Keep the __fieldstruct macro to extract the complete
structure when dumps are analysed.

Note that the same information is displayed, this is no
interface change.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Acked-by: Sebastian Ott <sebott@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/trace.h

index 137410da1e9f725f281709c6893af1c99f91bf47..0ebb29b6fd6df2fa65b1cce91fc3e0478eb37345 100644 (file)
@@ -30,6 +30,17 @@ DECLARE_EVENT_CLASS(s390_class_schib,
                __field(u16, schno)
                __field(u16, devno)
                __field_struct(struct schib, schib)
+               __field(u8, pmcw_ena)
+               __field(u8, pmcw_st)
+               __field(u8, pmcw_dnv)
+               __field(u16, pmcw_dev)
+               __field(u8, pmcw_lpm)
+               __field(u8, pmcw_pnom)
+               __field(u8, pmcw_lpum)
+               __field(u8, pmcw_pim)
+               __field(u8, pmcw_pam)
+               __field(u8, pmcw_pom)
+               __field(u64, pmcw_chpid)
                __field(int, cc)
        ),
        TP_fast_assign(
@@ -38,18 +49,29 @@ DECLARE_EVENT_CLASS(s390_class_schib,
                __entry->schno = schid.sch_no;
                __entry->devno = schib->pmcw.dev;
                __entry->schib = *schib;
+               __entry->pmcw_ena = schib->pmcw.ena;
+               __entry->pmcw_st = schib->pmcw.ena;
+               __entry->pmcw_dnv = schib->pmcw.dnv;
+               __entry->pmcw_dev = schib->pmcw.dev;
+               __entry->pmcw_lpm = schib->pmcw.lpm;
+               __entry->pmcw_pnom = schib->pmcw.pnom;
+               __entry->pmcw_lpum = schib->pmcw.lpum;
+               __entry->pmcw_pim = schib->pmcw.pim;
+               __entry->pmcw_pam = schib->pmcw.pam;
+               __entry->pmcw_pom = schib->pmcw.pom;
+               memcpy(&__entry->pmcw_chpid, &schib->pmcw.chpid, 8);
                __entry->cc = cc;
        ),
        TP_printk("schid=%x.%x.%04x cc=%d ena=%d st=%d dnv=%d dev=%04x "
                  "lpm=0x%02x pnom=0x%02x lpum=0x%02x pim=0x%02x pam=0x%02x "
                  "pom=0x%02x chpids=%016llx",
                  __entry->cssid, __entry->ssid, __entry->schno, __entry->cc,
-                 __entry->schib.pmcw.ena, __entry->schib.pmcw.st,
-                 __entry->schib.pmcw.dnv, __entry->schib.pmcw.dev,
-                 __entry->schib.pmcw.lpm, __entry->schib.pmcw.pnom,
-                 __entry->schib.pmcw.lpum, __entry->schib.pmcw.pim,
-                 __entry->schib.pmcw.pam, __entry->schib.pmcw.pom,
-                 *((u64 *) __entry->schib.pmcw.chpid)
+                 __entry->pmcw_ena, __entry->pmcw_st,
+                 __entry->pmcw_dnv, __entry->pmcw_dev,
+                 __entry->pmcw_lpm, __entry->pmcw_pnom,
+                 __entry->pmcw_lpum, __entry->pmcw_pim,
+                 __entry->pmcw_pam, __entry->pmcw_pom,
+                 __entry->pmcw_chpid
        )
 );