Re: [FYI PATCH 1/1] tools arch x86: Sync the msr-index.h copy with the kernel sources

From: Arnaldo Carvalho de Melo
Date: Thu May 26 2022 - 14:24:03 EST


Em Thu, May 26, 2022 at 04:50:47PM +0000, Luck, Tony escreveu:
> Sorry for being part of the problem with this getting out of sync.

There is no problem to be sorry for :-)

> But, remind me again why tools has *copies* of this and other files.

We used not to have copies, using kernel headers directly. From time to
time tools/perf broke due to legitimate kernel hacking. At some point
Linus complained about such direct usage. Then we adopted the current
model.

The way these headers are used in perf are not restricted to just
including them to compile something. There are, as described in the log
message for this sync, scripts that convert defines into string tables,
etc, so some change may break one of these scripts, or new MSRs may use
some different #define pattern, etc.

Having the tools/perf/check-headers.sh script, part of building tools,
point out new changes in the original files lets people check what
happened and sometimes just do as I did, update.

>o Seems like pointless work to keep them in sync.

I hope to have clarified.

- Arnaldo