diff options
author | Xiaoming Jiang <jiangxiaoming@outlook.com> | 2024-02-22 21:24:20 +0800 |
---|---|---|
committer | Fan Zhang <fanzhang.oss@gmail.com> | 2024-07-18 08:46:14 +0000 |
commit | 04da32426018a338a7585bc6a412c78847e5eef8 (patch) | |
tree | 3ff2e227f6c7389aaf8fdcf6f14a5c5c82e3b288 /src/vppinfra/time.c | |
parent | 357291142bf76963e7bdbaed5ebd912254c1e0ad (diff) |
vppinfra: fix cpu freq init error if cpu support aperfmperf
After linux-v4.15, 'cpu MHz' in /proc/cpuinfo is CPU
real frequency on x86 if cpu support aperfmperf flags
more see linux commit:
https://github.com/torvalds/linux/commit/7d5905dc14a87805a59f3c5bf70173aac2bb18f8
Type: fix
Change-Id: Ib655a9a1c519104142120b343cd8ddbe0b6e50e6
Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com>
Diffstat (limited to 'src/vppinfra/time.c')
-rw-r--r-- | src/vppinfra/time.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/vppinfra/time.c b/src/vppinfra/time.c index 5a6aaf182e4..f1736499a0a 100644 --- a/src/vppinfra/time.c +++ b/src/vppinfra/time.c @@ -76,8 +76,11 @@ clock_frequency_from_proc_filesystem (void) f64 ppc_timebase = 0; /* warnings be gone */ unformat_input_t input; -/* $$$$ aarch64 kernel doesn't report "cpu MHz" */ -#if defined(__aarch64__) +#if defined(__x86_64__) + if (clib_cpu_supports_aperfmperf ()) + return 0.0; +#elif defined(__aarch64__) + /* $$$$ aarch64 kernel doesn't report "cpu MHz" */ return 0.0; #endif |