aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Richter <tmricht@linux.ibm.com>2018-10-25 04:04:05 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2018-11-02 03:31:56 -0400
commitc43e1c5a801fdde1aad0a2f9ed948753b5275d56 (patch)
treee55e13d0102127478bea85a4049b7ae8dd3a09a5
parente12e4044aede97974f2222eb7f0ed726a5179a32 (diff)
s390/cpum_sf: Rework attribute definition for diagnostic sampling
Previously, the attribute entry for diagnostic sampling was added if authorized. Otherwise, the array of struct attribute contains two NULL values. Change this logic and reserve space for the attribute for diagnostic sampling. If diagnostic sampling is authorized, add an entry in the respective position in the array of struct attribute. Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com> Suggested-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/kernel/perf_cpum_sf.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
index 7bf604ff50a1..bfabeb1889cc 100644
--- a/arch/s390/kernel/perf_cpum_sf.c
+++ b/arch/s390/kernel/perf_cpum_sf.c
@@ -1842,10 +1842,30 @@ static void cpumsf_pmu_del(struct perf_event *event, int flags)
1842CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF); 1842CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF);
1843CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); 1843CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG);
1844 1844
1845static struct attribute *cpumsf_pmu_events_attr[] = { 1845/* Attribute list for CPU_SF.
1846 CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC), 1846 *
1847 NULL, 1847 * The availablitiy depends on the CPU_MF sampling facility authorization
1848 NULL, 1848 * for basic + diagnositic samples. This is determined at initialization
1849 * time by the sampling facility device driver.
1850 * If the authorization for basic samples is turned off, it should be
1851 * also turned off for diagnostic sampling.
1852 *
1853 * During initialization of the device driver, check the authorization
1854 * level for diagnostic sampling and installs the attribute
1855 * file for diagnostic sampling if necessary.
1856 *
1857 * For now install a placeholder to reference all possible attributes:
1858 * SF_CYCLES_BASIC and SF_CYCLES_BASIC_DIAG.
1859 * Add another entry for the final NULL pointer.
1860 */
1861enum {
1862 SF_CYCLES_BASIC_ATTR_IDX = 0,
1863 SF_CYCLES_BASIC_DIAG_ATTR_IDX,
1864 SF_CYCLES_ATTR_MAX
1865};
1866
1867static struct attribute *cpumsf_pmu_events_attr[SF_CYCLES_ATTR_MAX + 1] = {
1868 [SF_CYCLES_BASIC_ATTR_IDX] = CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC)
1849}; 1869};
1850 1870
1851PMU_FORMAT_ATTR(event, "config:0-63"); 1871PMU_FORMAT_ATTR(event, "config:0-63");
@@ -2040,7 +2060,10 @@ static int __init init_cpum_sampling_pmu(void)
2040 2060
2041 if (si.ad) { 2061 if (si.ad) {
2042 sfb_set_limits(CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB); 2062 sfb_set_limits(CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB);
2043 cpumsf_pmu_events_attr[1] = 2063 /* Sampling of diagnostic data authorized,
2064 * install event into attribute list of PMU device.
2065 */
2066 cpumsf_pmu_events_attr[SF_CYCLES_BASIC_DIAG_ATTR_IDX] =
2044 CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC_DIAG); 2067 CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC_DIAG);
2045 } 2068 }
2046 2069