Commit cbd9d9f1 authored by Jiri Olsa's avatar Jiri Olsa Committed by Ingo Molnar

hw_breakpoint: Pass bp_type directly as find_slot_idx() argument

Pass bp_type directly as a find_slot_idx() argument,
so we don't need to have whole event to get the
breakpoint slot type. It will be used in following
changes.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Hari Bathini <hbathini@linux.vnet.ibm.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Milind Chabbi <chabbi.milind@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Oleg Nesterov <onestero@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Link: http://lkml.kernel.org/r/20180312134548.31532-2-jolsa@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 33801b94
...@@ -85,9 +85,9 @@ __weak int hw_breakpoint_weight(struct perf_event *bp) ...@@ -85,9 +85,9 @@ __weak int hw_breakpoint_weight(struct perf_event *bp)
return 1; return 1;
} }
static inline enum bp_type_idx find_slot_idx(struct perf_event *bp) static inline enum bp_type_idx find_slot_idx(u64 bp_type)
{ {
if (bp->attr.bp_type & HW_BREAKPOINT_RW) if (bp_type & HW_BREAKPOINT_RW)
return TYPE_DATA; return TYPE_DATA;
return TYPE_INST; return TYPE_INST;
...@@ -122,7 +122,7 @@ static int task_bp_pinned(int cpu, struct perf_event *bp, enum bp_type_idx type) ...@@ -122,7 +122,7 @@ static int task_bp_pinned(int cpu, struct perf_event *bp, enum bp_type_idx type)
list_for_each_entry(iter, &bp_task_head, hw.bp_list) { list_for_each_entry(iter, &bp_task_head, hw.bp_list) {
if (iter->hw.target == tsk && if (iter->hw.target == tsk &&
find_slot_idx(iter) == type && find_slot_idx(iter->attr.bp_type) == type &&
(iter->cpu < 0 || cpu == iter->cpu)) (iter->cpu < 0 || cpu == iter->cpu))
count += hw_breakpoint_weight(iter); count += hw_breakpoint_weight(iter);
} }
...@@ -292,7 +292,7 @@ static int __reserve_bp_slot(struct perf_event *bp) ...@@ -292,7 +292,7 @@ static int __reserve_bp_slot(struct perf_event *bp)
bp->attr.bp_type == HW_BREAKPOINT_INVALID) bp->attr.bp_type == HW_BREAKPOINT_INVALID)
return -EINVAL; return -EINVAL;
type = find_slot_idx(bp); type = find_slot_idx(bp->attr.bp_type);
weight = hw_breakpoint_weight(bp); weight = hw_breakpoint_weight(bp);
fetch_bp_busy_slots(&slots, bp, type); fetch_bp_busy_slots(&slots, bp, type);
...@@ -329,7 +329,7 @@ static void __release_bp_slot(struct perf_event *bp) ...@@ -329,7 +329,7 @@ static void __release_bp_slot(struct perf_event *bp)
enum bp_type_idx type; enum bp_type_idx type;
int weight; int weight;
type = find_slot_idx(bp); type = find_slot_idx(bp->attr.bp_type);
weight = hw_breakpoint_weight(bp); weight = hw_breakpoint_weight(bp);
toggle_bp_slot(bp, false, type, weight); toggle_bp_slot(bp, false, type, weight);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment