Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) by gbr-app-1.alpinelinux.org (Postfix) with ESMTPS id B8A7E2270DB for <~alpine/users@lists.alpinelinux.org>; Mon, 28 Oct 2024 23:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sdaoden.eu; s=citron; t=1730158859; x=1730825525; h=date:author:from:to:subject: message-id:in-reply-to:references:mail-followup-to:openpgp:blahblahblah: author:from:subject:date:to:cc:resent-author:resent-date:resent-from: resent-sender:resent-to:resent-cc:resent-reply-to:resent-message-id: in-reply-to:references:mime-version:content-type: content-transfer-encoding:content-disposition:content-id: content-description:message-id:mail-followup-to:openpgp:blahblahblah; bh=eFxPv7wcUjRABEAC2AoUrdHZxbGLaTV9XzAc3dwRJmk=; b=OSDN1Ap7rR95lVu76U4KiMWdn37jBfnRYaDWVDw46KK9E9FZg4Uh+eVTp97nJxsHh1ize4zs WLG7TO0qkoq41okNwWi6OinfY3jkRZnersTuilCo/Yoe92FJwCGOukoXkN9SamBTcfGtFACB5f hPNNrZJc2qZ2ADsM53OzbW3Cx9n/gv+Um6YB51FbXdPfHv9CnLJsOnwy2i2QtIRbV4knCj+2VH YmPkuyFZ7FyNZ31HZnkDcJ1jY+HRIbgj/BHC8MsvWlG2y4BLLY7cJ+T+VKbNXBX8lUkHgelm9p D/0mRPiXdspJXFHcXk+lSntfjjVpmzSSaDfpLFGDpRn9M8Ug== DKIM-Signature: v=1; a=adaed25519-sha256; c=relaxed/relaxed; d=sdaoden.eu; s=orange; t=1730158859; x=1730825525; h=date:author:from:to:subject: message-id:in-reply-to:references:mail-followup-to:openpgp:blahblahblah: author:from:subject:date:to:cc:resent-author:resent-date:resent-from: resent-sender:resent-to:resent-cc:resent-reply-to:resent-message-id: in-reply-to:references:mime-version:content-type: content-transfer-encoding:content-disposition:content-id: content-description:message-id:mail-followup-to:openpgp:blahblahblah; bh=eFxPv7wcUjRABEAC2AoUrdHZxbGLaTV9XzAc3dwRJmk=; b=F80P/gqtfmIOTuGP22KSghAukWiuyJq2RhOPgzPY8Y8pHEUTPAe3o4rXLvwha725pjramC/X 9nT3oGknFlZVAw== Date: Tue, 29 Oct 2024 00:40:57 +0100 Author: Steffen Nurpmeso From: Steffen Nurpmeso To: ~alpine/users@lists.alpinelinux.org Subject: Re: freeze / connection delay after idling for a while ? Message-ID: <20241028234057.1FKmQZ0e@steffen%sdaoden.eu> In-Reply-To: <20240930202728._Cgmke2m@steffen%sdaoden.eu> References: <20240930202728._Cgmke2m@steffen%sdaoden.eu> Mail-Followup-To: ~alpine/users@lists.alpinelinux.org User-Agent: s-nail v14.9.25-623-g805238bd9b OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. Steffen Nurpmeso wrote in <20240930202728._Cgmke2m@steffen%sdaoden.eu>: |Jerome Marc wrote in | : .. |It *could* be that cpupower-openrc is indeed the |tools/power/cpupower of the linux kernel sources, it seems to be |widely available (architecture-wise, on Alpine). |If that is so, then running it should output stuff like btw that | #?0|kent:~# bin/cpupower.sh script was total shit, as it was relying on that cpupower program even though /sys/devices/system/cpu{,/cpufreq/} supports plenty of possibilities. Thank you. I have extended/changed it, changed my #@ /root/hosts/self/cpupower plo='400M -g powersave' pmi='1600M -g powersave' phi='3400M -g powersave' smi='2500M -g performance' shi='3400M -g performance' defmode=phi defname=$phi but these configs are only used if the mentioned will not work out, otherwise it adapts automatically more or less better. In fact the energy_performance_preference seems to play a much, much greater role than anything else, at least with my scheduler(s) and config etc etc. (Terribly slow with p+!) But with that i now have # DEBUG=Y bin/cpupower.sh - # or p- echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo power > /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference echo 400000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq echo 400000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq echo powersave > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor echo power > /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference echo 400000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq echo 400000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq ... over # DEBUG=Y bin/cpupower.sh p+ echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo balance_power > /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference echo 400000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq echo 3400000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq ... to # DEBUG=Y bin/cpupower.sh + # or s+ echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo performance > /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference echo 400000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq echo 3400000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq ... and that all-automatic! Just in case someone is interested... #!/bin/sh - #@ /root/bin/cpupower.sh # cpupower is in Linux src, tools/power/cpupower : ${HOSTNAME:=$(uname -n)} : ${DEBUG:=} if [ -f /root/hosts/${HOSTNAME}/cpupower ]; then . /root/hosts/${HOSTNAME}/cpupower elif [ $# -gt 0 ]; then logger -s -t /root/bin/cpupower.sh "MISS /root/hosts/${HOSTNAME}/cpupower (for setting)" exit 1 fi cd / [ -n "$DEBUG" ] && DEBUG=echo strat=strata mode= bd=/sys/devices/system/cpu mode_set() { $DEBUG logger -s -t /root/bin/cpupower.sh mode=$mode #flock /run/.sys-cpu -c "echo $mode > /run/.sys-cpu" [ -z "$DEBUG" ] && echo $mode > /run/.sys-cpu } strata() { query() { # {{{ i=0 while [ -d $bd/cpu$i ]; do if [ -f $bd/cpu$i/online ]; then eval read j < $bd/cpu$i/online if [ $j -ne 1 ]; then i=$((i + 1)) continue fi fi eval cpu$i=y if [ -f $bd/cpu$i/cpufreq/base_frequency ]; then eval read j < $bd/cpu$i/cpufreq/base_frequency eval cpu${i}_bf=\$j if [ -f $bd/cpu$i/cpufreq/cpuinfo_min_freq ]; then eval read j < $bd/cpu$i/cpufreq/cpuinfo_min_freq eval cpu${i}_minf=\$j fi if [ -f $bd/cpu$i/cpufreq/cpuinfo_max_freq ]; then eval read j < $bd/cpu$i/cpufreq/cpuinfo_max_freq eval cpu${i}_maxf=\$j fi fi if [ -f $bd/cpu$i/cpufreq/scaling_governor ]; then eval read j < $bd/cpu$i/cpufreq/scaling_governor eval cpu${i}_gov=\$j if [ -f $bd/cpu$i/cpufreq/scaling_available_governors ]; then eval read j < $bd/cpu$i/cpufreq/scaling_available_governors eval cpu${i}_govs=\$j fi fi if [ -f $bd/cpu$i/cpufreq/energy_performance_preference ]; then eval read j < $bd/cpu$i/cpufreq/energy_performance_preference eval cpu${i}_epref=\$j if [ -f $bd/cpu$i/cpufreq/energy_performance_available_preferences ]; then eval read j < $bd/cpu$i/cpufreq/energy_performance_available_preferences eval cpu${i}_eprefs=\$j fi fi if [ -f $bd/cpu$i/cpufreq/scaling_cur_freq ]; then eval read j < $bd/cpu$i/cpufreq/scaling_cur_freq eval cpu${i}_sf=\$j if [ -f $bd/cpu$i/cpufreq/scaling_min_freq ]; then eval read j < $bd/cpu$i/cpufreq/scaling_min_freq eval cpu${i}_sminf=\$j fi if [ -f $bd/cpu$i/cpufreq/scaling_max_freq ]; then eval read j < $bd/cpu$i/cpufreq/scaling_max_freq eval cpu${i}_smaxf=\$j fi fi i=$((i + 1)) done } # }}} adjust() { # {{{ [ -n "$DEBUG" ] && ev=echo || ev=eval i=0 while [ -d $bd/cpu$i ]; do eval j=\$cpu$i if [ -z "$j" ]; then i=$((i + 1)) continue fi eval bf=\$cpu${i}_bf minf=\$cpu${i}_minf maxf=\$cpu${i}_maxf \ gov=\$cpu${i}_gov govs=\$cpu${i}_govs \ epref=\$cpu${i}_epref eprefs=\$cpu${i}_eprefs \ sf=\$cpu${i}_sf minf=\$cpu${i}_minf maxf=\$cpu${i}_maxf gov= epref= sminf= smaxf= if [ $mode != "${mode%p*}" ]; then if [ -n "$govs" ]; then if [ " $govs" != "${govs#* powersave}" ]; then gov=powersave fi fi if [ -n "$eprefs" ]; then if [ $mode != "${mode#*+}" ] && [ " $eprefs" != "${eprefs#* balance_power}" ]; then epref=balance_power fi if [ -z "$epref" ] && [ " $eprefs" != "${eprefs#* power}" ]; then epref=power fi fi if [ -n "$bf" ] && [ -n "$minf" ] && [ -n "$maxf" ]; then sminf=$minf if [ $mode != "${mode#*-}" ]; then smaxf=$minf elif [ $mode != "${mode#*=}" ]; then smaxf=$((bf + ((maxf - bf) / 2))) [ $smaxf -gt $maxf ] && smaxf=$((maxf - $(maxf / 4))) else smaxf=$maxf fi fi else if [ -n "$govs" ]; then if [ " $govs" != "${govs#* performance}" ]; then gov=performance fi fi if [ -n "$eprefs" ]; then if [ $mode = "${mode#*+}" ] && [ " $eprefs" != "${eprefs#* balance_performance}" ]; then epref=balance_performance fi if [ -z "$epref" ] && [ " $eprefs" != "${eprefs#* performance}" ]; then epref=performance fi fi if [ -n "$bf" ] && [ -n "$minf" ] && [ -n "$maxf" ]; then sminf=$minf if [ $mode != "${mode#*+}" ]; then smaxf=$maxf elif [ $mode != "${mode#*=}" ]; then smaxf=$((bf + ((maxf - bf) / 2))) [ $smaxf -gt $maxf ] && smaxf=$((maxf - $(maxf / 4))) #else # smaxf=$bf fi fi fi [ -n "$gov" ] && $ev "echo $gov > $bd/cpu$i/cpufreq/scaling_governor" [ -n "$epref" ] && $ev "echo $epref > $bd/cpu$i/cpufreq/energy_performance_preference" [ -n "$sminf" ] && $ev "echo $sminf > $bd/cpu$i/cpufreq/scaling_min_freq" [ -n "$smaxf" ] && $ev "echo $smaxf > $bd/cpu$i/cpufreq/scaling_max_freq" i=$((i + 1)) done $ev query mode_set } # }}} show() { # {{{ i=0 while [ -d $bd/cpu$i ]; do eval j=\$cpu$i if [ -z "$j" ]; then i=$((i + 1)) continue fi printf "CPU $i: " eval j=\$cpu${i}_bf if [ -n "$j" ]; then printf "$j/" eval j=\$cpu${i}_minf [ -n "$j" ] && printf "$j" eval j=\$cpu${i}_maxf [ -n "$j" ] && printf -- "-$j" printf '; ' fi eval j=\$cpu${i}_gov if [ -n "$j" ]; then printf "gov: $j" eval j=\$cpu${i}_govs [ -n "$j" ] && printf " ($j)" printf '; ' fi eval j=\$cpu${i}_epref if [ -n "$j" ]; then printf "energy: $j" eval j=\$cpu${i}_eprefs [ -n "$j" ] && printf " ($j)" printf '; ' fi eval j=\$cpu${i}_sf if [ -n "$j" ]; then printf "scaling: $j/" eval j=\$cpu${i}_sminf [ -n "$j" ] && printf "$j" eval j=\$cpu${i}_smaxf [ -n "$j" ] && printf -- "-$j" #printf '; ' fi printf '\n' i=$((i + 1)) done } # }}} query [ -n "$mode" ] && adjust show } stratb() { if [ -n "$mode" ]; then eval i=\$$moden if [ -z "$i" ]; then logger -s -t /root/bin/cpupower.sh "MISS /root/hosts/${HOSTNAME}/cpupower mode=$mode" exit 1 fi $DEBUG cpupower frequency-set -u $i mode_set fi eval exec $DEBUG cpupower frequency-info } if [ ! -f $bd/cpu0/cpufreq/base_frequency ]; then if command -v cpupower >/dev/null 2>&1; then :; else logger -s -t /root/bin/cpupower.sh 'no cpupower tool' exit 1 fi strat=stratb fi if [ $# -gt 0 ]; then case "$1" in \-|p-) mode=p- moden=plo;; p=) mode=$1 moden=pmi;; p\+) mode=$1 moden=phi;; s=) mode=$1 moden=smi;; \+|s\+) mode=s+ moden=shi;; =|def) mode=$defmode moden=$defname;; *) echo >&2 'Synopsis: cpupower [p-|p=|p+|s=|s+|=|def]';; esac fi eval $strat # s-sht-mode --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) | |And in Fall, feel "The Dropbear Bard"s ball(s). | |The banded bear |without a care, |Banged on himself fore'er and e'er | |Farewell, dear collar bear