From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sergey Matyukevich <sergey.matyukevich@syntacore.com>,
Atish Patra <atishp@rivosinc.com>,
Palmer Dabbelt <palmer@rivosinc.com>,
Sasha Levin <sashal@kernel.org>,
atishp@atishpatra.org, will@kernel.org, mark.rutland@arm.com,
paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 6.0 06/11] perf: RISC-V: throttle perf events
Date: Fri, 14 Oct 2022 09:51:32 -0400 [thread overview]
Message-ID: <20221014135139.2109024-6-sashal@kernel.org> (raw)
In-Reply-To: <20221014135139.2109024-1-sashal@kernel.org>
From: Sergey Matyukevich <sergey.matyukevich@syntacore.com>
[ Upstream commit 096b52fd2bb4996fd68d22b3b7ad21a1296db9d3 ]
Call perf_sample_event_took() to report time spent in overflow
interrupts. Perf core uses these measurements to throttle
perf events properly.
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@syntacore.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Link: https://lore.kernel.org/r/20220830155306.301714-4-geomatsi@gmail.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/perf/riscv_pmu_sbi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
index 8de4ca2fef21..88e326c5f63b 100644
--- a/drivers/perf/riscv_pmu_sbi.c
+++ b/drivers/perf/riscv_pmu_sbi.c
@@ -18,6 +18,7 @@
#include <linux/of_irq.h>
#include <linux/of.h>
#include <linux/cpu_pm.h>
+#include <linux/sched/clock.h>
#include <asm/sbi.h>
#include <asm/hwcap.h>
@@ -567,6 +568,7 @@ static irqreturn_t pmu_sbi_ovf_handler(int irq, void *dev)
unsigned long overflow;
unsigned long overflowed_ctrs = 0;
struct cpu_hw_events *cpu_hw_evt = dev;
+ u64 start_clock = sched_clock();
if (WARN_ON_ONCE(!cpu_hw_evt))
return IRQ_NONE;
@@ -635,7 +637,9 @@ static irqreturn_t pmu_sbi_ovf_handler(int irq, void *dev)
perf_event_overflow(event, &data, regs);
}
}
+
pmu_sbi_start_overflow_mask(pmu, overflowed_ctrs);
+ perf_sample_event_took(sched_clock() - start_clock);
return IRQ_HANDLED;
}
--
2.35.1
next prev parent reply other threads:[~2022-10-14 13:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-14 13:51 [PATCH AUTOSEL 6.0 01/11] signal: break out of wait loops on kthread_stop() Sasha Levin
2022-10-14 13:51 ` [PATCH AUTOSEL 6.0 02/11] powerpc/selftests: Use timersub() for gettimeofday() Sasha Levin
2022-10-14 13:51 ` [PATCH AUTOSEL 6.0 03/11] kvm: x86: Do proper cleanup if kvm_x86_ops->vm_init() fails Sasha Levin
2022-11-02 18:00 ` Paolo Bonzini
2022-10-14 13:51 ` [PATCH AUTOSEL 6.0 04/11] powerpc/math-emu: Remove -w build flag and fix warnings Sasha Levin
2022-10-14 13:51 ` [PATCH AUTOSEL 6.0 05/11] powerpc/85xx: Fix fall-through warning for Clang Sasha Levin
2022-10-14 13:51 ` Sasha Levin [this message]
2022-10-14 13:51 ` [PATCH AUTOSEL 6.0 07/11] powerpc: Remove direct call to personality syscall handler Sasha Levin
2022-10-14 13:51 ` [PATCH AUTOSEL 6.0 08/11] powerpc/perf: Fix branch_filter support for multiple filters Sasha Levin
2022-10-14 13:51 ` [PATCH AUTOSEL 6.0 09/11] powerpc/rtas: block error injection when locked down Sasha Levin
2022-10-14 13:51 ` [PATCH AUTOSEL 6.0 10/11] powerpc/mm: Fix UBSAN warning reported on hugetlb Sasha Levin
2022-10-14 13:51 ` [PATCH AUTOSEL 6.0 11/11] powerpc/64: Fix msr_check_and_set/clear MSR[EE] race Sasha Levin
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=20221014135139.2109024-6-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=atishp@atishpatra.org \
--cc=atishp@rivosinc.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=palmer@dabbelt.com \
--cc=palmer@rivosinc.com \
--cc=paul.walmsley@sifive.com \
--cc=sergey.matyukevich@syntacore.com \
--cc=stable@vger.kernel.org \
--cc=will@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