linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>, x86-ml <x86@kernel.org>,
	linux-kernel@vger.kernel.org, peterz@infradead.org,
	mingo@elte.hu, ak@linux.intel.com, jolsa@redhat.com,
	kan.liang@intel.com, maria.n.dimakopoulou@gmail.com
Subject: Re: [PATCH v3 13/13] perf/x86: add syfs entry to disable HT bug workaround
Date: Tue, 18 Nov 2014 00:38:14 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.11.1411180025270.3909@nanos> (raw)
In-Reply-To: <20141117230232.GC25157@pd.tnic>

On Tue, 18 Nov 2014, Borislav Petkov wrote:
> On Mon, Nov 17, 2014 at 08:07:05PM +0100, Stephane Eranian wrote:
> > From: Maria Dimakopoulou <maria.n.dimakopoulou@gmail.com>
> > 
> > This patch adds a sysfs entry:
> > 
> > 	/sys/devices/cpu/ht_bug_workaround
> > 
> > to activate/deactivate the PMU HT bug workaround.
> > 
> > To activate (activated by default):
> >  # echo 1 > /sys/devices/cpu/ht_bug_workaround
> > 
> > To deactivate:
> >  # echo 0 > /sys/devices/cpu/ht_bug_workaround
> 
> If I put my simple-user hat and stare at this sysfs node, I'm not really
> becoming any smarter from looking at the name. HT bug? A hyper-threading
> bug?? I see the user forums going nuts already.
> 
> Instead of adding a sysfs node per CPU bug, I'm wondering whether adding
> a
> 
> 	/sys/devices/system/cpu/bugs
> 
> file which gets a mask of bits to enable and disable workarounds would
> be much cleaner.
> 
> x86 guys, what do you guys think?

Well a bitmask is a pretty indescriptive item as well. Putting my user
hat on: Where is the documentation for the bits?

> Such a scheme should be much more easily extensible in the future in
> case we want to add another workaround toggle.

Agreed, but that does not make it more intuitive.
 
> The hierarchy is not optimal either as it should be under
> "perf"-something but I don't think we have a perf sysfs node...

I'm not sure about that. Its a CPU bug at the very end. We should not
care much which of the various bits and pieces of a CPU it affects and
some of them affect more than one ....

But OTOH, we dont want to have random entries with impossible to
understand file names under /sys/devices/cpu/ either.

So what about adding:

 /sys/devices/cpu/bugs/
 
and collect the various user tweakable (or not) bug data there.

So for the problem at hand:

 /sys/devices/cpu/bugs/ht_some_sensible_name/

   Directory

 /sys/devices/cpu/bugs/ht_some_sensible_name/info

   File, which describes the bug comprehensive. URL reference, Errata
   Nr. or something like that.

 /sys/devices/cpu/bugs/ht_some_sensible_name/workaround

   File, to retrieve the status of the workaround. Possibly RO
   depending on the nature of the issue.

> >  static DEVICE_ATTR(rdpmc, S_IRUSR | S_IWUSR, get_attr_rdpmc, set_attr_rdpmc);
> > +static DEVICE_ATTR(ht_bug_workaround, S_IRUSR | S_IWUSR, get_attr_xsu,
> > +		   set_attr_xsu);
> >  
> >  static struct attribute *x86_pmu_attrs[] = {
> >  	&dev_attr_rdpmc.attr,
> > +	&dev_attr_ht_bug_workaround.attr,
> 
> You should be adding this dynamically, only when running on Intel, i.e.
> 
> 	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
> 		/* add bug_workaround attr */

and if it's a family/model specific issue, we don't want to see it if
we are not running on such a machine.
 
> For an example, see amd_l3_attrs() in
> arch/x86/kernel/cpu/intel_cacheinfo.c

Given the fact that the number of bugs is going to grow, we probably
want some infrastructure for this.

Thanks,

	tglx

  reply	other threads:[~2014-11-17 23:38 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-17 19:06 [PATCH v3 00/13] perf/x86: implement HT counter corruption workaround Stephane Eranian
2014-11-17 19:06 ` [PATCH v3 01/13] perf,x86: rename er_flags to flags Stephane Eranian
2015-04-02 18:41   ` [tip:perf/core] perf/x86: Rename x86_pmu::er_flags to 'flags' tip-bot for Stephane Eranian
2014-11-17 19:06 ` [PATCH v3 02/13] perf/x86: vectorize cpuc->kfree_on_online Stephane Eranian
2015-04-02 18:41   ` [tip:perf/core] perf/x86: Vectorize cpuc->kfree_on_online tip-bot for Stephane Eranian
2014-11-17 19:06 ` [PATCH v3 03/13] perf/x86: add 3 new scheduling callbacks Stephane Eranian
2015-04-02 18:42   ` [tip:perf/core] perf/x86: Add " tip-bot for Maria Dimakopoulou
2014-11-17 19:06 ` [PATCH v3 04/13] perf/x86: add index param to get_event_constraint() callback Stephane Eranian
2015-04-02 18:42   ` [tip:perf/core] perf/x86: Add 'index' " tip-bot for Stephane Eranian
2014-11-17 19:06 ` [PATCH v3 05/13] perf/x86: add cross-HT counter exclusion infrastructure Stephane Eranian
2015-04-02 18:42   ` [tip:perf/core] perf/x86/intel: Add " tip-bot for Maria Dimakopoulou
2014-11-17 19:06 ` [PATCH v3 06/13] perf/x86: implement cross-HT corruption bug workaround Stephane Eranian
2015-04-02 18:43   ` [tip:perf/core] perf/x86/intel: Implement " tip-bot for Maria Dimakopoulou
2014-11-17 19:06 ` [PATCH v3 07/13] perf/x86: enforce HT bug workaround for SNB/IVB/HSW Stephane Eranian
2015-04-02 18:43   ` [tip:perf/core] perf/x86/intel: Enforce HT bug workaround for SNB /IVB/HSW tip-bot for Maria Dimakopoulou
2014-11-17 19:07 ` [PATCH v3 08/13] perf/x86: enforce HT bug workaround with PEBS for SNB/IVB/HSW Stephane Eranian
2015-04-02 18:43   ` [tip:perf/core] perf/x86/intel: Enforce " tip-bot for Maria Dimakopoulou
2014-11-17 19:07 ` [PATCH v3 09/13] perf/x86: fix intel_get_event_constraints() for dynamic constraints Stephane Eranian
2015-04-02 18:43   ` [tip:perf/core] perf/x86/intel: Fix " tip-bot for Stephane Eranian
2014-11-17 19:07 ` [PATCH v3 10/13] perf/x86: limit to half counters to avoid exclusive mode starvation Stephane Eranian
2015-04-02 18:44   ` [tip:perf/core] perf/x86/intel: Limit to half counters when the HT workaround is enabled, " tip-bot for Stephane Eranian
2014-11-17 19:07 ` [PATCH v3 11/13] watchdog: add watchdog enable/disable all functions Stephane Eranian
2015-04-02 18:44   ` [tip:perf/core] watchdog: Add watchdog enable/ disable " tip-bot for Stephane Eranian
2014-11-17 19:07 ` [PATCH v3 12/13] perf/x86: make HT bug workaround conditioned on HT enabled Stephane Eranian
2015-04-02 18:44   ` [tip:perf/core] perf/x86/intel: Make the HT bug workaround conditional " tip-bot for Stephane Eranian
2014-11-17 19:07 ` [PATCH v3 13/13] perf/x86: add syfs entry to disable HT bug workaround Stephane Eranian
2014-11-17 23:02   ` Borislav Petkov
2014-11-17 23:38     ` Thomas Gleixner [this message]
2014-11-17 23:58       ` Borislav Petkov
2014-11-18  0:31         ` Thomas Gleixner
2014-11-18 15:29           ` Stephane Eranian
2014-11-18 15:43             ` Borislav Petkov
2014-11-18 16:37               ` Stephane Eranian
2014-11-18 16:42                 ` Borislav Petkov
2014-11-18 15:01     ` Maria Dimakopoulou
2014-11-18 15:12       ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.11.1411180025270.3909@nanos \
    --to=tglx@linutronix.de \
    --cc=ak@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maria.n.dimakopoulou@gmail.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).