evtype[n] = group->hw.event_base;
current_idx[n++] = PMC_NO_INDEX;
}
- list_for_each_entry(pe, &group->sibling_list, sibling_list) {
+ for_each_sibling_event(pe, group) {
if (!is_software_event(pe) && pe->state != PERF_EVENT_STATE_OFF) {
if (n >= max_count)
return -1;
return false;
}
- list_for_each_entry(sibling, &leader->sibling_list, sibling_list) {
+ for_each_sibling_event(sibling, leader) {
if (!mmdc_pmu_group_event_is_valid(sibling, pmu, &counter_mask))
return false;
}
else if (!is_software_event(leader))
return false;
- list_for_each_entry(sibling, &leader->sibling_list, sibling_list) {
+ for_each_sibling_event(sibling, leader) {
if (sibling->pmu == pmu)
num_hw++;
else if (!is_software_event(sibling))
if (mipsxx_pmu_alloc_counter(&fake_cpuc, &leader->hw) < 0)
return -EINVAL;
- list_for_each_entry(sibling, &leader->sibling_list, sibling_list) {
+ for_each_sibling_event(sibling, leader) {
if (mipsxx_pmu_alloc_counter(&fake_cpuc, &sibling->hw) < 0)
return -EINVAL;
}
flags[n] = group->hw.event_base;
events[n++] = group->hw.config;
}
- list_for_each_entry(event, &group->sibling_list, sibling_list) {
+ for_each_sibling_event(event, group) {
if (event->pmu->task_ctx_nr == perf_hw_context &&
event->state != PERF_EVENT_STATE_OFF) {
if (n >= max_count)
ctrs[n] = group;
n++;
}
- list_for_each_entry(event, &group->sibling_list, sibling_list) {
+ for_each_sibling_event(event, group) {
if (!is_software_event(event) &&
event->state != PERF_EVENT_STATE_OFF) {
if (n >= max_count)
events[n] = group->hw.event_base;
current_idx[n++] = PIC_NO_INDEX;
}
- list_for_each_entry(event, &group->sibling_list, sibling_list) {
+ for_each_sibling_event(event, group) {
if (!is_software_event(event) &&
event->state != PERF_EVENT_STATE_OFF) {
if (n >= max_count)
if (!dogrp)
return n;
- list_for_each_entry(event, &leader->sibling_list, sibling_list) {
+ for_each_sibling_event(event, leader) {
if (!is_x86_event(event) ||
event->state <= PERF_EVENT_STATE_OFF)
continue;
if (!dogrp)
return n;
- list_for_each_entry(event, &leader->sibling_list, sibling_list) {
+ for_each_sibling_event(event, leader) {
if (!is_box_event(box, event) ||
event->state <= PERF_EVENT_STATE_OFF)
continue;
if (!validate_event(event->pmu, &fake_pmu, leader))
return -EINVAL;
- list_for_each_entry(sibling, &leader->sibling_list, sibling_list) {
+ for_each_sibling_event(sibling, leader) {
if (!validate_event(event->pmu, &fake_pmu, sibling))
return -EINVAL;
}
!is_software_event(event->group_leader))
return -EINVAL;
- list_for_each_entry(sibling, &event->group_leader->sibling_list,
- sibling_list)
+ for_each_sibling_event(sibling, event->group_leader) {
if (sibling->pmu != event->pmu &&
!is_software_event(sibling))
return -EINVAL;
+ }
return 0;
}
memset(fake_hw.used_mask, 0, sizeof(fake_hw.used_mask));
if (!dsu_pmu_validate_event(event->pmu, &fake_hw, leader))
return false;
- list_for_each_entry(sibling, &leader->sibling_list, sibling_list) {
+ for_each_sibling_event(sibling, leader) {
if (!dsu_pmu_validate_event(event->pmu, &fake_hw, sibling))
return false;
}
if (!validate_event(event->pmu, &fake_pmu, leader))
return -EINVAL;
- list_for_each_entry(sibling, &leader->sibling_list, sibling_list) {
+ for_each_sibling_event(sibling, leader) {
if (!validate_event(event->pmu, &fake_pmu, sibling))
return -EINVAL;
}
counters++;
}
- list_for_each_entry(sibling, &event->group_leader->sibling_list, sibling_list) {
+ for_each_sibling_event(sibling, event->group_leader) {
if (is_software_event(sibling))
continue;
if (sibling->pmu != event->pmu)
return -EINVAL;
}
- list_for_each_entry(sibling, &event->group_leader->sibling_list,
- sibling_list)
+ for_each_sibling_event(sibling, event->group_leader) {
if (sibling->pmu != event->pmu &&
!is_software_event(sibling)) {
dev_dbg_ratelimited(&l2cache_pmu->pdev->dev,
return -EINVAL;
}
- list_for_each_entry(sibling, &event->group_leader->sibling_list,
- sibling_list) {
+ for_each_sibling_event(sibling, event->group_leader) {
if ((sibling != event) &&
!is_software_event(sibling) &&
(L2_EVT_GROUP(sibling->attr.config) ==
counters = event_num_counters(event);
counters += event_num_counters(leader);
- list_for_each_entry(sibling, &leader->sibling_list, sibling_list) {
+ for_each_sibling_event(sibling, leader) {
if (is_software_event(sibling))
continue;
if (sibling->pmu != event->pmu)
!is_software_event(event->group_leader))
return -EINVAL;
- list_for_each_entry(sibling, &event->group_leader->sibling_list,
- sibling_list)
+ for_each_sibling_event(sibling, event->group_leader) {
if (sibling->pmu != event->pmu &&
!is_software_event(sibling))
return -EINVAL;
+ }
return 0;
}
struct list_head list;
};
+#define for_each_sibling_event(sibling, event) \
+ if ((event)->group_leader == (event)) \
+ list_for_each_entry((sibling), &(event)->sibling_list, sibling_list)
+
/**
* struct perf_event - performance event kernel representation:
*/
{
struct perf_event *sibling;
- list_for_each_entry(sibling, &leader->sibling_list, sibling_list)
+ for_each_sibling_event(sibling, leader)
perf_event_update_time(sibling);
}
perf_event__header_size(group_leader);
- list_for_each_entry(pos, &group_leader->sibling_list, sibling_list)
+ for_each_sibling_event(pos, group_leader)
perf_event__header_size(pos);
}
out:
perf_event__header_size(event->group_leader);
- list_for_each_entry(tmp, &event->group_leader->sibling_list, sibling_list)
+ for_each_sibling_event(tmp, event->group_leader)
perf_event__header_size(tmp);
}
*/
static inline int pmu_filter_match(struct perf_event *event)
{
- struct perf_event *child;
+ struct perf_event *sibling;
if (!__pmu_filter_match(event))
return 0;
- list_for_each_entry(child, &event->sibling_list, sibling_list) {
- if (!__pmu_filter_match(child))
+ for_each_sibling_event(sibling, event) {
+ if (!__pmu_filter_match(sibling))
return 0;
}
/*
* Schedule out siblings (if any):
*/
- list_for_each_entry(event, &group_event->sibling_list, sibling_list)
+ for_each_sibling_event(event, group_event)
event_sched_out(event, cpuctx, ctx);
perf_pmu_enable(ctx->pmu);
/*
* Schedule in siblings as one group (if any):
*/
- list_for_each_entry(event, &group_event->sibling_list, sibling_list) {
+ for_each_sibling_event(event, group_event) {
if (event_sched_in(event, cpuctx, ctx)) {
partial_group = event;
goto group_error;
* partial group before returning:
* The events up to the failed event are scheduled out normally.
*/
- list_for_each_entry(event, &group_event->sibling_list, sibling_list) {
+ for_each_sibling_event(event, group_event) {
if (event == partial_group)
break;
pmu->read(event);
- list_for_each_entry(sub, &event->sibling_list, sibling_list) {
+ for_each_sibling_event(sub, event) {
if (sub->state == PERF_EVENT_STATE_ACTIVE) {
/*
* Use sibling's PMU rather than @event's since
if (read_format & PERF_FORMAT_ID)
values[n++] = primary_event_id(leader);
- list_for_each_entry(sub, &leader->sibling_list, sibling_list) {
+ for_each_sibling_event(sub, leader) {
values[n++] += perf_event_count(sub);
if (read_format & PERF_FORMAT_ID)
values[n++] = primary_event_id(sub);
event = event->group_leader;
perf_event_for_each_child(event, func);
- list_for_each_entry(sibling, &event->sibling_list, sibling_list)
+ for_each_sibling_event(sibling, event)
perf_event_for_each_child(sibling, func);
}
__output_copy(handle, values, n * sizeof(u64));
- list_for_each_entry(sub, &leader->sibling_list, sibling_list) {
+ for_each_sibling_event(sub, leader) {
n = 0;
if ((sub != event) &&
perf_remove_from_context(group_leader, 0);
put_ctx(gctx);
- list_for_each_entry(sibling, &group_leader->sibling_list,
- sibling_list) {
+ for_each_sibling_event(sibling, group_leader) {
perf_remove_from_context(sibling, 0);
put_ctx(gctx);
}
* By installing siblings first we NO-OP because they're not
* reachable through the group lists.
*/
- list_for_each_entry(sibling, &group_leader->sibling_list,
- sibling_list) {
+ for_each_sibling_event(sibling, group_leader) {
perf_event__state_init(sibling);
perf_install_in_context(ctx, sibling, sibling->cpu);
get_ctx(ctx);
* case inherit_event() will create individual events, similar to what
* perf_group_detach() would do anyway.
*/
- list_for_each_entry(sub, &parent_event->sibling_list, sibling_list) {
+ for_each_sibling_event(sub, parent_event) {
child_ctr = inherit_event(sub, parent, parent_ctx,
child, leader, child_ctx);
if (IS_ERR(child_ctr))