Commit c43e1c5a authored by Thomas Richter's avatar Thomas Richter Committed by Martin Schwidefsky

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: default avatarThomas Richter <tmricht@linux.ibm.com>
Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
Suggested-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent e12e4044
...@@ -1842,10 +1842,30 @@ static void cpumsf_pmu_del(struct perf_event *event, int flags) ...@@ -1842,10 +1842,30 @@ static void cpumsf_pmu_del(struct perf_event *event, int flags)
CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF); CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF);
CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG);
static struct attribute *cpumsf_pmu_events_attr[] = { /* Attribute list for CPU_SF.
CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC), *
NULL, * The availablitiy depends on the CPU_MF sampling facility authorization
NULL, * for basic + diagnositic samples. This is determined at initialization
* time by the sampling facility device driver.
* If the authorization for basic samples is turned off, it should be
* also turned off for diagnostic sampling.
*
* During initialization of the device driver, check the authorization
* level for diagnostic sampling and installs the attribute
* file for diagnostic sampling if necessary.
*
* For now install a placeholder to reference all possible attributes:
* SF_CYCLES_BASIC and SF_CYCLES_BASIC_DIAG.
* Add another entry for the final NULL pointer.
*/
enum {
SF_CYCLES_BASIC_ATTR_IDX = 0,
SF_CYCLES_BASIC_DIAG_ATTR_IDX,
SF_CYCLES_ATTR_MAX
};
static struct attribute *cpumsf_pmu_events_attr[SF_CYCLES_ATTR_MAX + 1] = {
[SF_CYCLES_BASIC_ATTR_IDX] = CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC)
}; };
PMU_FORMAT_ATTR(event, "config:0-63"); PMU_FORMAT_ATTR(event, "config:0-63");
...@@ -2040,7 +2060,10 @@ static int __init init_cpum_sampling_pmu(void) ...@@ -2040,7 +2060,10 @@ static int __init init_cpum_sampling_pmu(void)
if (si.ad) { if (si.ad) {
sfb_set_limits(CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB); sfb_set_limits(CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB);
cpumsf_pmu_events_attr[1] = /* Sampling of diagnostic data authorized,
* install event into attribute list of PMU device.
*/
cpumsf_pmu_events_attr[SF_CYCLES_BASIC_DIAG_ATTR_IDX] =
CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC_DIAG); CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC_DIAG);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment