Skip to content

Commit

Permalink
s390/cpum_sf: add diagnostic sampling event only if it is authorized
Browse files Browse the repository at this point in the history
The SF_CYCLES_BASIC_DIAG is always registered even if it is turned of in the
current hardware configuration.  Because diagnostic-sampling is typically not
turned on in the hardware configuration, do not register this perf event by
default.  Enable it only if the diagnostic-sampling function is authorized.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
hbrueckner authored and Martin Schwidefsky committed Mar 13, 2015
1 parent c202baf commit 0a64815
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions arch/s390/kernel/perf_cpum_sf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG);

static struct attribute *cpumsf_pmu_events_attr[] = {
CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC),
CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC_DIAG),
NULL,
NULL,
};

Expand Down Expand Up @@ -1606,8 +1606,11 @@ static int __init init_cpum_sampling_pmu(void)
return -EINVAL;
}

if (si.ad)
if (si.ad) {
sfb_set_limits(CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB);
cpumsf_pmu_events_attr[1] =
CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC_DIAG);
}

sfdbg = debug_register(KMSG_COMPONENT, 2, 1, 80);
if (!sfdbg)
Expand Down

0 comments on commit 0a64815

Please sign in to comment.