Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1422892

Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr

From chenyu <yu.chen.surf@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] x86: Move away from /dev/cpu/*/msr
Date 2016-06-15 12:30 +0200
Message-ID <rKgfe-1jj-51@gated-at.bofh.it> (permalink)
References <rKfVL-1co-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jun 15, 2016 at 6:00 PM, Borislav Petkov <bp@alien8.de> wrote:
> Comments are, as always, appreciated.
>
> ---
> From: Borislav Petkov <bp@suse.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@suse.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

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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