Bug 202917

Summary: Kernel does not compile on AMD system (compiler warnings)
Product: Platform Specific/Hardware Reporter: mmelchert (michael.melchert)
Component: x86-64Assignee: platform_x86_64 (platform_x86_64)
Status: RESOLVED CODE_FIX    
Severity: normal CC: uvladimir
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 4.19.29 Subsystem:
Regression: No Bisected commit-id:
Attachments: working ./arch/x86/events/perf_event.h

Description mmelchert 2019-03-14 09:38:21 UTC
compared to 4.19.28 the new release doesnt compile due to warnings.


...
tatement -Wno-pointer-sign -fno-strict-overflow -fno-merge-all-constants 
-fmerge-constants -fno-stack-check -fconserve-stack -Werror=implicit-int
 -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types 
-Werror=designated-init    -DKBUILD_BASENAME='"core"' -DKBUILD_MODNAME='"core"'
 -c -o arch/x86/events/core.o arch/x86/events/core.c

In file included from arch/x86/events/core.c:44:0:
arch/x86/events/perf_event.h:1033:45: warning: ‘struct cpu_hw_event’ declaredinside parameter list will not be visible outside of this definition or declaration
 static inline int intel_cpuc_prepare(struct cpu_hw_event *cpuc, int cpu)
                                             ^~~~~~~~~~~~
arch/x86/events/perf_event.h:1038:45: warning: ‘struct cpu_hw_event’ declared inside parameter list will not be visible outside of this definition or declaration
 static inline void intel_cpuc_finish(struct cpu_hw_event *cpuc)
                                             ^~~~~~~~~~~~
arch/x86/events/core.c: In function ‘free_fake_cpuc’:
arch/x86/events/core.c:1973:20: error: passing argument 1 of ‘intel_cpuc_finish’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  intel_cpuc_finish(cpuc);
                    ^~~~
In file included from arch/x86/events/core.c:44:0:
arch/x86/events/perf_event.h:1038:20: note: expected ‘struct cpu_hw_event *’ but argument is of type ‘struct cpu_hw_events *’
 static inline void intel_cpuc_finish(struct cpu_hw_event *cpuc)
                    ^~~~~~~~~~~~~~~~~
arch/x86/events/core.c: In function ‘allocate_fake_cpuc’:
arch/x86/events/core.c:1987:25: error: passing argument 1 of ‘intel_cpuc_prepare’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  if (intel_cpuc_prepare(cpuc, cpu))
                         ^~~~
In file included from arch/x86/events/core.c:44:0:
arch/x86/events/perf_event.h:1033:19: note: expected ‘struct cpu_hw_event *’ but argument is of type ‘struct cpu_hw_events *’
 static inline int intel_cpuc_prepare(struct cpu_hw_event *cpuc, int cpu)
                   ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:304: arch/x86/events/core.o] Error 1
make[1]: *** [scripts/Makefile.build:544: arch/x86/events] Error 2
make: *** [Makefile:1047: arch/x86] Error 2
...


using identical .config and compiler (gcc-7.4.0) 
I suppose I could make it compile but I think somebody more
familiar with the code could fix it properly.
let me know if you need the .config or additional info


Michael
Comment 1 mmelchert 2019-03-14 11:59:20 UTC
fixed it myself. must be a simple typo since
prototypes and following functions 
in ./arch/x86/events/perf_event.h
carry different datatypes for parameter

static inline int intel_cpuc_prepare()
static inline void intel_cpuc_finish()

Michael
Comment 2 mmelchert 2019-03-15 08:40:54 UTC
Created attachment 281845 [details]
working ./arch/x86/events/perf_event.h

fixed typo in perf_event.h for 4.19.29.
Comment 3 Vlad 2019-03-15 23:43:27 UTC
*** Bug 202933 has been marked as a duplicate of this bug. ***
Comment 4 mmelchert 2019-03-16 09:05:39 UTC
Peter Zijlstra already patched the code. 
I assume it will go directly into the different trees
and will be fixed with the next release.

https://lkml.org/lkml/2019/3/15/86