fix: gracefully handle transient fan control errors

This commit is contained in:
Ilya Zlobintsev
2024-05-11 12:59:27 +03:00
parent 974e6ff442
commit aa670be9d6
11 changed files with 30 additions and 19 deletions

12
Cargo.lock generated
View File

@@ -1585,7 +1585,7 @@ dependencies = [
[[package]]
name = "lact"
version = "0.5.4"
version = "0.5.5"
dependencies = [
"anyhow",
"lact-cli",
@@ -1596,7 +1596,7 @@ dependencies = [
[[package]]
name = "lact-cli"
version = "0.5.4"
version = "0.5.5"
dependencies = [
"anyhow",
"lact-client",
@@ -1605,7 +1605,7 @@ dependencies = [
[[package]]
name = "lact-client"
version = "0.5.4"
version = "0.5.5"
dependencies = [
"amdgpu-sysfs",
"anyhow",
@@ -1618,7 +1618,7 @@ dependencies = [
[[package]]
name = "lact-daemon"
version = "0.5.4"
version = "0.5.5"
dependencies = [
"amdgpu-sysfs",
"anyhow",
@@ -1646,7 +1646,7 @@ dependencies = [
[[package]]
name = "lact-gui"
version = "0.5.4"
version = "0.5.5"
dependencies = [
"amdgpu-sysfs",
"anyhow",
@@ -1668,7 +1668,7 @@ dependencies = [
[[package]]
name = "lact-schema"
version = "0.5.4"
version = "0.5.5"
dependencies = [
"amdgpu-sysfs",
"anyhow",

View File

@@ -1,6 +1,6 @@
[package]
name = "lact-cli"
version = "0.5.4"
version = "0.5.5"
edition = "2021"
[dependencies]

View File

@@ -1,6 +1,6 @@
[package]
name = "lact-client"
version = "0.5.4"
version = "0.5.5"
edition = "2021"
[dependencies]

View File

@@ -1,6 +1,6 @@
[package]
name = "lact-daemon"
version = "0.5.4"
version = "0.5.5"
edition = "2021"
[features]

View File

@@ -35,7 +35,7 @@ use tokio::{
task::JoinHandle,
time::{sleep, timeout},
};
use tracing::{debug, error, trace, warn};
use tracing::{debug, error, info, trace, warn};
#[cfg(feature = "libdrm_amdgpu_sys")]
use {
lact_schema::DrmMemoryInfo,
@@ -470,6 +470,9 @@ impl GpuController {
let mut last_pwm = (None, Instant::now());
let mut last_temp = 0.0;
// If the fan speed could was able to be set at least once
let mut control_available = false;
let temp_key = settings.temperature_key.clone();
let interval = Duration::from_millis(settings.interval_ms);
let spindown_delay = Duration::from_millis(settings.spindown_delay_ms.unwrap_or(0));
@@ -513,9 +516,17 @@ impl GpuController {
trace!("fan control tick: setting pwm to {target_pwm}");
if let Err(err) = hw_mon.set_fan_pwm(target_pwm) {
error!("could not set fan speed: {err}, disabling fan control");
break;
match hw_mon.set_fan_pwm(target_pwm) {
Ok(()) => control_available = true,
Err(err) => {
error!("could not set fan speed: {err}");
if control_available {
info!("fan control was previously available, assuming the error is temporary");
} else {
info!("disabling fan control");
break;
}
}
}
}
debug!("exited fan control task");

View File

@@ -1,6 +1,6 @@
[package]
name = "lact-gui"
version = "0.5.4"
version = "0.5.5"
authors = ["Ilya Zlobintsev <ilya.zl@protonmail.com>"]
edition = "2021"

View File

@@ -1,6 +1,6 @@
[package]
name = "lact-schema"
version = "0.5.4"
version = "0.5.5"
edition = "2021"
[features]

View File

@@ -1,6 +1,6 @@
[package]
name = "lact"
version = "0.5.4"
version = "0.5.5"
edition = "2021"
[features]

View File

@@ -3,7 +3,7 @@ metadata:
description: AMDGPU control utility
arch: x86_64
license: MIT
version: 0.5.4
version: 0.5.5
maintainer: ilya-zlobintsev
url: https://github.com/ilya-zlobintsev/lact
source:

View File

@@ -3,7 +3,7 @@ metadata:
description: AMDGPU control utility
arch: x86_64
license: MIT
version: 0.5.4
version: 0.5.5
maintainer: ilya-zlobintsev
url: https://github.com/ilya-zlobintsev/lact
source:

View File

@@ -3,7 +3,7 @@ metadata:
description: AMDGPU control utility
arch: x86_64
license: MIT
version: 0.5.4
version: 0.5.5
maintainer: ilya-zlobintsev
url: https://github.com/ilya-zlobintsev/lact
source: