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

mesa: add patch to include driver path in cache key #44575

Merged
merged 1 commit into from Aug 9, 2018

Conversation

corngood
Copy link
Contributor

@corngood corngood commented Aug 6, 2018

Motivation for this change

Fixes #44183. Also see #44383.

Mesa uses shared library mtimes as a key to its shader cache, however everything in /nix/store has the same timestamp, so it may incorrectly use shaders from the wrong version of mesa/llvm. This has manifested itself as a complete system hang when booting a system on mesa 18.1 after previously using 18.0, or vice-versa.

This change adds the mesa driver store path to the cache key, which should make it sufficiently unique. I've tried to keep the patch as simple as possible for ease of maintenance, and I've tested it with 18.0 and 18.1.

I also tested booting with mesa 18.0 on my system which is currently using 18.1. It hangs without the patch, and works normally with it.

I have some ideas about how to upstream this, but it will probably require more intrusive changes which wouldn't be suitable for a nixpkgs patch.

@vcunat

edit: merged to staging because of mesa dependencies

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • 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/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

Mesa usually uses the timestamps of the llvm and driver shared libraries
as a cache key.  In /nix/store these are all zero, so we'll include
$(drivers) in the cache key, which should be unique for all combinations
of mesa and llvm versions.
@vcunat vcunat merged commit 0a18b91 into NixOS:staging Aug 9, 2018
vcunat added a commit that referenced this pull request Aug 9, 2018
@vcunat
Copy link
Member

vcunat commented Aug 9, 2018

It's a shame that these things are mass rebuilds; plan for future: #44831

@dezgeg
Copy link
Contributor

dezgeg commented Aug 10, 2018

I have some ideas about how to upstream this, but it will probably require more intrusive changes which wouldn't be suitable for a nixpkgs patch.

Wouldn't an autoconf option that eventually sets the DISK_CACHE_KEY be mostly enough?

@corngood
Copy link
Contributor Author

@dezgeg Yeah, that's probably the way to go. I was thinking it would be nice to change the function->timestamp helper to return a blob containing the absolute path and timestamp, but that's probably more trouble than it's worth.

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