mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
feat: add support for not cleaning up clocks table on shutdown (#133)
This commit is contained in:
@@ -20,6 +20,8 @@ pub struct Config {
|
||||
pub struct Daemon {
|
||||
pub log_level: String,
|
||||
pub admin_groups: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub disable_clocks_cleanup: bool,
|
||||
}
|
||||
|
||||
impl Default for Daemon {
|
||||
@@ -27,6 +29,7 @@ impl Default for Daemon {
|
||||
Self {
|
||||
log_level: "info".to_owned(),
|
||||
admin_groups: DEFAULT_ADMIN_GROUPS.map(str::to_owned).to_vec(),
|
||||
disable_clocks_cleanup: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,6 +441,8 @@ impl GpuController {
|
||||
table.set_max_voltage(voltage)?;
|
||||
}
|
||||
|
||||
debug!("writing clocks commands: {:#?}", table.get_commands()?);
|
||||
|
||||
self.handle
|
||||
.set_clocks_table(&table)
|
||||
.context("Could not write clocks table")?;
|
||||
|
||||
@@ -258,10 +258,17 @@ impl<'a> Handler {
|
||||
}
|
||||
|
||||
pub async fn cleanup(self) {
|
||||
let disable_clocks_cleanup = self
|
||||
.config
|
||||
.try_read()
|
||||
.map(|config| config.daemon.disable_clocks_cleanup)
|
||||
.unwrap_or(false);
|
||||
|
||||
for (id, controller) in self.gpu_controllers.iter() {
|
||||
if controller.handle.get_clocks_table().is_ok() {
|
||||
if !disable_clocks_cleanup && controller.handle.get_clocks_table().is_ok() {
|
||||
debug!("resetting clocks table");
|
||||
if let Err(err) = controller.handle.reset_clocks_table() {
|
||||
error!("Could not reset the clocks table: {err}");
|
||||
error!("could not reset the clocks table: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user