Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1423062
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr |
| Date | 2016-06-15 16:10 +0200 |
| Message-ID | <rKjG2-3xJ-27@gated-at.bofh.it> (permalink) |
| References | <rKfVL-1co-3@gated-at.bofh.it> <rKgfe-1jj-51@gated-at.bofh.it> <rKgoN-1mz-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Jun 15, 2016 at 12:36:22PM +0200, Borislav Petkov wrote:
> Ah, yes, good point. Will change.
Ok, got a bit more involved - I also need to disable preemption around
smp_call_function_single(). Here's what I have now. It seems to work
too.
static ssize_t
energy_policy_pref_hint_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
u64 epb;
preempt_disable();
if (rdmsrl_on_cpu(dev->id, MSR_IA32_ENERGY_PERF_BIAS, &epb))
epb = -1;
preempt_enable();
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;
preempt_disable();
if (rdmsrl_on_cpu(dev->id, MSR_IA32_ENERGY_PERF_BIAS, &epb)) {
count = -EINVAL;
goto out;
}
if ((epb & 0xf) == val)
goto out;
if (wrmsrl_on_cpu(dev->id, MSR_IA32_ENERGY_PERF_BIAS, (epb & ~0xFULL) | val))
count = -EINVAL;
out:
preempt_enable();
return count;
}
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH] x86: Move away from /dev/cpu/*/msr Borislav Petkov <bp@alien8.de> - 2016-06-15 12:10 +0200
Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr chenyu <yu.chen.surf@gmail.com> - 2016-06-15 12:30 +0200
Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr Borislav Petkov <bp@alien8.de> - 2016-06-15 12:40 +0200
Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr Borislav Petkov <bp@alien8.de> - 2016-06-15 16:10 +0200
Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr Len Brown <lenb@kernel.org> - 2016-06-15 18:50 +0200
Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr Borislav Petkov <bp@alien8.de> - 2016-06-15 19:00 +0200
Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr Len Brown <lenb@kernel.org> - 2016-06-15 19:30 +0200
Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr Borislav Petkov <bp@alien8.de> - 2016-06-15 19:40 +0200
Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr Len Brown <lenb@kernel.org> - 2016-06-15 19:50 +0200
Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr Borislav Petkov <bp@alien8.de> - 2016-06-15 20:00 +0200
Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr Andi Kleen <andi@firstfloor.org> - 2016-06-20 23:20 +0200
csiph-web