Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amd-hybrid-graphics: fix race condition #21227

Merged
merged 1 commit into from Apr 28, 2017

Conversation

lheckemann
Copy link
Member

Motivation for this change

#19775

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

I'm really not sure about the correctness of my implementation. Feedback is very welcome!

@mention-bot
Copy link

@lheckemann, thanks for your PR! By analyzing the history of the files in this pull request, we identified @wkennington to be a potential reviewer.

ExecStart = "${pkgs.bash}/bin/sh -c 'echo -e \"IGD\\nOFF\" > /sys/kernel/debug/vgaswitcheroo/switch; exit 0'";
ExecStop = "${pkgs.bash}/bin/sh -c 'echo ON >/sys/kernel/debug/vgaswitcheroo/switch; exit 0'";
ExecStart = "${pkgs.bash}/bin/sh -c 'echo -e \"IGD\\nOFF\" > /sys/kernel/debug/vgaswitcheroo/switch'";
ExecStop = "${pkgs.bash}/bin/sh -c 'echo ON >/sys/kernel/debug/vgaswitcheroo/switch'";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why the exit 0's were there? / Why did you remove them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#19775 — they caused the script to fail silently. I don't know why they were there.

@lheckemann
Copy link
Member Author

lheckemann commented Dec 26, 2016 via email

@grahamc
Copy link
Member

grahamc commented Dec 27, 2016

LGTM, @wkennington can you take a look? OR someone with this hardware?

};
};
systemd.paths."vgaswitcheroo" = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on the motivation for this versus using unitConfig.ConditionPathExists in the above unit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, missed this — we want to start the unit once the path appears, not if it exists.

@@ -25,15 +25,22 @@
path = [ pkgs.bash ];
description = "Disable AMD Card";
after = [ "sys-kernel-debug.mount" ];
requires = [ "sys-kernel-debug.mount" ];
wantedBy = [ "multi-user.target" ];
before = [ "systemd-vconsole-setup.service" "display-manager.service" ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I'm a litt confused about the dependency graph here; previously this unit would be pulled in by the default target, but what pulls it in now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nevermind; I see it's supposed to be pulled in by the path unit below :)

@lheckemann
Copy link
Member Author

Since nobody else seems to be using this module and able to review the change, perhaps it would make sense to remove the module entirely? Nobody else has complained about it being broken, so either nobody else has encountered the race condition (seems unlikely to me) or nobody else is using it and it would be better off living only in my personal config.

@joachifm joachifm merged commit 0c40ea7 into NixOS:master Apr 28, 2017
@lheckemann lheckemann deleted the vgaswitcheroo branch April 28, 2017 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants