diff options
author | Tejun Heo <tj@kernel.org> | 2010-02-16 20:50:50 -0500 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2010-02-27 10:23:39 -0500 |
commit | 44ee63587dce85593c22497140db16f4e5027860 (patch) | |
tree | 0b3d45f9755080f1c7362a8a2eb69e326b0e2f85 /samples | |
parent | 018cbffe6819f6f8db20a0a3acd9bab9bfd667e4 (diff) |
percpu: Add __percpu sparse annotations to hw_breakpoint
Add __percpu sparse annotations to hw_breakpoint.
These annotations are to make sparse consider percpu variables to be
in a different address space and warn if accessed without going
through percpu accessors. This patch doesn't affect normal builds.
In kernel/hw_breakpoint.c, per_cpu(nr_task_bp_pinned, cpu)'s will
trigger spurious noderef related warnings from sparse. Changing it to
&per_cpu(nr_task_bp_pinned[0], cpu) will work around the problem but
deemed to ugly by the maintainer. Leave it alone until better
solution can be found.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
LKML-Reference: <4B7B4B7A.9050902@kernel.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/hw_breakpoint/data_breakpoint.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/samples/hw_breakpoint/data_breakpoint.c b/samples/hw_breakpoint/data_breakpoint.c index c69cbe9b2426..bd0f337afcab 100644 --- a/samples/hw_breakpoint/data_breakpoint.c +++ b/samples/hw_breakpoint/data_breakpoint.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/perf_event.h> | 34 | #include <linux/perf_event.h> |
35 | #include <linux/hw_breakpoint.h> | 35 | #include <linux/hw_breakpoint.h> |
36 | 36 | ||
37 | struct perf_event **sample_hbp; | 37 | struct perf_event * __percpu *sample_hbp; |
38 | 38 | ||
39 | static char ksym_name[KSYM_NAME_LEN] = "pid_max"; | 39 | static char ksym_name[KSYM_NAME_LEN] = "pid_max"; |
40 | module_param_string(ksym, ksym_name, KSYM_NAME_LEN, S_IRUGO); | 40 | module_param_string(ksym, ksym_name, KSYM_NAME_LEN, S_IRUGO); |
@@ -61,8 +61,8 @@ static int __init hw_break_module_init(void) | |||
61 | attr.bp_type = HW_BREAKPOINT_W | HW_BREAKPOINT_R; | 61 | attr.bp_type = HW_BREAKPOINT_W | HW_BREAKPOINT_R; |
62 | 62 | ||
63 | sample_hbp = register_wide_hw_breakpoint(&attr, sample_hbp_handler); | 63 | sample_hbp = register_wide_hw_breakpoint(&attr, sample_hbp_handler); |
64 | if (IS_ERR(sample_hbp)) { | 64 | if (IS_ERR((void __force *)sample_hbp)) { |
65 | ret = PTR_ERR(sample_hbp); | 65 | ret = PTR_ERR((void __force *)sample_hbp); |
66 | goto fail; | 66 | goto fail; |
67 | } | 67 | } |
68 | 68 | ||