From: John Kacur <jkacur@redhat.com>
To: Tan En De <ende.tan@starfivetech.com>
Cc: linux-rt-users@vger.kernel.org, mtosatti@redhat.com,
williams@redhat.com, leyfoon.tan@starfivetech.com
Subject: Re: [1/1] rt-tests: determine_maximum_mpps.sh: Get frequency from timebase-frequency if cpuinfo fails
Date: Thu, 21 Nov 2024 13:49:13 -0500 (EST) [thread overview]
Message-ID: <ef7eb9ef-4c54-0422-ec3b-e09e43f0e02f@redhat.com> (raw)
In-Reply-To: <20241111014953.11604-1-ende.tan@starfivetech.com>
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>
prev parent reply other threads:[~2024-11-21 18:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ef7eb9ef-4c54-0422-ec3b-e09e43f0e02f@redhat.com \
--to=jkacur@redhat.com \
--cc=ende.tan@starfivetech.com \
--cc=leyfoon.tan@starfivetech.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox