From: Thomas Richter <tmricht@linux.ibm.com>
To: "linux-perf-use." <linux-perf-users@vger.kernel.org>
Subject: Strange behavior when event installed systemwide multiple times
Date: Wed, 15 Jun 2022 15:30:45 +0200 [thread overview]
Message-ID: <b205da6a-d9a7-4c4b-521d-1b2515f6db4b@linux.ibm.com> (raw)
I have a question regarding the behavior when 2 events are installed
system-wide on the same CPU, for example:
# perf stat -e cpu-cycles -a -C0 -- sleep 5 &
# sleep 2
# perf stat -e instructions -a -C0 -- true
I wonder why at the 2nd perf invocation the event cpu-cycles is deleted
from CPU 0 just to be re-added immediately. I understand this is necessary
for events attached to a process. This is also done when the event is
installed system wide, and is not connected to a process.
Looking at the trace
# tracer: function
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
perf-19574 [000] d... 10588.974577: x86_pmu_add <-event_sched_in.isra.130
---> 1st perf runs and 1st event installed
perf-19574 [000] d... 10588.974582: x86_pmu_start <-x86_pmu_enable
perf-19579 [000] d... 10590.974582: x86_pmu_del <-event_sched_out.isra.116
perf-19579 [000] d... 10590.974583: x86_pmu_stop <-x86_pmu_del
---> 2nd perf runs and 1st event is deleted
perf-19579 [000] d... 10590.974585: x86_pmu_add <-event_sched_in.isra.130
---> 1st event cpu-cycles re-added
perf-19579 [000] d... 10590.974586: x86_pmu_add <-event_sched_in.isra.130
perf-19579 [000] d... 10590.974586: x86_pmu_start <-x86_pmu_enable
perf-19579 [000] d... 10590.974587: x86_pmu_start <-x86_pmu_enable
perf-19579 [000] d... 10590.975361: x86_pmu_del <-event_sched_out.isra.116
---> 2nd perf stops and 2nd event removed
perf-19579 [000] d... 10590.975361: x86_pmu_stop <-x86_pmu_del
perf-19574 [000] d... 10593.975959: x86_pmu_del <-event_sched_out.isra.116
perf-19574 [000] d... 10593.975961: x86_pmu_stop <-x86_pmu_del
---> 1st perf stops and 1st event removed.
Is this intended behavior?
Thanks a lot.
--
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
next reply other threads:[~2022-06-15 13:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-15 13:30 Thomas Richter [this message]
2022-06-15 17:12 ` Strange behavior when event installed systemwide multiple times Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b205da6a-d9a7-4c4b-521d-1b2515f6db4b@linux.ibm.com \
--to=tmricht@linux.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).