]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.18.103/perf-hwbp-simplify-the-perf-hwbp-code-fix-documentation.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 3.18.103 / perf-hwbp-simplify-the-perf-hwbp-code-fix-documentation.patch
CommitLineData
2381c1ce
GKH
1From f67b15037a7a50c57f72e69a6d59941ad90a0f0f Mon Sep 17 00:00:00 2001
2From: Linus Torvalds <torvalds@linux-foundation.org>
3Date: Mon, 26 Mar 2018 15:39:07 -1000
4Subject: perf/hwbp: Simplify the perf-hwbp code, fix documentation
5
6From: Linus Torvalds <torvalds@linux-foundation.org>
7
8commit f67b15037a7a50c57f72e69a6d59941ad90a0f0f upstream.
9
10Annoyingly, modify_user_hw_breakpoint() unnecessarily complicates the
11modification of a breakpoint - simplify it and remove the pointless
12local variables.
13
14Also update the stale Docbook while at it.
15
16Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17Acked-by: Thomas Gleixner <tglx@linutronix.de>
18Cc: <stable@vger.kernel.org>
19Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
20Cc: Andy Lutomirski <luto@kernel.org>
21Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
22Cc: Frederic Weisbecker <fweisbec@gmail.com>
23Cc: Jiri Olsa <jolsa@redhat.com>
24Cc: Peter Zijlstra <peterz@infradead.org>
25Cc: Stephane Eranian <eranian@google.com>
26Cc: Vince Weaver <vincent.weaver@maine.edu>
27Signed-off-by: Ingo Molnar <mingo@kernel.org>
28Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29
30---
31 kernel/events/hw_breakpoint.c | 30 +++++++-----------------------
32 1 file changed, 7 insertions(+), 23 deletions(-)
33
34--- a/kernel/events/hw_breakpoint.c
35+++ b/kernel/events/hw_breakpoint.c
36@@ -427,16 +427,9 @@ EXPORT_SYMBOL_GPL(register_user_hw_break
37 * modify_user_hw_breakpoint - modify a user-space hardware breakpoint
38 * @bp: the breakpoint structure to modify
39 * @attr: new breakpoint attributes
40- * @triggered: callback to trigger when we hit the breakpoint
41- * @tsk: pointer to 'task_struct' of the process to which the address belongs
42 */
43 int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr)
44 {
45- u64 old_addr = bp->attr.bp_addr;
46- u64 old_len = bp->attr.bp_len;
47- int old_type = bp->attr.bp_type;
48- int err = 0;
49-
50 /*
51 * modify_user_hw_breakpoint can be invoked with IRQs disabled and hence it
52 * will not be possible to raise IPIs that invoke __perf_event_disable.
53@@ -451,27 +444,18 @@ int modify_user_hw_breakpoint(struct per
54 bp->attr.bp_addr = attr->bp_addr;
55 bp->attr.bp_type = attr->bp_type;
56 bp->attr.bp_len = attr->bp_len;
57+ bp->attr.disabled = 1;
58
59- if (attr->disabled)
60- goto end;
61-
62- err = validate_hw_breakpoint(bp);
63- if (!err)
64- perf_event_enable(bp);
65+ if (!attr->disabled) {
66+ int err = validate_hw_breakpoint(bp);
67
68- if (err) {
69- bp->attr.bp_addr = old_addr;
70- bp->attr.bp_type = old_type;
71- bp->attr.bp_len = old_len;
72- if (!bp->attr.disabled)
73- perf_event_enable(bp);
74+ if (err)
75+ return err;
76
77- return err;
78+ perf_event_enable(bp);
79+ bp->attr.disabled = 0;
80 }
81
82-end:
83- bp->attr.disabled = attr->disabled;
84-
85 return 0;
86 }
87 EXPORT_SYMBOL_GPL(modify_user_hw_breakpoint);