diff options
author | Jiri Olsa <jolsa@kernel.org> | 2018-08-27 05:12:28 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-08-30 13:49:24 -0400 |
commit | bf06278c3fdf8909c3a9283e2c270b0fc170fa90 (patch) | |
tree | bc30ce6d098a933362a8c8053752e3d910564cd3 /kernel | |
parent | 969558371bf926258241727ebb994f516f2e6f61 (diff) |
perf/hw_breakpoint: Simplify breakpoint enable in perf_event_modify_breakpoint
We can safely enable the breakpoint back for both the fail and success
paths by checking only the bp->attr.disabled, which either holds the new
'requested' disabled state or the original breakpoint state.
Committer testing:
At the end of the series, the 'perf test' entry introduced as the first
patch now runs to completion without finding the fixed issues:
# perf test "bp modify"
62: x86 bp modify : Ok
#
In verbose mode:
# perf test -v "bp modify"
62: x86 bp modify :
--- start ---
test child forked, pid 5161
rip 5950a0, bp_1 0x5950a0
in bp_1
rip 5950a0, bp_1 0x5950a0
in bp_1
test child finished with 0
---- end ----
x86 bp modify: Ok
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Milind Chabbi <chabbi.milind@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180827091228.2878-6-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/events/core.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index f6ea33a9f904..22ede28ec07d 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -2867,16 +2867,11 @@ static int perf_event_modify_breakpoint(struct perf_event *bp, | |||
2867 | _perf_event_disable(bp); | 2867 | _perf_event_disable(bp); |
2868 | 2868 | ||
2869 | err = modify_user_hw_breakpoint_check(bp, attr, true); | 2869 | err = modify_user_hw_breakpoint_check(bp, attr, true); |
2870 | if (err) { | ||
2871 | if (!bp->attr.disabled) | ||
2872 | _perf_event_enable(bp); | ||
2873 | 2870 | ||
2874 | return err; | 2871 | if (!bp->attr.disabled) |
2875 | } | ||
2876 | |||
2877 | if (!attr->disabled) | ||
2878 | _perf_event_enable(bp); | 2872 | _perf_event_enable(bp); |
2879 | return 0; | 2873 | |
2874 | return err; | ||
2880 | } | 2875 | } |
2881 | 2876 | ||
2882 | static int perf_event_modify_attr(struct perf_event *event, | 2877 | static int perf_event_modify_attr(struct perf_event *event, |