lkml.org 
[lkml]   [2015]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v8 12/14] x86: perf: intel_pt: Intel PT PMU driver
Date
Peter Zijlstra <peterz@infradead.org> 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


\
 
 \ /
  Last update: 2015-01-12 14:01    [W:0.460 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site