Skip to content

Commit 443d4be

Browse files
hbruecknerMartin Schwidefsky
authored andcommitted
s390/cpum_sf: Add helper to read TOD from trailer entries
The trailer entry contains a timestamp of the time when the sample-data-block became full. The timestamp specifies a TOD (time-of-day) value in either the STCK or STCKE format. Provide a helper function to return the TOD value depending on the setting of time format indicator. Signed-off-by: Hendrik Brueckner <[email protected]> Signed-off-by: Martin Schwidefsky <[email protected]>
1 parent fcc77f5 commit 443d4be

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

arch/s390/include/asm/cpu_mf.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ struct hws_trailer_entry {
125125
unsigned long long flags; /* 0 - 63: All indicators */
126126
};
127127
unsigned long long overflow; /* 64 - sample Overflow count */
128-
unsigned long long timestamp; /* 16 - time-stamp */
129-
unsigned long long timestamp1; /* */
128+
unsigned char timestamp[16]; /* 16 - 31 timestamp */
130129
unsigned long long reserved1; /* 32 -Reserved */
131130
unsigned long long reserved2; /* */
132131
unsigned long long progusage1; /* 48 - reserved for programming use */
@@ -232,6 +231,17 @@ static inline unsigned long sample_rate_to_freq(struct hws_qsi_info_block *qsi,
232231
#define SDB_TE_ALERT_REQ_MASK 0x4000000000000000UL
233232
#define SDB_TE_BUFFER_FULL_MASK 0x8000000000000000UL
234233

234+
/* Return TOD timestamp contained in an trailer entry */
235+
static inline unsigned long long trailer_timestamp(struct hws_trailer_entry *te)
236+
{
237+
/* TOD in STCKE format */
238+
if (te->t)
239+
return *((unsigned long long *) &te->timestamp[1]);
240+
241+
/* TOD in STCK format */
242+
return *((unsigned long long *) &te->timestamp[0]);
243+
}
244+
235245
/* Return pointer to trailer entry of an sample data block */
236246
static inline unsigned long *trailer_entry_ptr(unsigned long v)
237247
{

arch/s390/kernel/perf_cpum_sf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)
981981
debug_sprintf_event(sfdbg, 6, "hw_perf_event_update: sdbt=%p "
982982
"overflow=%llu timestamp=0x%llx\n",
983983
sdbt, te->overflow,
984-
(te->f) ? te->timestamp : 0ULL);
984+
(te->f) ? trailer_timestamp(te) : 0ULL);
985985

986986
/* Collect all samples from a single sample-data-block and
987987
* flag if an (perf) event overflow happened. If so, the PMU

0 commit comments

Comments
 (0)