Skip to content

Commit 5223c67

Browse files
hbruecknerMartin Schwidefsky
authored andcommitted
s390/cpum_sf: save TOD clock base in SDBs for time conversion
Processing the samples in the AUX-area by perf requires the computation of respective time stamps. The time stamps used by perf are based on the monotonic clock. To convert the TOD clock value contained in an SDB to a monotonic clock value, the TOD clock base is required. Hence, also save the TOD clock base in the SDB. Suggested-by: Thomas Richter <[email protected]> Signed-off-by: Hendrik Brueckner <[email protected]> Signed-off-by: Martin Schwidefsky <[email protected]>
1 parent 03760d4 commit 5223c67

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

arch/s390/include/asm/cpu_mf.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* CPU-measurement facilities
44
*
5-
* Copyright IBM Corp. 2012
5+
* Copyright IBM Corp. 2012, 2018
66
* Author(s): Hendrik Brueckner <[email protected]>
77
* Jan Glauber <[email protected]>
88
*/
@@ -139,8 +139,14 @@ struct hws_trailer_entry {
139139
unsigned char timestamp[16]; /* 16 - 31 timestamp */
140140
unsigned long long reserved1; /* 32 -Reserved */
141141
unsigned long long reserved2; /* */
142-
unsigned long long progusage1; /* 48 - reserved for programming use */
143-
unsigned long long progusage2; /* */
142+
union { /* 48 - reserved for programming use */
143+
struct {
144+
unsigned int clock_base:1; /* in progusage2 */
145+
unsigned long long progusage1:63;
146+
unsigned long long progusage2;
147+
};
148+
unsigned long long progusage[2];
149+
};
144150
} __packed;
145151

146152
/* Load program parameter */

arch/s390/kernel/perf_cpum_sf.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Performance event support for the System z CPU-measurement Sampling Facility
44
*
5-
* Copyright IBM Corp. 2013
5+
* Copyright IBM Corp. 2013, 2018
66
* Author(s): Hendrik Brueckner <[email protected]>
77
*/
88
#define KMSG_COMPONENT "cpum_sf"
@@ -1587,6 +1587,17 @@ static void aux_buffer_free(void *data)
15871587
"%lu SDBTs\n", num_sdbt);
15881588
}
15891589

1590+
static void aux_sdb_init(unsigned long sdb)
1591+
{
1592+
struct hws_trailer_entry *te;
1593+
1594+
te = (struct hws_trailer_entry *)trailer_entry_ptr(sdb);
1595+
1596+
/* Save clock base */
1597+
te->clock_base = 1;
1598+
memcpy(&te->progusage2, &tod_clock_base[1], 8);
1599+
}
1600+
15901601
/*
15911602
* aux_buffer_setup() - Setup AUX buffer for diagnostic mode sampling
15921603
* @cpu: On which to allocate, -1 means current
@@ -1666,6 +1677,7 @@ static void *aux_buffer_setup(int cpu, void **pages, int nr_pages,
16661677
/* Tail is the entry in a SDBT */
16671678
*tail = (unsigned long)pages[i];
16681679
aux->sdb_index[i] = (unsigned long)pages[i];
1680+
aux_sdb_init((unsigned long)pages[i]);
16691681
}
16701682
sfb->num_sdb = nr_pages;
16711683

0 commit comments

Comments
 (0)