Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions arch/alpha/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ static int collect_events(struct perf_event *group, int max_count,
current_idx[n++] = PMC_NO_INDEX;
}
for_each_sibling_event(pe, group) {
if (!is_software_event(pe) && pe->state != PERF_EVENT_STATE_OFF) {
if (!is_software_event(pe)) {
if (n >= max_count)
return -1;
event[n] = pe;
Expand Down Expand Up @@ -761,7 +761,8 @@ static struct pmu pmu = {
.start = alpha_pmu_start,
.stop = alpha_pmu_stop,
.read = alpha_pmu_read,
.capabilities = PERF_PMU_CAP_NO_EXCLUDE,
.capabilities = PERF_PMU_CAP_SAMPLING |
PERF_PMU_CAP_NO_EXCLUDE,
};


Expand Down
4 changes: 2 additions & 2 deletions arch/arc/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,8 @@ static int arc_pmu_device_probe(struct platform_device *pdev)

}

if (irq == -1)
arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
if (irq != -1)
arc_pmu->pmu.capabilities |= PERF_PMU_CAP_SAMPLING;

/*
* perf parser doesn't really like '-' symbol in events name, so let's
Expand Down
29 changes: 6 additions & 23 deletions arch/arm/mach-imx/mmdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,8 @@ static bool mmdc_pmu_group_event_is_valid(struct perf_event *event,
{
int cfg = event->attr.config;

if (is_software_event(event))
return true;

if (event->pmu != pmu)
return false;
return true;

return !test_and_set_bit(cfg, used_counters);
}
Expand All @@ -260,12 +257,12 @@ static bool mmdc_pmu_group_is_valid(struct perf_event *event)
struct perf_event *sibling;
unsigned long counter_mask = 0;

set_bit(leader->attr.config, &counter_mask);
if (event == leader)
return true;

if (event != leader) {
if (!mmdc_pmu_group_event_is_valid(event, pmu, &counter_mask))
return false;
}
set_bit(event->attr.config, &counter_mask);
if (!mmdc_pmu_group_event_is_valid(leader, pmu, &counter_mask))
return false;

for_each_sibling_event(sibling, leader) {
if (!mmdc_pmu_group_event_is_valid(sibling, pmu, &counter_mask))
Expand All @@ -280,20 +277,6 @@ static int mmdc_pmu_event_init(struct perf_event *event)
struct mmdc_pmu *pmu_mmdc = to_mmdc_pmu(event->pmu);
int cfg = event->attr.config;

if (event->attr.type != event->pmu->type)
return -ENOENT;

if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
return -EOPNOTSUPP;

if (event->cpu < 0) {
dev_warn(pmu_mmdc->dev, "Can't provide per-task data!\n");
return -EOPNOTSUPP;
}

if (event->attr.sample_period)
return -EINVAL;

if (cfg < 0 || cfg >= MMDC_NUM_COUNTERS)
return -EINVAL;

Expand Down
19 changes: 4 additions & 15 deletions arch/arm/mm/cache-l2x0-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,17 @@ static bool l2x0_pmu_group_is_valid(struct perf_event *event)
struct pmu *pmu = event->pmu;
struct perf_event *leader = event->group_leader;
struct perf_event *sibling;
int num_hw = 0;
int num_hw = 1;

if (leader == event)
return true;

if (leader->pmu == pmu)
num_hw++;
else if (!is_software_event(leader))
return false;

for_each_sibling_event(sibling, leader) {
if (sibling->pmu == pmu)
num_hw++;
else if (!is_software_event(sibling))
return false;
}

return num_hw <= PMU_NR_COUNTERS;
Expand All @@ -295,16 +294,6 @@ static int l2x0_pmu_event_init(struct perf_event *event)
{
struct hw_perf_event *hw = &event->hw;

if (event->attr.type != l2x0_pmu->type)
return -ENOENT;

if (is_sampling_event(event) ||
event->attach_state & PERF_ATTACH_TASK)
return -EINVAL;

if (event->cpu < 0)
return -EINVAL;

if (event->attr.config & ~L2X0_EVENT_CNT_CFG_SRC_MASK)
return -EINVAL;

Expand Down
3 changes: 2 additions & 1 deletion arch/csky/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,7 @@ int init_hw_perf_events(void)
}

csky_pmu.pmu = (struct pmu) {
.capabilities = PERF_PMU_CAP_SAMPLING,
.pmu_enable = csky_pmu_enable,
.pmu_disable = csky_pmu_disable,
.event_init = csky_pmu_event_init,
Expand Down Expand Up @@ -1314,7 +1315,7 @@ int csky_pmu_device_probe(struct platform_device *pdev,

ret = csky_pmu_request_irq(csky_pmu_handle_irq);
if (ret) {
csky_pmu.pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
csky_pmu.pmu.capabilities &= ~PERF_PMU_CAP_SAMPLING;
pr_notice("[perf] PMU request irq fail!\n");
}

Expand Down
1 change: 1 addition & 0 deletions arch/loongarch/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ static int loongarch_pmu_event_init(struct perf_event *event)
}

static struct pmu pmu = {
.capabilities = PERF_PMU_CAP_SAMPLING,
.pmu_enable = loongarch_pmu_enable,
.pmu_disable = loongarch_pmu_disable,
.event_init = loongarch_pmu_event_init,
Expand Down
1 change: 1 addition & 0 deletions arch/mips/kernel/perf_event_mipsxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ static int mipspmu_event_init(struct perf_event *event)
}

static struct pmu pmu = {
.capabilities = PERF_PMU_CAP_SAMPLING,
.pmu_enable = mipspmu_enable,
.pmu_disable = mipspmu_disable,
.event_init = mipspmu_event_init,
Expand Down
3 changes: 1 addition & 2 deletions arch/powerpc/perf/8xx-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ static struct pmu mpc8xx_pmu = {
.add = mpc8xx_pmu_add,
.del = mpc8xx_pmu_del,
.read = mpc8xx_pmu_read,
.capabilities = PERF_PMU_CAP_NO_INTERRUPT |
PERF_PMU_CAP_NO_NMI,
.capabilities = PERF_PMU_CAP_NO_NMI,
};

static int init_mpc8xx_pmu(void)
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/perf/core-book3s.c
Original file line number Diff line number Diff line change
Expand Up @@ -1602,8 +1602,7 @@ static int collect_events(struct perf_event *group, int max_count,
events[n++] = group->hw.config;
}
for_each_sibling_event(event, group) {
if (event->pmu->task_ctx_nr == perf_hw_context &&
event->state != PERF_EVENT_STATE_OFF) {
if (event->pmu->task_ctx_nr == perf_hw_context) {
if (n >= max_count)
return -1;
ctrs[n] = event;
Expand Down Expand Up @@ -2208,6 +2207,7 @@ ssize_t power_events_sysfs_show(struct device *dev,
}

static struct pmu power_pmu = {
.capabilities = PERF_PMU_CAP_SAMPLING,
.pmu_enable = power_pmu_enable,
.pmu_disable = power_pmu_disable,
.event_init = power_pmu_event_init,
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/perf/core-fsl-emb.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ static int collect_events(struct perf_event *group, int max_count,
n++;
}
for_each_sibling_event(event, group) {
if (!is_software_event(event) &&
event->state != PERF_EVENT_STATE_OFF) {
if (!is_software_event(event)) {
if (n >= max_count)
return -1;
ctrs[n] = event;
Expand Down Expand Up @@ -571,6 +570,7 @@ static int fsl_emb_pmu_event_init(struct perf_event *event)
}

static struct pmu fsl_emb_pmu = {
.capabilities = PERF_PMU_CAP_SAMPLING,
.pmu_enable = fsl_emb_pmu_enable,
.pmu_disable = fsl_emb_pmu_disable,
.event_init = fsl_emb_pmu_event_init,
Expand Down
11 changes: 0 additions & 11 deletions arch/powerpc/perf/hv-24x7.c
Original file line number Diff line number Diff line change
Expand Up @@ -1379,10 +1379,6 @@ static int h_24x7_event_init(struct perf_event *event)
unsigned long hret;
u64 ct;

/* Not our event */
if (event->attr.type != event->pmu->type)
return -ENOENT;

/* Unused areas must be 0 */
if (event_get_reserved1(event) ||
event_get_reserved2(event) ||
Expand All @@ -1397,10 +1393,6 @@ static int h_24x7_event_init(struct perf_event *event)
return -EINVAL;
}

/* no branch sampling */
if (has_branch_stack(event))
return -EOPNOTSUPP;

/* offset must be 8 byte aligned */
if (event_get_offset(event) % 8) {
pr_devel("bad alignment\n");
Expand Down Expand Up @@ -1726,9 +1718,6 @@ static int hv_24x7_init(void)
if (!hv_page_cache)
return -ENOMEM;

/* sampling not supported */
h_24x7_pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;

r = create_events_from_catalog(&event_group.attrs,
&event_desc_group.attrs,
&event_long_desc_group.attrs);
Expand Down
11 changes: 0 additions & 11 deletions arch/powerpc/perf/hv-gpci.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,20 +775,12 @@ static int h_gpci_event_init(struct perf_event *event)
u8 length;
unsigned long ret;

/* Not our event */
if (event->attr.type != event->pmu->type)
return -ENOENT;

/* config2 is unused */
if (event->attr.config2) {
pr_devel("config2 set when reserved\n");
return -EINVAL;
}

/* no branch sampling */
if (has_branch_stack(event))
return -EOPNOTSUPP;

length = event_get_length(event);
if (length < 1 || length > 8) {
pr_devel("length invalid\n");
Expand Down Expand Up @@ -1008,9 +1000,6 @@ static int hv_gpci_init(void)
if (r)
return r;

/* sampling not supported */
h_gpci_pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;

arg = (void *)get_cpu_var(hv_gpci_reqb);
memset(arg, 0, HGPCI_REQ_BUFFER_SIZE);

Expand Down
31 changes: 1 addition & 30 deletions arch/powerpc/perf/imc-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,16 +517,6 @@ static int nest_imc_event_init(struct perf_event *event)
struct imc_pmu_ref *ref;
bool flag = false;

if (event->attr.type != event->pmu->type)
return -ENOENT;

/* Sampling not supported */
if (event->hw.sample_period)
return -EINVAL;

if (event->cpu < 0)
return -EINVAL;

pmu = imc_event_to_pmu(event);

/* Sanity check for config (event offset) */
Expand Down Expand Up @@ -819,16 +809,6 @@ static int core_imc_event_init(struct perf_event *event)
struct imc_pmu *pmu;
struct imc_pmu_ref *ref;

if (event->attr.type != event->pmu->type)
return -ENOENT;

/* Sampling not supported */
if (event->hw.sample_period)
return -EINVAL;

if (event->cpu < 0)
return -EINVAL;

event->hw.idx = -1;
pmu = imc_event_to_pmu(event);

Expand Down Expand Up @@ -983,16 +963,9 @@ static int thread_imc_event_init(struct perf_event *event)
struct task_struct *target;
struct imc_pmu *pmu;

if (event->attr.type != event->pmu->type)
return -ENOENT;

if (!perfmon_capable())
return -EACCES;

/* Sampling not supported */
if (event->hw.sample_period)
return -EINVAL;

event->hw.idx = -1;
pmu = imc_event_to_pmu(event);

Expand Down Expand Up @@ -1436,9 +1409,6 @@ static void trace_imc_event_del(struct perf_event *event, int flags)

static int trace_imc_event_init(struct perf_event *event)
{
if (event->attr.type != event->pmu->type)
return -ENOENT;

if (!perfmon_capable())
return -EACCES;

Expand Down Expand Up @@ -1507,6 +1477,7 @@ static int update_pmu_ops(struct imc_pmu *pmu)
pmu->pmu.commit_txn = thread_imc_pmu_commit_txn;
break;
case IMC_DOMAIN_TRACE:
pmu->pmu.capabilities |= PERF_PMU_CAP_SAMPLING;
pmu->pmu.event_init = trace_imc_event_init;
pmu->pmu.add = trace_imc_event_add;
pmu->pmu.del = trace_imc_event_del;
Expand Down
5 changes: 1 addition & 4 deletions arch/powerpc/perf/kvm-hv-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ static int kvmppc_pmu_event_init(struct perf_event *event)
__func__, event, event->id, event->cpu,
event->oncpu, config);

if (event->attr.type != event->pmu->type)
return -ENOENT;

if (config >= KVMPPC_EVENT_MAX)
return -EINVAL;

Expand Down Expand Up @@ -391,7 +388,7 @@ static struct pmu kvmppc_pmu = {
.attr_groups = kvmppc_pmu_attr_groups,
.type = -1,
.scope = PERF_PMU_SCOPE_SYS_WIDE,
.capabilities = PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_INTERRUPT,
.capabilities = PERF_PMU_CAP_NO_EXCLUDE,
};

static int __init kvmppc_register_pmu(void)
Expand Down
13 changes: 1 addition & 12 deletions arch/powerpc/perf/vpa-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@ static const struct attribute_group *vpa_pmu_attr_groups[] = {

static int vpa_pmu_event_init(struct perf_event *event)
{
if (event->attr.type != event->pmu->type)
return -ENOENT;

/* it does not support event sampling mode */
if (is_sampling_event(event))
return -EOPNOTSUPP;

/* no branch sampling */
if (has_branch_stack(event))
return -EOPNOTSUPP;

/* Invalid event code */
if ((event->attr.config <= 0) || (event->attr.config > 3))
return -EINVAL;
Expand Down Expand Up @@ -164,7 +153,7 @@ static struct pmu vpa_pmu = {
.del = vpa_pmu_del,
.read = vpa_pmu_read,
.attr_groups = vpa_pmu_attr_groups,
.capabilities = PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_INTERRUPT,
.capabilities = PERF_PMU_CAP_NO_EXCLUDE,
};

static int __init pseries_vpa_pmu_init(void)
Expand Down
Loading
Loading