From: kan.liang@linux.intel.com
To: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org
Cc: acme@kernel.org, mark.rutland@arm.com, ak@linux.intel.com,
alexander.shishkin@linux.intel.com, namhyung@kernel.org,
jolsa@redhat.com, Kan Liang <kan.liang@linux.intel.com>
Subject: [PATCH 0/4] perf: Fix the ctx->pmu for a hybrid system
Date: Wed, 16 Jun 2021 11:55:30 -0700 [thread overview]
Message-ID: <1623869734-133974-1-git-send-email-kan.liang@linux.intel.com> (raw)
From: Kan Liang <kan.liang@linux.intel.com>
The patchset is to fix the below WARNING triggered on an ADL machine
when a user enables per-task monitoring with all available
perf_hw_context PMUs.
WARNING: CPU: 8 PID: 37107 at arch/x86/events/core.c:1505
x86_pmu_start+0x77/0x90
Call Trace:
x86_pmu_enable+0x111/0x2f0
event_sched_in+0x167/0x230
merge_sched_in+0x1a7/0x3d0
visit_groups_merge.constprop.0.isra.0+0x16f/0x450
? x86_pmu_del+0x42/0x190
ctx_sched_in+0xb8/0x170
perf_event_sched_in+0x61/0x90
__perf_event_task_sched_in+0x20b/0x2a0
finish_task_switch.isra.0+0x16a/0x290
__schedule+0x2fd/0x970
? free_inode_nonrcu+0x18/0x20
schedule+0x4f/0xc0
do_wait+0x176/0x2f0
kernel_wait4+0xaf/0x150
Here is the line of the WARNING.
if (WARN_ON_ONCE(!(event->hw.state & PERF_HES_STOPPED)))
To fix the issue, the generic perf codes have to understand the
supported CPU mask of a specific hybrid PMU. So it can update the
ctx->pmu accordingly, when a task is scheduled on a CPU which has
a different type of PMU from the previous CPU. The supported_cpus
has to be moved to the struct pmu.
Besides, the moving can bring another improvement. All hybrid
architectures including x86 and arm check whether an event is
schedulable on the current CPU via the filter_match callback. Since the
supported_cpus is moved to struct pmu, the check can be done in the
generic code. The filter_match callback may be avoided. The patchset
only implements the improvement for x86. Arm may implement a similar
improvement later separately.
Kan Liang (4):
perf: Update the ctx->pmu for a hybrid system
perf/x86: Fix the x86_pmu_start WARNING on a hybrid system
perf: Check the supported CPU of an event
perf/x86: Remove filter_match callback
arch/x86/events/core.c | 22 ++++------------------
arch/x86/events/intel/core.c | 19 ++++---------------
arch/x86/events/perf_event.h | 2 --
include/linux/perf_event.h | 7 +++++++
kernel/events/core.c | 39 ++++++++++++++++++++++++++++++++++++++-
5 files changed, 53 insertions(+), 36 deletions(-)
--
2.7.4
next reply other threads:[~2021-06-16 19:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-16 18:55 kan.liang [this message]
2021-06-16 18:55 ` [PATCH 1/4] perf: Update the ctx->pmu for a hybrid system kan.liang
2021-06-16 18:55 ` [PATCH 2/4] perf/x86: Fix the x86_pmu_start WARNING on " kan.liang
2021-06-16 18:55 ` [PATCH 3/4] perf: Check the supported CPU of an event kan.liang
2021-06-16 18:55 ` [PATCH 4/4] perf/x86: Remove filter_match callback kan.liang
2021-06-17 10:23 ` [PATCH 0/4] perf: Fix the ctx->pmu for a hybrid system Peter Zijlstra
2021-06-17 11:33 ` Peter Zijlstra
2021-06-17 14:10 ` Liang, Kan
2021-06-17 19:32 ` Peter Zijlstra
2021-06-18 13:54 ` Liang, Kan
2021-06-24 7:09 ` [tip: perf/core] perf: Fix task context PMU for Hetero tip-bot2 for Peter Zijlstra
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=1623869734-133974-1-git-send-email-kan.liang@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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