Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1230263
| From | Alexander Shishkin <alexander.shishkin@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH 14/20] coresight: etm-perf: implementing 'event_init()' API |
| Date | 2015-09-22 16:30 +0200 |
| Message-ID | <qbwJY-7Vf-27@gated-at.bofh.it> (permalink) |
| References | <qa6HT-7Th-15@gated-at.bofh.it> <qa6HU-7Th-41@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Mathieu Poirier <mathieu.poirier@linaro.org> writes:
> +static void etm_event_destroy(struct perf_event *event)
> +{
> + /* switching off the source will also tear down the path */
> + etm_event_power_sources(event->cpu, false);
> +}
> +
> +static int etm_event_init(struct perf_event *event)
> +{
> + int ret;
> +
> + if (event->attr.type != etm_pmu.type)
> + return -ENOENT;
> +
> + if (event->cpu >= nr_cpu_ids)
> + return -EINVAL;
> +
> + /* only one session at a time */
> + if (etm_event_source_enabled(event->cpu))
> + return -EBUSY;
Why is this the case? If you were to configure the event in pmu::add()
and deconfigure it in pmu::del(), like you already do with the buffer
part, you could handle as many sessions as you want.
> +
> + /*
> + * Make sure CPUs don't disappear between the
> + * power up sequence and configuration.
> + */
> + get_online_cpus();
> + ret = etm_event_power_sources(event->cpu, true);
> + if (ret)
> + goto out;
> +
> + ret = etm_event_config_sources(event->cpu);
This can be done in pmu::add(), if you can call directly into
etm_configure_cpu() or etm_config_enable() so that there's no cross-cpu
calling in between.
> +
> + event->destroy = etm_event_destroy;
> +out:
> + put_online_cpus();
> + return ret;
> +}
> +
> static int __init etm_perf_init(void)
> {
> etm_pmu.capabilities = PERF_PMU_CAP_EXCLUSIVE;
> @@ -59,6 +234,7 @@ static int __init etm_perf_init(void)
> etm_pmu.attr_groups = etm_pmu_attr_groups;
> etm_pmu.task_ctx_nr = perf_sw_context;
> etm_pmu.read = etm_event_read;
> + etm_pmu.event_init = etm_event_init;
>
> return perf_pmu_register(&etm_pmu, CORESIGHT_ETM_PMU_NAME, -1);
> }
One general comment -- it would be slightly easier at least for me if
all the pmu related bits were in one patch.
Thanks,
--
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 14/20] coresight: etm-perf: implementing 'event_init()' API Mathieu Poirier <mathieu.poirier@linaro.org> - 2015-09-18 18:30 +0200
Re: [RFC PATCH 14/20] coresight: etm-perf: implementing 'event_init()' API Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-09-22 16:30 +0200
Re: [RFC PATCH 14/20] coresight: etm-perf: implementing 'event_init()' API Mathieu Poirier <mathieu.poirier@linaro.org> - 2015-09-28 23:30 +0200
Re: [RFC PATCH 14/20] coresight: etm-perf: implementing 'event_init()' API Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-09-30 11:50 +0200
Re: [RFC PATCH 14/20] coresight: etm-perf: implementing 'event_init()' API Mathieu Poirier <mathieu.poirier@linaro.org> - 2015-10-02 19:00 +0200
csiph-web