* [PATCH v2] add cpu frequency to cpuinfo in arm64
@ 2022-01-26 9:23 ` Chao Liu
0 siblings, 0 replies; 8+ messages in thread
From: Chao Liu @ 2022-01-26 9:23 UTC (permalink / raw)
To: catalin.marinas, will
Cc: linux-arm-kernel, linux-kernel, hewenliang4, zhoukang7
There is cpu frequency in /proc/cpuinfo in x86 but not in arm64
Signed-off-by: Chao Liu <liuchao173@huawei.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)
--
2.23.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2] add cpu frequency to cpuinfo in arm64
@ 2022-01-26 9:23 ` Chao Liu
0 siblings, 0 replies; 8+ messages in thread
From: Chao Liu @ 2022-01-26 9:23 UTC (permalink / raw)
To: catalin.marinas, will
Cc: linux-arm-kernel, linux-kernel, hewenliang4, zhoukang7
There is cpu frequency in /proc/cpuinfo in x86 but not in arm64
Signed-off-by: Chao Liu <liuchao173@huawei.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)
--
2.23.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] add cpu frequency to cpuinfo in arm64
2022-01-26 9:23 ` Chao Liu
@ 2022-01-26 10:08 ` Sudeep Holla
-1 siblings, 0 replies; 8+ messages in thread
From: Sudeep Holla @ 2022-01-26 10:08 UTC (permalink / raw)
To: Chao Liu
Cc: catalin.marinas, will, Sudeep Holla, linux-arm-kernel,
linux-kernel, hewenliang4, zhoukang7
On Wed, Jan 26, 2022 at 09:23:49AM +0000, Chao Liu wrote:
> There is cpu frequency in /proc/cpuinfo in x86 but not in arm64
>
This has been repeatedly rejected in the past for valid reasons. I
could find this link[1] quickly, but I am sure you can find a handful of
such attempts in the past.
--
Regards,
Sudeep
[1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/1386924222-23169-1-git-send-email-vkale@apm.com/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] add cpu frequency to cpuinfo in arm64
@ 2022-01-26 10:08 ` Sudeep Holla
0 siblings, 0 replies; 8+ messages in thread
From: Sudeep Holla @ 2022-01-26 10:08 UTC (permalink / raw)
To: Chao Liu
Cc: catalin.marinas, will, Sudeep Holla, linux-arm-kernel,
linux-kernel, hewenliang4, zhoukang7
On Wed, Jan 26, 2022 at 09:23:49AM +0000, Chao Liu wrote:
> There is cpu frequency in /proc/cpuinfo in x86 but not in arm64
>
This has been repeatedly rejected in the past for valid reasons. I
could find this link[1] quickly, but I am sure you can find a handful of
such attempts in the past.
--
Regards,
Sudeep
[1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/1386924222-23169-1-git-send-email-vkale@apm.com/
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] add cpu frequency to cpuinfo in arm64
2022-01-26 9:23 ` Chao Liu
@ 2022-01-26 12:05 ` Robin Murphy
-1 siblings, 0 replies; 8+ messages in thread
From: Robin Murphy @ 2022-01-26 12:05 UTC (permalink / raw)
To: Chao Liu, catalin.marinas, will
Cc: linux-arm-kernel, linux-kernel, hewenliang4, zhoukang7
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@huawei.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)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] add cpu frequency to cpuinfo in arm64
@ 2022-01-26 12:05 ` Robin Murphy
0 siblings, 0 replies; 8+ messages in thread
From: Robin Murphy @ 2022-01-26 12:05 UTC (permalink / raw)
To: Chao Liu, catalin.marinas, will
Cc: linux-arm-kernel, linux-kernel, hewenliang4, zhoukang7
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@huawei.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)
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] add cpu frequency to cpuinfo in arm64
2022-01-26 12:05 ` Robin Murphy
@ 2022-01-26 12:29 ` Marc Zyngier
-1 siblings, 0 replies; 8+ messages in thread
From: Marc Zyngier @ 2022-01-26 12:29 UTC (permalink / raw)
To: Robin Murphy
Cc: Chao Liu, catalin.marinas, will, linux-arm-kernel, linux-kernel,
hewenliang4, zhoukang7
On 2022-01-26 12:05, Robin Murphy wrote:
> 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.
/me prepares a patch to be sent in just over 2 months...
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] add cpu frequency to cpuinfo in arm64
@ 2022-01-26 12:29 ` Marc Zyngier
0 siblings, 0 replies; 8+ messages in thread
From: Marc Zyngier @ 2022-01-26 12:29 UTC (permalink / raw)
To: Robin Murphy
Cc: Chao Liu, catalin.marinas, will, linux-arm-kernel, linux-kernel,
hewenliang4, zhoukang7
On 2022-01-26 12:05, Robin Murphy wrote:
> 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.
/me prepares a patch to be sent in just over 2 months...
M.
--
Jazz is not dead. It just smells funny...
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-01-26 12:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 9:23 [PATCH v2] add cpu frequency to cpuinfo in arm64 Chao Liu
2022-01-26 9:23 ` Chao Liu
2022-01-26 10:08 ` Sudeep Holla
2022-01-26 10:08 ` Sudeep Holla
2022-01-26 12:05 ` Robin Murphy
2022-01-26 12:05 ` Robin Murphy
2022-01-26 12:29 ` Marc Zyngier
2022-01-26 12:29 ` Marc Zyngier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.