Alan Bartlett Wed 22 May 08:08:23 EDT 2019 Attempts to build the turbostat binary, part of the tools sub-package, fails with the following error -- [Build64R7 linux-stable-tmp]$ make -C tools/power/x86/turbostat/ make: Entering directory `/home/bcat/tmp/turbostat/linux-stable-tmp/tools/power/x86/turbostat' gcc -Wall -I../../../include -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' turbostat.c -o /home/bcat/tmp/turbostat/linux-stable-tmp/tools/power/x86/turbostat/turbostat In file included from turbostat.c:23:0: ../../../../arch/x86/include/asm/msr-index.h:4:24: fatal error: linux/bits.h: No such file or directory #include ^ compilation terminated. make: *** [turbostat] Error 1 make: Leaving directory `/home/bcat/tmp/turbostat/linux-stable-tmp/tools/power/x86/turbostat' [Build64R7 linux-stable-tmp]$ A bisection of the source tree discloses the following bad commit -- 683f9fba8c27817b6c2f7320a4095ca353022651 is the first bad commit commit 683f9fba8c27817b6c2f7320a4095ca353022651 Author: Thomas Gleixner Date: Thu Feb 21 12:36:50 2019 +0100 x86/msr-index: Cleanup bit defines commit d8eabc37310a92df40d07c5a8afc53cebf996716 upstream. Greg pointed out that speculation related bit defines are using (1 << N) format instead of BIT(N). Aside of that (1 << N) is wrong as it should use 1UL at least. Clean it up. [ Josh Poimboeuf: Fix tools build ] Reported-by: Greg Kroah-Hartman Signed-off-by: Thomas Gleixner Reviewed-by: Greg Kroah-Hartman Reviewed-by: Borislav Petkov Reviewed-by: Frederic Weisbecker Reviewed-by: Jon Masters Tested-by: Jon Masters [bwh: Backported to 4.4: - Drop change to x86_energy_perf_policy, which doesn't use msr-index.h here - Drop changes to flush MSRs which we haven't defined] Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman :040000 040000 0ce430a14e73eef1007bf1558693e75e95ffe39a 3ab5675ed0798fc61e7d67ade87ac58dbbf33756 M arch :040000 040000 d45f1a90570a44d8924711e56280cde7041328de c603a03d7801225fb15869d1386224f793f1ba1d M tools Examination of the commit shows that the problem originates in the second of the two patches that were applied. Fix it by patching the tools/power/x86/turbostat/{Makefile,turbostat.c} files. diff -Npru a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile --- a/tools/power/x86/turbostat/Makefile 2019-05-16 13:45:18.000000000 -0400 +++ b/tools/power/x86/turbostat/Makefile 2019-05-21 10:19:21.580477034 -0400 @@ -8,8 +8,7 @@ ifeq ("$(origin O)", "command line") endif turbostat : turbostat.c -CFLAGS += -Wall -I../../../include -CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' +CFLAGS += -Wall %: %.c @mkdir -p $(BUILD_OUTPUT) diff -Npru a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c --- a/tools/power/x86/turbostat/turbostat.c 2019-05-16 13:45:18.000000000 -0400 +++ b/tools/power/x86/turbostat/turbostat.c 2019-05-21 10:29:58.007236178 -0400 @@ -20,7 +20,7 @@ */ #define _GNU_SOURCE -#include MSRHEADER +#include #include #include #include