Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
fan stuck at 34% in auto mode(open again)
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1221
Location: sweden

PostPosted: Sat Dec 12, 2020 12:06 pm    Post subject: fan stuck at 34% in auto mode(open again) Reply with quote

hi

i have a problem with my :


Code:

kodi@myx51 ~ $ lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation GK104 [GeForce GTX 660 Ti] (rev a1)
kodi@myx51 ~ $


the fan is stuck att 34% in auto mode . when i set:

Code:

Option         "Coolbits" "28"


in xorg i can adjust the fan manually and i have tried to find out what the problem is but
with no success.


regards

EDIT: at the momoent i have manage to get the card running with https://github.com/leinardi/gwe.git


Last edited by hedmo on Sat Jan 02, 2021 7:15 am; edited 3 times in total
Back to top
View user's profile Send private message
nvaert1986
n00b
n00b


Joined: 05 May 2019
Posts: 73

PostPosted: Wed Dec 16, 2020 3:58 pm    Post subject: Reply with quote

- Have you checked using nvidia-smi?
- What happens if no driver is loaded (no nvidia, nor nouveau), besides efifb. Does it run at full speed then (as it should)? If not, then it might be a hardware related or VBIOS issue.
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1221
Location: sweden

PostPosted: Thu Dec 17, 2020 4:42 pm    Post subject: Reply with quote

nvaert1986 wrote:
- Have you checked using nvidia-smi?
- What happens if no driver is loaded (no nvidia, nor nouveau), besides efifb. Does it run at full speed then (as it should)? If not, then it might be a hardware related or VBIOS issue.


thanks for the reply.it did not do anything.i switched to amd and did not bothered more with it as it was an old card and could not manage need for speed.

regards
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1221
Location: sweden

PostPosted: Sat Jan 02, 2021 7:14 am    Post subject: Reply with quote

i ahve the same issue with my amd gpu to.
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 337

PostPosted: Sat Jan 02, 2021 10:14 pm    Post subject: Reply with quote

hedmo wrote:
i ahve the same issue with my amd gpu to.

I've always had the problem, the default curves never go above about 40%, same in windows.
I've even had thermal throttling with the fans stuck under 40% in auto mode.
There is a fan curve editor in windows which will (mostly) fix the problem, for Gentoo I had to write a script to deal with it.
If you are interested in the script let me know, it's been running for about 18 months without problems.
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1221
Location: sweden

PostPosted: Sun Jan 03, 2021 6:42 am    Post subject: Reply with quote

Ralphred wrote:
hedmo wrote:
i ahve the same issue with my amd gpu to.

I've always had the problem, the default curves never go above about 40%, same in windows.
I've even had thermal throttling with the fans stuck under 40% in auto mode.
There is a fan curve editor in windows which will (mostly) fix the problem, for Gentoo I had to write a script to deal with it.
If you are interested in the script let me know, it's been running for about 18 months without problems.


ATM i am running radeon-profile . but it is not the best way because i need to have a lot of stamps for the fan to work good.
how do your script work? .
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 337

PostPosted: Thu Jan 07, 2021 1:08 pm    Post subject: Reply with quote

hedmo wrote:
how do your script work? .

Small daemon written in python monitors the temp in /sys/class/hwmon, when the temp goes over a preset value it switches to "manual fan control" and applies a pre-defined "temperature to fan speed" curve.
I've altered the script to serve 3 different applications, it runs the GPU fans on my desktop PC, another version runs the fan on my Pi, and the 3rd version throttles my laptop CPU to keep the temps down, most of them been running well over a year with no problems now.

I'll dump the code here, shout if you need help altering it to fit your system.

Code:
#!/usr/bin/env python

import os
import sys
import signal
import time

class daemon:
        def __init__(self):
                self.pid_filename='/var/run/amdtempd.pid'
                self.go_auto_temp=x=25000 #under this we switch back to auto mode
                self.gpu_temp_path='/sys/class/hwmon/hwmon0/temp1_input'
                self.fan_mode_path='/sys/class/hwmon/hwmon0/pwm1_enable'
                self.fan_speed_path='/sys/class/hwmon/hwmon0/pwm1'
                self.fan_rpm_path='/sys/class/hwmon/hwmon0/fan1_input'
                self.modes={0:'None',1:'Manual',2:'Auto'}
                self.default_mode=2
                self.default_fan_speed=90
                self.curve={}
                while x <= 120000:
                        #self.curve.update({x:(((x-9000)/28538)**6)+102})
                        #self.curve.update({x:(((x-17500)/16403)**4)+104})
                        self.curve.update({x:(((x-10000)/21609)**5)+90})
                        if self.curve[x]>255:self.curve.update({x:255})
                        x+=1000

        def exit(self,sig,*_):
                sig_name=str(signal.Signals(sig))[8:]
                print('AMDTempd: Received %s, stopping gracefully ...' %sig_name)
                if self.default_mode != 2:self.set_fan_speed(self.default_fan_speed)
                self.set_mode(self.default_mode)
                try:os.remove(self.pid_filename)
                except:sys.exit(1)
                sys.exit(0)

        def start(self):
                self.default_mode=self.read_file(self.fan_mode_path)
                self.default_fan_speed=self.read_file(self.fan_speed_path)
                self.get_mode()
                try:
                        pid_file = open(self.pid_filename,'x')
                except FileExistsError as error:
                        pid=self.read_file(self.pid_filename)
                        if not os.system('ps -A|awk \'{print $1}\'|grep -qw "%s"'%pid):
                                print('AMDTempd: PID file already exists and daemon is running. Exiting...')
                                sys.exit(1)
                        else:
                                print('AMDTempd: Removing stale PID file:')
                                os.remove(self.pid_filename)
                                self.start()
                except OSError as error:
                        print(error)
                        sys.exit(1)
                #endtry
                pid_file.write(str(os.getpid()))
                pid_file.close()
                signal.signal(signal.SIGINT, self.exit)#from ctrl-c
                signal.signal(signal.SIGUSR1, self.exit)#from main script stop()
                signal.signal(signal.SIGTERM, self.exit)#from start-stop-daemon
                while True:
                        time.sleep(1)
                        self.check_temp()

        def check_temp(self):
                gpu_temp=self.read_file(self.gpu_temp_path)
                if gpu_temp <= self.go_auto_temp:
                        if self.current_mode != 'Auto':
                                self.set_mode(2)
                        return
                self.set_fan_speed(self.curve[gpu_temp])

        def set_mode(self,mode):
                mode_file=open(self.fan_mode_path,'w')
                mode_file.write(str(mode))
                mode_file.close()
                self.current_mode=self.modes[int(mode)]

        def set_fan_speed(self,Pspeed):
                if self.current_mode != 'Manual':
                        self.set_mode(1)
                speed=str(int(Pspeed))
                speed_file=open(self.fan_speed_path,'w')
                speed_file.write(speed)
                speed_file.close()

        def get_mode(self):
                mode=self.read_file(self.fan_mode_path)
                self.current_mode=self.modes[mode]

        def read_file(self,path):
                ret_file=open(path,'r')
                ret_val=ret_file.read()
                ret_file.close()
                return int(ret_val)

        def simple_exit(self,sig,*frame):
                sys.exit(0)

        def force_stop(self,pid):
                if pid:print('AMDTempd: Daemon refused to exit cleanly, killing PID:%s with SIGKILL and cleaning up'%pid)
                try: os.remove(self.pid_filename)
                except: pass
                if pid:
                        print ('AMDTempd: %s'%os.system('/bin/kill -SIGKILL %s'%pid))
                else:
                        os.system('ps aux|sed -n "/python %s start/p"|awk \'{print $2}\'|xargs /bin/kill -SIGKILL >/dev/null 2>&1'%(sys.argv[0].replace('/','\/')))
                sys.exit(0)

        def stop(self):
                pid=0
                try:
                        pid=self.read_file(self.pid_filename)
                        os.remove(self.pid_filename)
                except:
                        self.force_stop(pid)
                os.system('/bin/kill -SIGUSR1 %s'%pid)
                timer=60
                while timer > 0 and not os.system('ps -A|grep -qw "%s"'%pid):
                        time.sleep(0.1)
                        timer-=1
                if not os.system('ps -A|grep -q "%s"'%pid):force_stop(pid)
                sys.exit(0)

        def status(self):
                signal.signal(signal.SIGINT,self.simple_exit)
                try: interval=sys.argv[2]
                except:interval=0
                run=True
                while run:
                        if os.system('ps aux|grep -v grep 2>/dev/null|grep -q "python %s start"'%sys.argv[0]):
                                isRunning='Not running'
                        else:
                                isRunning='Yes, PID:%s'%self.read_file(self.pid_filename)
                        maxx=self.read_file(self.fan_speed_path)
                        curr=self.read_file(self.fan_rpm_path)
                        temp=self.read_file(self.gpu_temp_path)
                        mode=self.read_file(self.fan_mode_path)
                        print('###############################')
                        print(' Running      : %s'%isRunning)
                        print(' Temp         : %s°C'%int(temp/1000))
                        print(' Current RPM  : %s'%curr)
                        print(' Current Fan  : %s %s%%'%(maxx,int(curr/35)))
                        print(' Current Mode : %s'%self.modes[mode])
                        print('###############################')
                        time.sleep(int(interval))
                        run=interval

try:
        action=sys.argv[1]
        if action == 'start':
                main=daemon()
                fork_ret=os.fork()
                if fork_ret == 0:
                        main.start()
                else:
                        sys.exit(0)
        elif action == 'stop':
                main=daemon()
                main.stop()
        elif action == 'status':
                main=daemon()
                main.status()
        else:
                print('Usage: %s start|stop'%sys.argv[0][sys.argv[0].rfind('/')+1:])
except IndexError:
        print('Usage: %s start|stop'%sys.argv[0][sys.argv[0].rfind('/')+1:])
#endtry


Needs to be run as root to poke values in to the relevant files in /sys, needs python 3.x to run, and obviously hwmon support.
Back to top
View user's profile Send private message
yellowzip
n00b
n00b


Joined: 13 Jan 2021
Posts: 4

PostPosted: Thu Jan 14, 2021 4:14 am    Post subject: Reply with quote

Hay Ralphred, thanks for this python script.
_________________
[LianLi:Lancool.II.Mesh|Gigabyte:X570.Aorus-Elite|Ryzen5:5600X|Sapphire:Radeon.RX5700XT|Crucial:BallistiX.DDR4.3200:64G|Corsair:RM750i|pf-sources]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum