[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1477787923-61185-44-git-send-email-davidcc@google.com>
Date: Sat, 29 Oct 2016 17:38:40 -0700
From: David Carrillo-Cisneros <davidcc@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: "x86@...nel.org" <x86@...nel.org>, Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Andi Kleen <ak@...ux.intel.com>,
Kan Liang <kan.liang@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Vegard Nossum <vegard.nossum@...il.com>,
Marcelo Tosatti <mtosatti@...hat.com>,
Nilay Vaish <nilayvaish@...il.com>,
Borislav Petkov <bp@...e.de>,
Vikas Shivappa <vikas.shivappa@...ux.intel.com>,
Ravi V Shankar <ravi.v.shankar@...el.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Paul Turner <pjt@...gle.com>,
Stephane Eranian <eranian@...gle.com>,
David Carrillo-Cisneros <davidcc@...gle.com>
Subject: [PATCH v3 43/46] perf/x86/intel/cmt: add CMT_UF_NOSTEAL_RMID flag
Allow user to specify that rmids used by a cgroup/event cannot be stolen.
The pmonrs that are marked with CMT_UF_NOSTEAL_RMID will never lose a valid
rmid once they have receive one.
Signed-off-by: David Carrillo-Cisneros <davidcc@...gle.com>
---
arch/x86/events/intel/cmt.c | 10 +++++++++-
arch/x86/events/intel/cmt.h | 5 ++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/x86/events/intel/cmt.c b/arch/x86/events/intel/cmt.c
index e677511..8cbcbc6 100644
--- a/arch/x86/events/intel/cmt.c
+++ b/arch/x86/events/intel/cmt.c
@@ -41,7 +41,7 @@ static struct monr *monr_hrchy_root;
/* Flags for root monr and all its pmonrs while being monitored. */
static enum cmt_user_flags root_monr_uflags =
- CMT_UF_HAS_USER | CMT_UF_NOLAZY_RMID;
+ CMT_UF_HAS_USER | CMT_UF_NOSTEAL_RMID | CMT_UF_NOLAZY_RMID;
/* Auxiliar flags */
static enum cmt_user_flags *pkg_uflags_zeroes;
@@ -499,6 +499,7 @@ static void monr_dealloc(struct monr *monr)
*/
if (WARN_ON_ONCE(!(monr->flags & CMT_MONR_ZOMBIE)) ||
WARN_ON_ONCE(monr->nr_has_user) ||
+ WARN_ON_ONCE(monr->nr_nosteal_rmid) ||
WARN_ON_ONCE(monr->nr_nolazy_rmid) ||
WARN_ON_ONCE(monr->mon_cgrp) ||
WARN_ON_ONCE(monr->mon_events))
@@ -743,10 +744,13 @@ static bool monr_account_uflags(struct monr *monr,
if (uflags & CMT_UF_HAS_USER)
monr->nr_has_user += account ? 1 : -1;
+ if (uflags & CMT_UF_NOSTEAL_RMID)
+ monr->nr_nosteal_rmid += account ? 1 : -1;
if (uflags & CMT_UF_NOLAZY_RMID)
monr->nr_nolazy_rmid += account ? 1 : -1;
monr->uflags = (monr->nr_has_user ? CMT_UF_HAS_USER : 0) |
+ (monr->nr_nosteal_rmid ? CMT_UF_NOSTEAL_RMID : 0) |
(monr->nr_nolazy_rmid ? CMT_UF_NOLAZY_RMID : 0);
return old_flags != monr->uflags;
@@ -1400,6 +1404,10 @@ static bool can_steal_rmid(struct pmonr *pmonr)
u64 last_all_active, next_steal_time, last_pmonr_active;
last_all_active = atomic64_read(&monr->last_rmid_recoup);
+
+ if (pmonr_uflags(pmonr) & CMT_UF_NOSTEAL_RMID)
+ return false;
+
/*
* Can steal if no pmonr has been stolen or all not Unused have been
* in Active state for long enough.
diff --git a/arch/x86/events/intel/cmt.h b/arch/x86/events/intel/cmt.h
index 872cce0..c377076 100644
--- a/arch/x86/events/intel/cmt.h
+++ b/arch/x86/events/intel/cmt.h
@@ -290,7 +290,8 @@ enum cmt_user_flags {
/* if no has_user other flags are meaningless. */
CMT_UF_HAS_USER = BIT(0), /* has cgroup or event users */
CMT_UF_NOLAZY_RMID = BIT(1), /* try to obtain rmid on creation */
- CMT_UF_MAX = BIT(2) - 1,
+ CMT_UF_NOSTEAL_RMID = BIT(2), /* do not steal this rmid */
+ CMT_UF_MAX = BIT(3) - 1,
CMT_UF_ERROR = CMT_UF_MAX + 1,
};
@@ -309,6 +310,7 @@ enum cmt_user_flags {
* monr is monitoring in all required packages.
* @flags: monr_flags.
* @nr_has_user: nr of CMT_UF_HAS_USER set in events in mon_events.
+ * @nr_nosteal_user: nr of CMT_UF_NOSTEAL_RMID set in events in mon_events.
* @nr_nolazy_user: nr of CMT_UF_NOLAZY_RMID set in events in mon_events.
* @uflags: monr level cmt_user_flags, or'ed with pkg_uflags.
* @pkg_uflags: package level cmt_user_flags, each entry is used as
@@ -335,6 +337,7 @@ struct monr {
enum monr_flags flags;
int nr_has_user;
+ int nr_nosteal_rmid;
int nr_nolazy_rmid;
enum cmt_user_flags uflags;
enum cmt_user_flags pkg_uflags[];
--
2.8.0.rc3.226.g39d4020
Powered by blists - more mailing lists