fix(cpu): don't panic when SMT cannot be enabled - #38
Open
6jrx wants to merge 1 commit into
Open
Conversation
Cpu::new() unwrapped the result of opening /sys/devices/system/cpu/smt/control for writing, so PowerStation aborted during startup on any system where that knob is absent, e.g. a kernel built without CONFIG_HOTPLUG_SMT, or where /sys is not writable. It is the first thing main() does, so nothing else got a chance to run. Every other user of that path turns the error into a DBus error rather than panicking. Log it and carry on here as well. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cpu::new()unwraps the result of opening/sys/devices/system/cpu/smt/controlfor writing:https://github.com/ShadowBlip/PowerStation/blob/v0.8.1/src/performance/cpu/cpu_features.rs#L29-L31
That knob only exists when the kernel is built with
CONFIG_HOTPLUG_SMT, and/sysisn't always writable. When either is the case the daemon aborts, and sinceCpu::new()is the first thingmain()does, nothing else gets a chance to run — no GPU discovery, no DBus interfaces, no log line explaining why.Reproducing it is as easy as starting PowerStation somewhere
/sysis read-only:After:
Both
set_smt_enabled()andset_boost_enabled()already turn the same kind of failure into a DBus error rather than panicking, so this only brings startup in line with the rest of the file. Behaviour on a system where the write does succeed is unchanged.Found while testing #37; unrelated to it, so it's on its own branch off
main.