I’ve recently noticed that my custom application for GPU fan control has stopped working. It seems that the XNVCtrl interface is not functioning correctly - the following error is being reported when ran as root:
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 157 (NV-CONTROL)
Minor opcode of failed request: 3 ()
Value in failed request: 0x17
Serial number of failed request: 13
Current serial number in output stream: 14
This can be reproduced with the following minimal example:
// Compile with: gcc -o nvfanbug nvfanbug.c -lX11 -lXNVCtrl
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <NVCtrl/NVCtrlLib.h>
int main(void)
{
int gpu_id = 0;
Display *display = XOpenDisplay(NULL);
int screen = DefaultScreen(display);
// This fails silently
XNVCTRLSetTargetAttribute(display, NV_CTRL_TARGET_TYPE_GPU, gpu_id, 0, NV_CTRL_GPU_COOLER_MANUAL_CONTROL, 1);
// This fails with BadValue error
XNVCTRLSetTargetAttribute(display, NV_CTRL_TARGET_TYPE_COOLER, gpu_id, 0, NV_CTRL_THERMAL_COOLER_LEVEL, 50);
XFlush(display);
XCloseDisplay(display);
return 0;
}
Apparently nvfancontrol is suffering from a similar issue:
$ sudo target/debug/nvfancontrol
WARN - No config file found; using default curve
INFO - NVIDIA driver version: 560.35.03
INFO - NVIDIA graphics adapter #0: NVIDIA GeForce RTX 2070 SUPER
INFO - GPU #0 coolers: COOLER-0
ERROR - Could not update fan speed: XNVCtrl SetAttr(THERMAL_COOLER_LEVEL) failed; error 0
ERROR - Could not update fan speed: XNVCtrl SetAttr(THERMAL_COOLER_LEVEL) failed; error 0
I’ve also lost ability to control the fan through nvidia-settings
even though I have coolbits set to 4 in my Xorg configuration. I can only change the fan speed when nvidia-settings
is ran as root. Otherwise it reports the following error:
$ nvidia-settings -a "[gpu:0]/GPUFanControlState=0"
ERROR: The current user does not have permission for operation
Attribute 'GPUFanControlState' (raven:0[gpu:0]) assigned value 0.
System info: nvidia-bug-report.log.gz (1.2 MB)
Has there been some breaking change in XNVCtrl?
Hope there’s a way to resolve this. Thank you.