[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-cb8b78815b68b048303f55c276d2aef147e8f2e7@git.kernel.org>
Date: Tue, 26 Jun 2018 03:31:23 -0700
From: tip-bot for Frederic Weisbecker <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: jolsa@...hat.com, acme@...hat.com, ysato@...rs.sourceforge.jp,
torvalds@...ux-foundation.org, acme@...nel.org, hpa@...or.com,
namhyung@...nel.org, benh@...nel.crashing.org, will.deacon@....com,
chris@...kel.net, dalias@...c.org, linux-kernel@...r.kernel.org,
joel.opensrc@...il.com, mingo@...nel.org, mark.rutland@....com,
paulus@...ba.org, peterz@...radead.org, catalin.marinas@....com,
alexander.shishkin@...ux.intel.com, tglx@...utronix.de,
frederic@...nel.org, luto@...nel.org, jcmvbkbc@...il.com,
mpe@...erman.id.au
Subject: [tip:perf/core] perf/hw_breakpoint: Pass new breakpoint type to
modify_breakpoint_slot()
Commit-ID: cb8b78815b68b048303f55c276d2aef147e8f2e7
Gitweb: https://git.kernel.org/tip/cb8b78815b68b048303f55c276d2aef147e8f2e7
Author: Frederic Weisbecker <frederic@...nel.org>
AuthorDate: Tue, 26 Jun 2018 04:58:58 +0200
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Tue, 26 Jun 2018 09:07:59 +0200
perf/hw_breakpoint: Pass new breakpoint type to modify_breakpoint_slot()
We soon won't be able to rely on bp->attr anymore to get the new
type of the modifying breakpoint because the new attributes are going
to be copied only once we successfully modified the breakpoint slot.
This will fix the current misdesigned layout where the new attr are
copied to the modifying breakpoint before we actually know if the
modification will be validated.
In order to prepare for that, allow modify_breakpoint_slot() to take
the new breakpoint type.
Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: Chris Zankel <chris@...kel.net>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Joel Fernandes <joel.opensrc@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Mark Rutland <mark.rutland@....com>
Cc: Max Filippov <jcmvbkbc@...il.com>
Cc: Michael Ellerman <mpe@...erman.id.au>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Rich Felker <dalias@...c.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Will Deacon <will.deacon@....com>
Cc: Yoshinori Sato <ysato@...rs.sourceforge.jp>
Link: http://lkml.kernel.org/r/1529981939-8231-12-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
kernel/events/hw_breakpoint.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index e7bc8d0a5972..71387703b5f1 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -345,13 +345,13 @@ void release_bp_slot(struct perf_event *bp)
mutex_unlock(&nr_bp_mutex);
}
-static int __modify_bp_slot(struct perf_event *bp, u64 old_type)
+static int __modify_bp_slot(struct perf_event *bp, u64 old_type, u64 new_type)
{
int err;
__release_bp_slot(bp, old_type);
- err = __reserve_bp_slot(bp, bp->attr.bp_type);
+ err = __reserve_bp_slot(bp, new_type);
if (err) {
/*
* Reserve the old_type slot back in case
@@ -367,12 +367,12 @@ static int __modify_bp_slot(struct perf_event *bp, u64 old_type)
return err;
}
-static int modify_bp_slot(struct perf_event *bp, u64 old_type)
+static int modify_bp_slot(struct perf_event *bp, u64 old_type, u64 new_type)
{
int ret;
mutex_lock(&nr_bp_mutex);
- ret = __modify_bp_slot(bp, old_type);
+ ret = __modify_bp_slot(bp, old_type, new_type);
mutex_unlock(&nr_bp_mutex);
return ret;
}
@@ -481,7 +481,7 @@ modify_user_hw_breakpoint_check(struct perf_event *bp, struct perf_event_attr *a
err = hw_breakpoint_parse(bp, attr, &hw);
if (!err && modify)
- err = modify_bp_slot(bp, old_type);
+ err = modify_bp_slot(bp, old_type, bp->attr.bp_type);
if (err) {
bp->attr.bp_addr = old_addr;
Powered by blists - more mailing lists