[<prev] [next>] [day] [month] [year] [list]
Message-ID: <167947647626.5837.12912753854693037433.tip-bot2@tip-bot2>
Date: Wed, 22 Mar 2023 09:14:36 -0000
From: "tip-bot2 for Breno Leitao" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Breno Leitao <leitao@...ian.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Sandipan Das <sandipan.das@....com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: perf/urgent] perf/x86/amd/core: Always clear status for idx
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: 263f5ecaf7080513efc248ec739b6d9e00f4129f
Gitweb: https://git.kernel.org/tip/263f5ecaf7080513efc248ec739b6d9e00f4129f
Author: Breno Leitao <leitao@...ian.org>
AuthorDate: Tue, 21 Mar 2023 04:33:38 -07:00
Committer: Peter Zijlstra <peterz@...radead.org>
CommitterDate: Tue, 21 Mar 2023 14:43:05 +01:00
perf/x86/amd/core: Always clear status for idx
The variable 'status' (which contains the unhandled overflow bits) is
not being properly masked in some cases, displaying the following
warning:
WARNING: CPU: 156 PID: 475601 at arch/x86/events/amd/core.c:972 amd_pmu_v2_handle_irq+0x216/0x270
This seems to be happening because the loop is being continued before
the status bit being unset, in case x86_perf_event_set_period()
returns 0. This is also causing an inconsistency because the "handled"
counter is incremented, but the status bit is not cleaned.
Move the bit cleaning together above, together when the "handled"
counter is incremented.
Fixes: 7685665c390d ("perf/x86/amd/core: Add PerfMonV2 overflow handling")
Signed-off-by: Breno Leitao <leitao@...ian.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Sandipan Das <sandipan.das@....com>
Link: https://lore.kernel.org/r/20230321113338.1669660-1-leitao@debian.org
---
arch/x86/events/amd/core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index 8c45b19..bccea57 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -923,6 +923,7 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs)
/* Event overflow */
handled++;
+ status &= ~mask;
perf_sample_data_init(&data, 0, hwc->last_period);
if (!x86_perf_event_set_period(event))
@@ -933,8 +934,6 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs)
if (perf_event_overflow(event, &data, regs))
x86_pmu_stop(event, 0);
-
- status &= ~mask;
}
/*
Powered by blists - more mailing lists