aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2018-08-27 05:12:27 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-08-30 13:49:23 -0400
commit969558371bf926258241727ebb994f516f2e6f61 (patch)
tree7471dca1cfa209eb41989054b121ce940d8b92b5
parentcb45302d7c5e20f0c0598cdbd7753fa44daceb2a (diff)
perf/hw_breakpoint: Enable breakpoint in modify_user_hw_breakpoint
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>
-rw-r--r--kernel/events/hw_breakpoint.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index 3e560d7609fd..d6b56180827c 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -523,13 +523,11 @@ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *att
523 perf_event_disable(bp); 523 perf_event_disable(bp);
524 524
525 err = modify_user_hw_breakpoint_check(bp, attr, false); 525 err = modify_user_hw_breakpoint_check(bp, attr, false);
526 if (err)
527 return err;
528 526
529 if (!attr->disabled) 527 if (!bp->attr.disabled)
530 perf_event_enable(bp); 528 perf_event_enable(bp);
531 529
532 return 0; 530 return err;
533} 531}
534EXPORT_SYMBOL_GPL(modify_user_hw_breakpoint); 532EXPORT_SYMBOL_GPL(modify_user_hw_breakpoint);
535 533