* [1/1] rt-tests: determine_maximum_mpps.sh: Get frequency from timebase-frequency if cpuinfo fails
@ 2024-11-11 1:49 ende.tan
2024-11-19 19:49 ` Marcelo Tosatti
2024-11-21 18:49 ` John Kacur
0 siblings, 2 replies; 3+ messages in thread
From: ende.tan @ 2024-11-11 1:49 UTC (permalink / raw)
To: linux-rt-users, mtosatti; +Cc: williams, jkacur, leyfoon.tan, Tan En De
From: Tan En De <ende.tan@starfivetech.com>
If cpu MHz is not listed in /proc/cpuinfo (as in RISC-V Linux), get the
frequency from /sys/firmware/devicetree/base/cpus/timebase-frequency.
Signed-off-by: Tan En De <ende.tan@starfivetech.com>
---
src/queuelat/determine_maximum_mpps.sh | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/queuelat/determine_maximum_mpps.sh b/src/queuelat/determine_maximum_mpps.sh
index 733b6b2..adfd809 100755
--- a/src/queuelat/determine_maximum_mpps.sh
+++ b/src/queuelat/determine_maximum_mpps.sh
@@ -42,7 +42,15 @@ usage()
get_cpuinfo_mhz()
{
- grep "cpu MHz" /proc/cpuinfo | cut -f 3 -d " " | sort -rn | head -n1
+ # Try to determine MHz from /proc/cpuinfo
+ FREQ_MHZ=$(grep "cpu MHz" /proc/cpuinfo | cut -f 3 -d " " | sort -rn | head -n1)
+
+ # Try to determine MHz from /sys/firmware/devicetree/base/cpus/timebase-frequency
+ if [ -z $FREQ_MHZ ]; then
+ FREQ_MHZ=$(($((16#$(hexdump -e '1/1 "%02X"' /sys/firmware/devicetree/base/cpus/timebase-frequency)))/1000000))
+ fi
+
+ echo "$FREQ_MHZ"
}
# Check that the scheduling policy hasn't already been set
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [1/1] rt-tests: determine_maximum_mpps.sh: Get frequency from timebase-frequency if cpuinfo fails
2024-11-11 1:49 [1/1] rt-tests: determine_maximum_mpps.sh: Get frequency from timebase-frequency if cpuinfo fails ende.tan
@ 2024-11-19 19:49 ` Marcelo Tosatti
2024-11-21 18:49 ` John Kacur
1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2024-11-19 19:49 UTC (permalink / raw)
To: ende.tan; +Cc: linux-rt-users, williams, jkacur, leyfoon.tan
On Mon, Nov 11, 2024 at 09:49:53AM +0800, ende.tan@starfivetech.com wrote:
> From: Tan En De <ende.tan@starfivetech.com>
>
> If cpu MHz is not listed in /proc/cpuinfo (as in RISC-V Linux), get the
> frequency from /sys/firmware/devicetree/base/cpus/timebase-frequency.
>
> Signed-off-by: Tan En De <ende.tan@starfivetech.com>
> ---
> src/queuelat/determine_maximum_mpps.sh | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/queuelat/determine_maximum_mpps.sh b/src/queuelat/determine_maximum_mpps.sh
> index 733b6b2..adfd809 100755
> --- a/src/queuelat/determine_maximum_mpps.sh
> +++ b/src/queuelat/determine_maximum_mpps.sh
> @@ -42,7 +42,15 @@ usage()
>
> get_cpuinfo_mhz()
> {
> - grep "cpu MHz" /proc/cpuinfo | cut -f 3 -d " " | sort -rn | head -n1
> + # Try to determine MHz from /proc/cpuinfo
> + FREQ_MHZ=$(grep "cpu MHz" /proc/cpuinfo | cut -f 3 -d " " | sort -rn | head -n1)
> +
> + # Try to determine MHz from /sys/firmware/devicetree/base/cpus/timebase-frequency
> + if [ -z $FREQ_MHZ ]; then
> + FREQ_MHZ=$(($((16#$(hexdump -e '1/1 "%02X"' /sys/firmware/devicetree/base/cpus/timebase-frequency)))/1000000))
> + fi
> +
> + echo "$FREQ_MHZ"
> }
>
> # Check that the scheduling policy hasn't already been set
> --
> 2.34.1
>
>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [1/1] rt-tests: determine_maximum_mpps.sh: Get frequency from timebase-frequency if cpuinfo fails
2024-11-11 1:49 [1/1] rt-tests: determine_maximum_mpps.sh: Get frequency from timebase-frequency if cpuinfo fails ende.tan
2024-11-19 19:49 ` Marcelo Tosatti
@ 2024-11-21 18:49 ` John Kacur
1 sibling, 0 replies; 3+ messages in thread
From: John Kacur @ 2024-11-21 18:49 UTC (permalink / raw)
To: Tan En De; +Cc: linux-rt-users, mtosatti, williams, leyfoon.tan
On Mon, 11 Nov 2024, ende.tan@starfivetech.com wrote:
> From: Tan En De <ende.tan@starfivetech.com>
>
> If cpu MHz is not listed in /proc/cpuinfo (as in RISC-V Linux), get the
> frequency from /sys/firmware/devicetree/base/cpus/timebase-frequency.
>
> Signed-off-by: Tan En De <ende.tan@starfivetech.com>
> ---
> src/queuelat/determine_maximum_mpps.sh | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/queuelat/determine_maximum_mpps.sh b/src/queuelat/determine_maximum_mpps.sh
> index 733b6b2..adfd809 100755
> --- a/src/queuelat/determine_maximum_mpps.sh
> +++ b/src/queuelat/determine_maximum_mpps.sh
> @@ -42,7 +42,15 @@ usage()
>
> get_cpuinfo_mhz()
> {
> - grep "cpu MHz" /proc/cpuinfo | cut -f 3 -d " " | sort -rn | head -n1
> + # Try to determine MHz from /proc/cpuinfo
> + FREQ_MHZ=$(grep "cpu MHz" /proc/cpuinfo | cut -f 3 -d " " | sort -rn | head -n1)
> +
> + # Try to determine MHz from /sys/firmware/devicetree/base/cpus/timebase-frequency
> + if [ -z $FREQ_MHZ ]; then
> + FREQ_MHZ=$(($((16#$(hexdump -e '1/1 "%02X"' /sys/firmware/devicetree/base/cpus/timebase-frequency)))/1000000))
> + fi
> +
> + echo "$FREQ_MHZ"
> }
>
> # Check that the scheduling policy hasn't already been set
> --
> 2.34.1
>
>
>
Signed-off-by: John Kacur <jkacur@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-21 18:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-11 1:49 [1/1] rt-tests: determine_maximum_mpps.sh: Get frequency from timebase-frequency if cpuinfo fails ende.tan
2024-11-19 19:49 ` Marcelo Tosatti
2024-11-21 18:49 ` John Kacur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox