]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
perf/hw_breakpoint: Enable breakpoint in modify_user_hw_breakpoint
authorJiri Olsa <jolsa@kernel.org>
Mon, 27 Aug 2018 09:12:27 +0000 (11:12 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 30 Aug 2018 17:49:23 +0000 (14:49 -0300)
Currently we enable the breakpoint back only if the breakpoint
modification was successful. If it fails we can leave the breakpoint in
disabled state with attr->disabled == 0.

We can safely enable the breakpoint back for both the fail and success
paths by checking the bp->attr.disabled, which either holds the new
'requested' disabled state or the original breakpoint state.

Suggested-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Frederic Weisbecker <frederic@kernel.org>
Acked-by: Oleg Nesterov <oleg@redhat.com>
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-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
kernel/events/hw_breakpoint.c

index 3e560d7609fd23274e66c73b442df1d4195bf025..d6b56180827c73f29fa21eef238c73c1a01540ad 100644 (file)
@@ -523,13 +523,11 @@ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *att
                perf_event_disable(bp);
 
        err = modify_user_hw_breakpoint_check(bp, attr, false);
-       if (err)
-               return err;
 
-       if (!attr->disabled)
+       if (!bp->attr.disabled)
                perf_event_enable(bp);
 
-       return 0;
+       return err;
 }
 EXPORT_SYMBOL_GPL(modify_user_hw_breakpoint);