Subject: Re: linux-next: build failure after merge of the tip tree

From: Athira Rajeev <[email-masked]>
Date: Thu, 24 Apr 2025 22:03:05 +0530

> On 24 Apr 2025, at 8:07 PM, Athira Rajeev <[email-masked]> wrote:
> 
> 
> 
>> On 22 Apr 2025, at 3:26 PM, Shrikanth Hegde <[email-masked]> wrote:
>> 
>> 
>> 
>> On 4/22/25 12:05, Stephen Rothwell wrote:
>>> Hi all,
>> 
>> Hi Ingo, Stephen.
>> 
>>> On Thu, 17 Apr 2025 13:49:59 +1000 Stephen Rothwell <[email-masked]> wrote:
>>>> 
>>>> On Tue, 15 Apr 2025 13:35:18 +1000 Stephen Rothwell <[email-masked]> wrote:
>>>>> 
>>>>> After merging the tip tree, today's linux-next build (native perf)
>>>>> failed like this:
>>>>> 
>>>>> diff: tools/arch/x86/include/asm/amd/ibs.h: No such file or directory
>>>>> In file included from util/amd-sample-raw.c:12:
>>>>> tools/include/../../arch/x86/include/asm/amd/ibs.h:10:10: fatal error: asm/msr-index.h: No such file or directory
>>>>>   10 | #include <asm/msr-index.h>
>>>>>      |          ^~~~~~~~~~~~~~~~~
>>>>> compilation terminated.
>>>>> 
>>>>> Maybe caused by commit
>>>>> 
>>>>>  3846389c03a8 ("x86/platform/amd: Move the <asm/amd-ibs.h> header to <asm/amd/ibs.h>")
>>>>> or associated commits?
>>>>> 
>> 
>> Even i am running into this error when building tools/perf on ppc64le. perf build works in 6.15-rc3,
>> but failed with tip/master.
>> 
>> Did git bisect
>> good: [9c32cda43eb78f78c73aee4aa344b777714e259b] Linux 6.15-rc3
>> bad: [1a11b5b80f46e4dff0b21cb07efab43dee049d61] Merge branch into tip master: 'x86/sev'
>> ...
>> # first bad commit: [3846389c03a8518884f09056611619bd1461ffc7] x86/platform/amd: Move the <asm/amd-ibs.h> header to <asm/amd/ibs.h>
> 
> Before this commit, msr-index.h was present in tools/arch/x86/include/asm/msr-index.h
> amd-ibs.h was present in tools/arch/x86/include/asm/amd-ibs.h
> 
> From amd-ibs.h , it picks mss-index.h from :
> 
> # grep msr-index tools/arch/x86/include/asm/amd-ibs.h
> #include "msr-index.h”
> 
> After the commit, 
> make initial logs shows missing “tools/arch/x86/include/asm/amd/ibs.h”
> 
> # make
>  BUILD:   Doing 'make -j24' parallel build
> diff: tools/arch/x86/include/asm/amd/ibs.h: No such file or directory                                   
> Warning: Kernel ABI header differences:
>  diff -u tools/include/uapi/linux/bits.h include/uapi/linux/bits.h
>  diff -u tools/include/linux/bits.h include/linux/bits.h
>  diff -u tools/include/vdso/unaligned.h include/vdso/unaligned.h
>  diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
>  diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
>  diff -u tools/arch/x86/include/asm/amd/ibs.h arch/x86/include/asm/amd/ibs.h
>  diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
> 
> Build failure here is:
> 
> In file included from util/amd-sample-raw.c:12:0:
> /root/bug/tip/tools/include/../../arch/x86/include/asm/amd/ibs.h:10:10: fatal error: asm/msr-index.h: No such file or directory
> #include <asm/msr-index.h>
>          ^~~~~~~~~~~~~~~~~
> compilation terminated.
Hi,

Posted the fix in mailing here: https://lore.kernel.org/linux-perf-users/[email-masked]/T/#u
Please share feedback if it fixes the compilation issue.

Thanks
Athira
> 
> 
> To fix, this needs change to add tools/arch/x86/include/asm/amd/ibs.h and also update the msr-index.h like below:
> 
> diff --git a/tools/arch/x86/include/asm/amd/ibs.h b/tools/arch/x86/include/asm/amd/ibs.h
> index 3ee5903982c2..bcca5dcb9148 100644
> --- a/tools/arch/x86/include/asm/amd/ibs.h
> +++ b/tools/arch/x86/include/asm/amd/ibs.h
> @@ -7,7 +7,7 @@
>  * 55898 Rev 0.35 - Feb 5, 2021
>  */
>  -#include <asm/msr-index.h>
> +#include <../msr-index.h>
>   /* IBS_OP_DATA2 DataSrc */
> #define IBS_DATA_SRC_LOC_CACHE                  2
> 
> Similar change was done for tools/arch/x86/include/asm/amd-ibs.h as well. Reference commit below:
> 
> commit dde994dd54fbf84f8fd14230de3477d552e42470
> Author: Kim Phillips <[email-masked]>
> Date:   Tue Aug 17 17:15:08 2021 -0500
> 
>    perf report: Add tools/arch/x86/include/asm/amd-ibs.h
>         This is a tools/-side patch for the patch that adds the original copy
>    of the IBS header file, in arch/x86/include/asm/.
>         We also add an entry to check-headers.sh, so future changes continue
>    to be copied.
>         Committer notes:
>         Had to add this
>           -#include <asm/msr-index.h>
>      +#include "msr-index.h"
>         And change the check-headers.sh entry to ignore this line when diffing
>    with the original kernel header.
> 
> Shirkanth, Stephen, Venkat
> 
> I will be sending a separate fix patch for this.
> 
> Thanks
> Athira
> 
>> 
>> 
>> It isn't able to find the file after rename. I did the below hack so that ibs.h finds the msr-index.h
>> Likely there is better way. for me, this helps to build tools/perf.
>> 
>> ---
>> 
>> diff --git a/arch/x86/include/asm/amd/ibs.h b/arch/x86/include/asm/amd/ibs.h
>> index 3ee5903982c2..ac3a36fc08b1 100644
>> --- a/arch/x86/include/asm/amd/ibs.h
>> +++ b/arch/x86/include/asm/amd/ibs.h
>> @@ -7,7 +7,7 @@
>> * 55898 Rev 0.35 - Feb 5, 2021
>> */
>> -#include <asm/msr-index.h>
>> +#include "../../asm/msr-index.h"
>> /* IBS_OP_DATA2 DataSrc */
>> #define IBS_DATA_SRC_LOC_CACHE                  2