Skip to content

Commit

Permalink
hw_breakpoint: Pass bp_type directly as find_slot_idx() argument
Browse files Browse the repository at this point in the history
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: Jiri Olsa <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Hari Bathini <[email protected]>
Cc: Jin Yao <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Milind Chabbi <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Sukadev Bhattiprolu <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Will Deacon <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
olsajiri authored and Ingo Molnar committed Mar 13, 2018
1 parent 33801b9 commit cbd9d9f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions kernel/events/hw_breakpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ __weak int hw_breakpoint_weight(struct perf_event *bp)
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_INST;
Expand Down Expand Up @@ -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) {
if (iter->hw.target == tsk &&
find_slot_idx(iter) == type &&
find_slot_idx(iter->attr.bp_type) == type &&
(iter->cpu < 0 || cpu == iter->cpu))
count += hw_breakpoint_weight(iter);
}
Expand Down Expand Up @@ -292,7 +292,7 @@ static int __reserve_bp_slot(struct perf_event *bp)
bp->attr.bp_type == HW_BREAKPOINT_INVALID)
return -EINVAL;

type = find_slot_idx(bp);
type = find_slot_idx(bp->attr.bp_type);
weight = hw_breakpoint_weight(bp);

fetch_bp_busy_slots(&slots, bp, type);
Expand Down Expand Up @@ -329,7 +329,7 @@ static void __release_bp_slot(struct perf_event *bp)
enum bp_type_idx type;
int weight;

type = find_slot_idx(bp);
type = find_slot_idx(bp->attr.bp_type);
weight = hw_breakpoint_weight(bp);
toggle_bp_slot(bp, false, type, weight);
}
Expand Down

0 comments on commit cbd9d9f

Please sign in to comment.