Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-19.03 52 lines 1.9 kB view raw
1From 2a1e32b4105fe95413a615a44d40938920ea1a19 Mon Sep 17 00:00:00 2001 2From: David McFarland <corngood@gmail.com> 3Date: Mon, 6 Aug 2018 15:52:11 -0300 4Subject: [PATCH] disk_cache: include dri driver path in cache key 5 6This fixes invalid cache hits on NixOS where all shared library 7timestamps in /nix/store are zero. 8--- 9 src/util/Makefile.am | 3 +++ 10 src/util/disk_cache.c | 3 +++ 11 2 files changed, 6 insertions(+) 12 13diff --git a/src/util/Makefile.am b/src/util/Makefile.am 14index bafb57439a..a22e2e41eb 100644 15--- a/src/util/Makefile.am 16+++ b/src/util/Makefile.am 17@@ -35,6 +35,9 @@ noinst_LTLIBRARIES = \ 18 libmesautil.la \ 19 libxmlconfig.la 20 21+AM_CFLAGS = \ 22+ -DDISK_CACHE_KEY=\"$(drivers)\" 23+ 24 AM_CPPFLAGS = \ 25 $(PTHREAD_CFLAGS) \ 26 -I$(top_srcdir)/include 27diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c 28index 368ec41792..071220b2ba 100644 29--- a/src/util/disk_cache.c 30+++ b/src/util/disk_cache.c 31@@ -388,8 +388,10 @@ disk_cache_create(const char *gpu_name, const char *driver_id, 32 33 /* Create driver id keys */ 34 size_t id_size = strlen(driver_id) + 1; 35+ size_t key_size = strlen(DISK_CACHE_KEY) + 1; 36 size_t gpu_name_size = strlen(gpu_name) + 1; 37 cache->driver_keys_blob_size += id_size; 38+ cache->driver_keys_blob_size += key_size; 39 cache->driver_keys_blob_size += gpu_name_size; 40 41 /* We sometimes store entire structs that contains a pointers in the cache, 42@@ -410,6 +412,7 @@ disk_cache_create(const char *gpu_name, const char *driver_id, 43 uint8_t *drv_key_blob = cache->driver_keys_blob; 44 DRV_KEY_CPY(drv_key_blob, &cache_version, cv_size) 45 DRV_KEY_CPY(drv_key_blob, driver_id, id_size) 46+ DRV_KEY_CPY(drv_key_blob, DISK_CACHE_KEY, key_size) 47 DRV_KEY_CPY(drv_key_blob, gpu_name, gpu_name_size) 48 DRV_KEY_CPY(drv_key_blob, &ptr_size, ptr_size_size) 49 DRV_KEY_CPY(drv_key_blob, &driver_flags, driver_flags_size) 50-- 512.19.1 52