From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.4 2/6] sparc: Throttle perf events properly.
Date: Tue, 30 Oct 2018 09:30:53 -0400 [thread overview]
Message-ID: <20181030133057.218186-2-sashal@kernel.org> (raw)
In-Reply-To: <20181030133057.218186-1-sashal@kernel.org>
From: "David S. Miller" <davem@davemloft.net>
[ Upstream commit 455adb3174d2c8518cef1a61140c211f6ac224d2 ]
Like x86 and arm, call perf_sample_event_took() in perf event
NMI interrupt handler.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/sparc/kernel/perf_event.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index a5d0c2f08110..dd02219bcc35 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -23,6 +23,7 @@
#include <asm/cpudata.h>
#include <linux/uaccess.h>
#include <linux/atomic.h>
+#include <linux/sched/clock.h>
#include <asm/nmi.h>
#include <asm/pcr.h>
#include <asm/cacheflush.h>
@@ -1611,6 +1612,8 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
struct perf_sample_data data;
struct cpu_hw_events *cpuc;
struct pt_regs *regs;
+ u64 finish_clock;
+ u64 start_clock;
int i;
if (!atomic_read(&active_events))
@@ -1624,6 +1627,8 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
return NOTIFY_DONE;
}
+ start_clock = sched_clock();
+
regs = args->regs;
cpuc = this_cpu_ptr(&cpu_hw_events);
@@ -1662,6 +1667,10 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
sparc_pmu_stop(event, 0);
}
+ finish_clock = sched_clock();
+
+ perf_sample_event_took(finish_clock - start_clock);
+
return NOTIFY_STOP;
}
--
2.17.1
next prev parent reply other threads:[~2018-10-30 13:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-30 13:30 [PATCH AUTOSEL 4.4 1/6] sparc: Fix single-pcr perf event counter management Sasha Levin
2018-10-30 13:30 ` Sasha Levin [this message]
2018-10-30 13:30 ` [PATCH AUTOSEL 4.4 3/6] x86/fpu: Remove second definition of fpu in __fpu__restore_sig() Sasha Levin
2018-10-30 13:30 ` [PATCH AUTOSEL 4.4 4/6] net: qla3xxx: Remove overflowing shift statement Sasha Levin
2018-10-30 13:30 ` [PATCH AUTOSEL 4.4 5/6] r8169: fix NAPI handling under high load Sasha Levin
2018-10-30 13:30 ` [PATCH AUTOSEL 4.4 6/6] selftests: ftrace: Add synthetic event syntax testcase 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=20181030133057.218186-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@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