bugfix: don't deadlock on change compute/vfio/compute

Closes: #86 #88
This commit is contained in:
Luke D. Jones
2021-05-15 22:22:36 +12:00
parent 895179fdad
commit e24b4858a4
5 changed files with 17 additions and 10 deletions

View File

@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
# [3.5.2] - 2021-05-15
### Changed
- Bugfix: prevent the hang on compute/integrated mode change
# [3.5.1] - 2021-04-25
### Changed
+ Anime:

2
Cargo.lock generated
View File

@@ -206,7 +206,7 @@ dependencies = [
[[package]]
name = "daemon"
version = "3.5.1"
version = "3.5.2"
dependencies = [
"env_logger",
"intel-pstate",

View File

@@ -13,4 +13,4 @@ opt-level = 1
[profile.bench]
debug = false
opt-level = 3
opt-level = 3

View File

@@ -1,6 +1,6 @@
[package]
name = "daemon"
version = "3.5.1"
version = "3.5.2"
license = "MPL-2.0"
readme = "README.md"
authors = ["Luke <luke@ljones.dev>"]

View File

@@ -1,3 +1,4 @@
use ::zbus::Connection;
use ctrl_gfx::error::GfxError;
use ctrl_gfx::*;
use ctrl_rog_bios::CtrlRogBios;
@@ -14,7 +15,6 @@ use std::{str::FromStr, sync::mpsc};
use std::{sync::Arc, sync::Mutex};
use sysfs_class::{PciDevice, SysClass};
use system::{GraphicsDevice, PciBus};
use ::zbus::{Connection};
use crate::*;
@@ -607,11 +607,14 @@ impl CtrlGraphics {
let bus = self.bus.clone();
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?;
info!("GFX: Graphics mode changed to {}", <&str>::from(vendor));
if let Ok(config) = self.config.lock() {
if matches!(vendor, GfxVendors::Compute | GfxVendors::Vfio)
&& config.gfx_save_compute_vfio
{
Self::save_gfx_mode(vendor, self.config.clone());
if matches!(vendor, GfxVendors::Compute | GfxVendors::Vfio) {
loop {
if let Ok(config) = self.config.try_lock() {
if config.gfx_save_compute_vfio {
Self::save_gfx_mode(vendor, self.config.clone());
}
return Ok(action_required);
}
}
}
}
@@ -625,7 +628,7 @@ impl CtrlGraphics {
let devices = self.nvidia.clone();
let bus = self.bus.clone();
let vfio_enable = if let Ok(config) = self.config.lock() {
let vfio_enable = if let Ok(config) = self.config.try_lock() {
config.gfx_vfio_enable
} else {
false