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, 26 Jan 2022 12:05:22 +0000
From:   Robin Murphy <robin.murphy@....com>
To:     Chao Liu <liuchao173@...wei.com>, catalin.marinas@....com,
        will@...nel.org
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        hewenliang4@...wei.com, zhoukang7@...wei.com
Subject: Re: [PATCH v2] add cpu frequency to cpuinfo in arm64

On 2022-01-26 09:23, Chao Liu wrote:
> There is cpu frequency in /proc/cpuinfo in x86 but not in arm64

arm64 cpuinfo also doesn't show the APIC ID or microcode version. 
Different architectures are different.

Besides, x86 cpuinfo only shows MHz if the CPU has X86_FEATURE_TSC, so 
for compatibility we should only do this on AArch64 CPUs which have 
X86_FEATURE_TSC.

Robin.

> Signed-off-by: Chao Liu <liuchao173@...wei.com>
> ---
> Change in v2:
> - fix spelling errors and remove remove redundant blank line
> 
>   arch/arm64/kernel/cpuinfo.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
> index 591c18a889a5..39a36e6e8079 100644
> --- a/arch/arm64/kernel/cpuinfo.c
> +++ b/arch/arm64/kernel/cpuinfo.c
> @@ -24,6 +24,7 @@
>   #include <linux/sched.h>
>   #include <linux/smp.h>
>   #include <linux/delay.h>
> +#include <linux/cpufreq.h>
>   
>   /*
>    * In case the boot CPU is hotpluggable, we record its initial state and
> @@ -144,6 +145,7 @@ static int c_show(struct seq_file *m, void *v)
>   	for_each_online_cpu(i) {
>   		struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i);
>   		u32 midr = cpuinfo->reg_midr;
> +		unsigned int freq = cpufreq_quick_get(i);
>   
>   		/*
>   		 * glibc reads /proc/cpuinfo to determine the number of
> @@ -159,6 +161,10 @@ static int c_show(struct seq_file *m, void *v)
>   			   loops_per_jiffy / (500000UL/HZ),
>   			   loops_per_jiffy / (5000UL/HZ) % 100);
>   
> +		if (freq)
> +			seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
> +				   freq / 1000, (freq % 1000));
> +
>   		/*
>   		 * Dump out the common processor features in a single line.
>   		 * Userspace should read the hwcaps with getauxval(AT_HWCAP)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ