Re: [PATCH v3 13/13] perf/x86: add syfs entry to disable HT bug workaround
From: Borislav Petkov
Date: Mon Nov 17 2014 - 18:02:52 EST
On Mon, Nov 17, 2014 at 08:07:05PM +0100, Stephane Eranian wrote:
> From: Maria Dimakopoulou <maria.n.dimakopoulou@xxxxxxxxx>
>
> 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?
Such a scheme should be much more easily extensible in the future in
case we want to add another workaround toggle.
The hierarchy is not optimal either as it should be under
"perf"-something but I don't think we have a perf sysfs node...
> Results effective only once there is no more active
> events.
>
> Reviewed-by: Stephane Eranian <eranian@xxxxxxxxxx>
> Signed-off-by: Maria Dimakopoulou <maria.n.dimakopoulou@xxxxxxxxx>
> ---
...
> 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 */
For an example, see amd_l3_attrs() in
arch/x86/kernel/cpu/intel_cacheinfo.c
Thanks.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
--
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/