lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 15 Jun 2016 18:22:59 +0800
From:	chenyu <yu.chen.surf@...il.com>
To:	Borislav Petkov <bp@...en8.de>
Cc:	lkml <linux-kernel@...r.kernel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Thomas Renninger <trenn@...e.com>,
	Kan Liang <kan.liang@...el.com>,
	"Peter Zijlstra (Intel)" <peterz@...radead.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	Len Brown <len.brown@...el.com>,
	Linux PM list <linux-pm@...r.kernel.org>
Subject: Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr

On Wed, Jun 15, 2016 at 6:00 PM, Borislav Petkov <bp@...en8.de> wrote:
> Comments are, as always, appreciated.
>
> ---
> From: Borislav Petkov <bp@...e.de>
> Date: Wed, 15 Jun 2016 11:20:41 +0200
> Subject: [PATCH] Move away from msr.ko
>
> Take care of MSR_IA32_ENERGY_PERF_BIAS.
>
> Not-yet-signed-off-by: Borislav Petkov <bp@...e.de>
[cut]
> +static ssize_t
> +energy_policy_pref_hint_show(struct device *dev, struct device_attribute *attr,
> +                            char *buf)
> +{
> +       u64 epb;
> +
> +       rdmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
MSR_IA32_ENERGY_PERF_BIAS is of core scope, should we use rdmsr_on_cpu?
> +
> +       return sprintf(buf, "%d\n", (unsigned int)(epb & 0xFULL));
> +}
> +
> +static ssize_t
> +energy_policy_pref_hint_store(struct device *dev, struct device_attribute *attr,
> +                             const char *buf, size_t count)
> +{
> +       u32 val;
> +       u64 epb;
> +
> +       if (kstrtou32(buf, 10, &val) < 0)
> +               return -EINVAL;
> +
> +       if (val > 15)
> +               return -EINVAL;
> +
> +       rdmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
rdmsr_on_cpu?
> +
> +       if ((epb & 0xf) == val)
> +               return count;
> +
> +       wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, (epb & ~0xFULL) | val);
wrmsr_on_cpu?



thanks,
Yu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ