s390/pai: initialize event count once at initialization
authorThomas Richter <tmricht@linux.ibm.com>
Wed, 11 Oct 2023 10:09:30 +0000 (12:09 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 25 Oct 2023 13:08:29 +0000 (15:08 +0200)
Event count value is initialized and set to zero in function
paicrypt_start().  This function is called once per CPU when an
event is started on that CPU. This leads to event count value
being set to zero as many times as there are online CPUs.
This is not necessary. The event count value is bound to the event
and it is sufficient to initialize the event counter once at
event creation time. This is done when the event structure
is dynamicly allocated with __GFP_ZERO flag. This sets
member count to zero.

Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/kernel/perf_pai_crypto.c
arch/s390/kernel/perf_pai_ext.c

index 85d7398ac2790c2b2bd1156a2d23d29ea636f7d7..35940234da750199a86fff77f807785c75291fbe 100644 (file)
@@ -322,7 +322,6 @@ static void paicrypt_start(struct perf_event *event, int flags)
        if (!event->hw.last_tag) {
                event->hw.last_tag = 1;
                sum = paicrypt_getall(event);           /* Get current value */
-               local64_set(&event->count, 0);
                local64_set(&event->hw.prev_count, sum);
        }
 }
index edceff2143b949bfc5529df51687637cbfa24672..8ba0f1a3a39dc0b7b4a2a2e300604a1b7968208c 100644 (file)
@@ -326,7 +326,6 @@ static void paiext_start(struct perf_event *event, int flags)
        event->hw.last_tag = 1;
        sum = paiext_getall(event);             /* Get current value */
        local64_set(&event->hw.prev_count, sum);
-       local64_set(&event->count, 0);
 }
 
 static int paiext_add(struct perf_event *event, int flags)