mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-04 04:02:26 +00:00
s390/pai: change sampling event assignment for PMU device driver
Currently only one PAI sampling event can be created and active at any one time. The PMU device drivers store a pointer to this event in their data structures even when the event is created for counting and the PMU device driver reference to this counting event is never needed. Change this and assign the pointer to the PMU device driver only when a sampling event is created. Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
13ff094d32
commit
e22033fddd
@ -324,12 +324,15 @@ static void paicrypt_read(struct perf_event *event)
|
||||
|
||||
static void paicrypt_start(struct perf_event *event, int flags)
|
||||
{
|
||||
struct paicrypt_mapptr *mp = this_cpu_ptr(paicrypt_root.mapptr);
|
||||
struct paicrypt_map *cpump = mp->mapptr;
|
||||
u64 sum;
|
||||
|
||||
if (!event->attr.sample_period) { /* Counting */
|
||||
sum = paicrypt_getall(event); /* Get current value */
|
||||
local64_set(&event->hw.prev_count, sum);
|
||||
} else { /* Sampling */
|
||||
cpump->event = event;
|
||||
perf_sched_cb_inc(event->pmu);
|
||||
}
|
||||
}
|
||||
@ -345,7 +348,6 @@ static int paicrypt_add(struct perf_event *event, int flags)
|
||||
WRITE_ONCE(S390_lowcore.ccd, ccd);
|
||||
local_ctl_set_bit(0, CR0_CRYPTOGRAPHY_COUNTER_BIT);
|
||||
}
|
||||
cpump->event = event;
|
||||
if (flags & PERF_EF_START)
|
||||
paicrypt_start(event, PERF_EF_RELOAD);
|
||||
event->hw.state = 0;
|
||||
|
@ -203,7 +203,6 @@ static int paiext_alloc(struct perf_event_attr *a, struct perf_event *event)
|
||||
}
|
||||
|
||||
rc = 0;
|
||||
cpump->event = event;
|
||||
|
||||
undo:
|
||||
if (rc) {
|
||||
@ -328,12 +327,15 @@ static void paiext_read(struct perf_event *event)
|
||||
|
||||
static void paiext_start(struct perf_event *event, int flags)
|
||||
{
|
||||
struct paiext_mapptr *mp = this_cpu_ptr(paiext_root.mapptr);
|
||||
struct paiext_map *cpump = mp->mapptr;
|
||||
u64 sum;
|
||||
|
||||
if (!event->attr.sample_period) { /* Counting */
|
||||
sum = paiext_getall(event); /* Get current value */
|
||||
local64_set(&event->hw.prev_count, sum);
|
||||
} else { /* Sampling */
|
||||
cpump->event = event;
|
||||
perf_sched_cb_inc(event->pmu);
|
||||
}
|
||||
}
|
||||
@ -352,7 +354,6 @@ static int paiext_add(struct perf_event *event, int flags)
|
||||
debug_sprintf_event(paiext_dbg, 4, "%s 1508 %llx acc %llx\n",
|
||||
__func__, S390_lowcore.aicd, pcb->acc);
|
||||
}
|
||||
cpump->event = event;
|
||||
if (flags & PERF_EF_START)
|
||||
paiext_start(event, PERF_EF_RELOAD);
|
||||
event->hw.state = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user