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]
Message-ID: <CAJZ5v0hzpitKZJxuP_UuMWpJJoYaLBqd4iHawn44HzYXYHkf1g@mail.gmail.com>
Date:   Tue, 19 Apr 2022 18:30:45 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        "the arch/x86 maintainers" <x86@...nel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        "Paul E. McKenney" <paulmck@...nel.org>
Subject: Re: [patch 08/10] x86/aperfmperf: Store aperf/mperf data for cpu
 frequency reads

On Fri, Apr 15, 2022 at 9:20 PM Thomas Gleixner <tglx@...utronix.de> wrote:
>
> Now that the MSR readout is unconditional, store the results in the per CPU
> data structure along with a jiffies timestamp for the CPU frequency readout
> code.
>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

> ---
>  arch/x86/kernel/cpu/aperfmperf.c |   14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> --- a/arch/x86/kernel/cpu/aperfmperf.c
> +++ b/arch/x86/kernel/cpu/aperfmperf.c
> @@ -24,11 +24,17 @@
>  #include "cpu.h"
>
>  struct aperfmperf {
> +       seqcount_t      seq;
> +       unsigned long   last_update;
> +       u64             acnt;
> +       u64             mcnt;
>         u64             aperf;
>         u64             mperf;
>  };
>
> -static DEFINE_PER_CPU_SHARED_ALIGNED(struct aperfmperf, cpu_samples);
> +static DEFINE_PER_CPU_SHARED_ALIGNED(struct aperfmperf, cpu_samples) = {
> +       .seq = SEQCNT_ZERO(cpu_samples.seq)
> +};
>
>  struct aperfmperf_sample {
>         unsigned int    khz;
> @@ -515,6 +521,12 @@ void arch_scale_freq_tick(void)
>         s->aperf = aperf;
>         s->mperf = mperf;
>
> +       raw_write_seqcount_begin(&s->seq);
> +       s->last_update = jiffies;
> +       s->acnt = acnt;
> +       s->mcnt = mcnt;
> +       raw_write_seqcount_end(&s->seq);
> +
>         scale_freq_tick(acnt, mcnt);
>  }
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ