Re: WARNING: CPU: 1 PID: 1 at kernel/events/core.c:7825 perf_pmu_register+0x385/0x390
From: Peter Zijlstra
Date: Sat Apr 23 2016 - 18:43:20 EST
On Sat, Apr 23, 2016 at 03:03:22PM +0200, Borislav Petkov wrote:
> Yo,
>
> did the fix for this go anywhere? I'm still seeing it on rc4+tip/master:
>
> [ 0.760493] AMD Power PMU detected
> [ 0.760689] LVT offset 0 assigned for vector 0x400
> [ 0.761072] perf: AMD IBS detected (0x000007ff)
> [ 0.761340] ------------[ cut here ]------------
> [ 0.761571] WARNING: CPU: 1 PID: 1 at kernel/events/core.c:7825 perf_pmu_register+0x385/0x390
> [ 0.761909] Modules linked in:
> [ 0.762093] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc4+ #1
> [ 0.762331] Hardware name: HP HP EliteBook 745 G3/807E, BIOS N73 Ver. 01.08 01/28/2016
> [ 0.762674] 0000000000000000 ffffffff812dafa9 0000000000000000 0000000000000000
> [ 0.763185] ffffffff810589ac ffffffff81a0fbe0 000000000000000a ffffffff8172ee85
> [ 0.763672] 0000000000000000 ffff88042bdf9130 000000000008b000 ffffffff8112ff55
> [ 0.764101] Call Trace:
> [ 0.764240] [<ffffffff812dafa9>] ? dump_stack+0x5c/0x83
> [ 0.764454] [<ffffffff810589ac>] ? __warn+0xec/0x110
> [ 0.764680] [<ffffffff8112ff55>] ? perf_pmu_register+0x385/0x390
> [ 0.764956] [<ffffffff81b1b51d>] ? msr_init+0xbe/0xbe
> [ 0.765202] [<ffffffff81b1b5f1>] ? amd_iommu_pc_init+0xd4/0x141
> [ 0.765475] [<ffffffff810003ef>] ? do_one_initcall+0xaf/0x200
> [ 0.765718] [<ffffffff810768eb>] ? parse_args+0x2ab/0x4c0
> [ 0.765935] [<ffffffff81b18fe1>] ? kernel_init_freeable+0x111/0x190
> [ 0.766175] [<ffffffff815df02a>] ? kernel_init+0xa/0x100
> [ 0.766389] [<ffffffff815eaa22>] ? ret_from_fork+0x22/0x40
> [ 0.766620] [<ffffffff815df020>] ? rest_init+0x90/0x90
> [ 0.766885] ---[ end trace 9285cdb6cf96a9b2 ]---
> [ 0.767120] perf: amd_iommu: Detected. (0 banks, 0 counters/bank)
>
Oh, cute there's two different ones.
31d50c551e30 ("perf/x86/amd/uncore: Do not register a task ctx for uncore PMUs")
Doth the below fixeth thingies?
---
Subject: perf/amd/iommu: Do not register a task ctx for uncore like PMUs
The new sanity check introduced by:
26657848502b ("perf/core: Verify we have a single perf_hw_context PMU")
... triggered on the AMD IOMMU driver.
IOMMUs are not per logical CPU, they cannot have per-task counters. Fix it.
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
Cc: Joerg Roedel <jroedel@xxxxxxx>
Reported-by: Borislav Petkov <bp@xxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
arch/x86/events/amd/iommu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c
index 40625ca7a190..6011a573dd64 100644
--- a/arch/x86/events/amd/iommu.c
+++ b/arch/x86/events/amd/iommu.c
@@ -474,6 +474,7 @@ static __init int _init_perf_amd_iommu(
static struct perf_amd_iommu __perf_iommu = {
.pmu = {
+ .task_ctx_nr = perf_invalid_context,
.event_init = perf_iommu_event_init,
.add = perf_iommu_add,
.del = perf_iommu_del,