From: tip-bot for Reinette Chatre <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, peterz@infradead.org,
reinette.chatre@intel.com, tglx@linutronix.de, hpa@zytor.com,
linux-kernel@vger.kernel.org
Subject: [tip:perf/urgent] perf/core: Add sanity check to deal with pinned event failure
Date: Fri, 28 Sep 2018 13:48:52 -0700 [thread overview]
Message-ID: <tip-befb1b3c2703897c5b8ffb0044dc5d0e5f27c5d7@git.kernel.org> (raw)
In-Reply-To: <6486385d1f30336e9973b24c8c65f5079543d3d3.1537377064.git.reinette.chatre@intel.com>
Commit-ID: befb1b3c2703897c5b8ffb0044dc5d0e5f27c5d7
Gitweb: https://git.kernel.org/tip/befb1b3c2703897c5b8ffb0044dc5d0e5f27c5d7
Author: Reinette Chatre <reinette.chatre@intel.com>
AuthorDate: Wed, 19 Sep 2018 10:29:06 -0700
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 28 Sep 2018 22:44:53 +0200
perf/core: Add sanity check to deal with pinned event failure
It is possible that a failure can occur during the scheduling of a
pinned event. The initial portion of perf_event_read_local() contains
the various error checks an event should pass before it can be
considered valid. Ensure that the potential scheduling failure
of a pinned event is checked for and have a credible error.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: fenghua.yu@intel.com
Cc: tony.luck@intel.com
Cc: acme@kernel.org
Cc: gavin.hindman@intel.com
Cc: jithu.joseph@intel.com
Cc: dave.hansen@intel.com
Cc: hpa@zytor.com
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/6486385d1f30336e9973b24c8c65f5079543d3d3.1537377064.git.reinette.chatre@intel.com
---
kernel/events/core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index c80549bf82c6..dcb093e7b377 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3935,6 +3935,12 @@ int perf_event_read_local(struct perf_event *event, u64 *value,
goto out;
}
+ /* If this is a pinned event it must be running on this CPU */
+ if (event->attr.pinned && event->oncpu != smp_processor_id()) {
+ ret = -EBUSY;
+ goto out;
+ }
+
/*
* If the event is currently on this CPU, its either a per-task event,
* or local to this CPU. Furthermore it means its ACTIVE (otherwise
next prev parent reply other threads:[~2018-09-28 20:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-19 17:29 [PATCH V5 0/6] perf and x86/intel_rdt: Fix lack of coordination with perf Reinette Chatre
2018-09-19 17:29 ` [PATCH V5 1/6] perf/core: Add sanity check to deal with pinned event failure Reinette Chatre
2018-09-28 20:48 ` tip-bot for Reinette Chatre [this message]
2018-09-19 17:29 ` [PATCH V5 2/6] perf/x86: Add helper to obtain performance counter index Reinette Chatre
2018-09-29 7:00 ` [tip:x86/cache] " tip-bot for Reinette Chatre
2018-09-19 17:29 ` [PATCH V5 3/6] x86/intel_rdt: Remove local register variables Reinette Chatre
2018-09-29 7:01 ` [tip:x86/cache] " tip-bot for Reinette Chatre
2018-09-19 17:29 ` [PATCH V5 4/6] x86/intel_rdt: Create required perf event attributes Reinette Chatre
2018-09-29 7:01 ` [tip:x86/cache] " tip-bot for Reinette Chatre
2018-09-19 17:29 ` [PATCH V5 5/6] x86/intel_rdt: Use perf infrastructure for measurements Reinette Chatre
2018-09-20 14:11 ` Peter Zijlstra
2018-09-20 19:02 ` [PATCH V6 " Reinette Chatre
2018-09-29 7:02 ` [tip:x86/cache] " tip-bot for Reinette Chatre
2018-09-19 17:29 ` [PATCH V5 6/6] x86/intel_rdt: Re-enable pseudo-lock measurements Reinette Chatre
2018-10-03 19:57 ` [tip:x86/cache] " tip-bot for Reinette Chatre
2018-09-20 14:11 ` [PATCH V5 0/6] perf and x86/intel_rdt: Fix lack of coordination with perf Peter Zijlstra
2018-09-21 16:49 ` Reinette Chatre
2018-09-27 20:39 ` Thomas Gleixner
2018-09-28 6:58 ` Peter Zijlstra
2018-09-29 14:23 ` Reinette Chatre
2018-09-29 17:56 ` Thomas Gleixner
2018-10-03 19:41 ` Reinette Chatre
2018-10-03 19:45 ` Thomas Gleixner
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=tip-befb1b3c2703897c5b8ffb0044dc5d0e5f27c5d7@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=reinette.chatre@intel.com \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).