[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1339064319.23343.13.camel@twins>
Date: Thu, 07 Jun 2012 12:18:39 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Stephane Eranian <eranian@...gle.com>
Cc: linux-kernel@...r.kernel.org, andi@...stfloor.org, mingo@...e.hu,
ming.m.lin@...el.com
Subject: Re: [PATCH] perf/x86: check ucode before disabling PEBS on
SandyBridge
On Thu, 2012-06-07 at 09:15 +0200, Stephane Eranian wrote:
> +static int check_pebs_quirks(void)
> +{
> + int uversion = cpu_data(smp_processor_id()).microcode;
> + int model = cpu_data(smp_processor_id()).x86_model;
> +
> + /* do not have PEBS to begin with */
> + if (!x86_pmu.pebs)
> + return 0;
> +
> + /*
> + * check ucode version for SNB, SNB-EP
> + */
> + if ((model == 42 || model == 45) && uversion < 0x28) {
> + pr_warn("SandyBridge PEBS unavailable due to CPU erratum, "
> + " update microcode (was 0x%x, needs at least 0x28).\n",
> + uversion);
> + return -ENOTSUPP;
> + }
> + return 0;
> +}
> +
> static int intel_pmu_hw_config(struct perf_event *event)
> {
> int ret = x86_pmu_hw_config(event);
> @@ -1401,8 +1422,14 @@ static int intel_pmu_hw_config(struct perf_event *event)
> if (ret)
> return ret;
>
> - if (event->attr.precise_ip && x86_pmu.pebs_aliases)
> - x86_pmu.pebs_aliases(event);
> + if (event->attr.precise_ip) {
> +
> + if (check_pebs_quirks())
> + return -ENOTSUPP;
This will only warn about the PEBS issue once you try and use a PEBS
counter. Shouldn't we do this on boot? IOW. put check_pebs_quirks()
inside the existing quirk code instead of here?
> +
> + if (x86_pmu.pebs_aliases)
> + x86_pmu.pebs_aliases(event);
> + }
>
> if (intel_pmu_needs_lbr_smpl(event)) {
> ret = intel_pmu_setup_lbr_filter(event);
> @@ -1714,13 +1741,6 @@ static __init void intel_clovertown_quirk(void)
> x86_pmu.pebs_constraints = NULL;
> }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists