Messages in this thread | | | From | Alexander Shishkin <> | Subject | Re: [PATCH v8 12/14] x86: perf: intel_pt: Intel PT PMU driver | Date | Mon, 12 Jan 2015 14:53:02 +0200 |
| |
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
| |