Re: [PATCH v8 12/14] x86: perf: intel_pt: Intel PT PMU driver
From: Alexander Shishkin
Date: Mon Jan 12 2015 - 07:53:18 EST
Peter Zijlstra <peterz@xxxxxxxxxxxxx> writes:
> On Fri, Nov 14, 2014 at 03:43:45PM +0200, Alexander Shishkin wrote:
>> +static __init int pt_init(void)
>> +{
>> + int ret, cpu, prior_warn = 0;
>> +
>> + BUILD_BUG_ON(sizeof(struct topa) > PAGE_SIZE);
>> + get_online_cpus();
>> + for_each_online_cpu(cpu) {
>> + u64 ctl;
>> +
>> + ret = rdmsrl_safe_on_cpu(cpu, MSR_IA32_RTIT_CTL, &ctl);
>> + if (!ret && (ctl & RTIT_CTL_TRACEEN))
>> + prior_warn++;
>> + }
>> + put_online_cpus();
>> +
>> + ret = pt_pmu_hw_init();
>> + if (ret)
>> + return ret;
>> +
>> + if (!pt_cap_get(PT_CAP_topa_output)) {
>> + pr_warn("ToPA output is not supported on this CPU\n");
>> + return -ENODEV;
>> + }
>> +
>> + if (prior_warn)
>> + pr_warn("PT is enabled at boot time, traces may be empty\n");
>
> Should we not also add_exclusive(pt) here?
Good point.
> Also, if its already enabled, should we not return ENODEV as well, no
> saying who or what programmed it, we should not be touching it.
Indeed we should, although I'd also like to have a force-override boot
time option for this.
Thanks,
--
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/