byobu should revert to dmidecode if bogomips in /proc/cpuinfo are set to zero

Bug #2051288 reported by Markus Ueberall
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
byobu (Ubuntu)
New
Undecided
Unassigned

Bug Description

A number of cloud server offerings -- e.g., those from Oracle (OCI), Hetzner, Netcup -- based on current Ampere® Altra® processors report zero bogomips on Linux, which results in a reported cpu frequency of "0.0 GHz".
However, it's possible to revert to dmidecode which actually reports the correct current/base clock speed (in MHz).

The below patch should apply for all/all recent versions of byobu:

--- byobu-6.10.orig/usr/lib/byobu/cpu_freq
+++ byobu-6.10/usr/lib/byobu/cpu_freq
@@ -37,6 +37,11 @@ __cpu_freq() {
                        count=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
                        freq=$(egrep -i -m 1 "^bogomips" /proc/cpuinfo | awk -F"[:.]" '{ print $2 }')
                        freq=$(printf "%s %s" "$freq" "$count" | awk '{printf "%01.1f\n", $1/$2/1000}')
+ if [ $freq = "0.0" ]; then
+ hz=$(dmidecode | egrep -m 1 -i "current speed:" | sed -e 's|.*: ||' -e 's| .*||')
+ fpdiv $hz "1000" 1 # 1Ghz
+ freq="$_RET"
+ fi
                fi
        elif hz=$(sysctl -n hw.cpufrequency 2>/dev/null); then
                fpdiv $hz "1000000000" 1 # 1Ghz

Revision history for this message
Markus Ueberall (ueberall) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "revert to dmidecode if bogomips in /proc/cpuinfo are set to zero" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Hi Markus,

Thank for proposing this one.

It would also be nice to propose this upstream to ensure we will not be carrying this specific delta indefinitely.

Would you mind filling an issue or a pull request at https://github.com/dustinkirkland/byobu?

Robie Basak (racb)
tags: added: needs-upstream-report
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.