Re: [PATCH net-next] tools: Fix MSG_SPLICE_PAGES build error in trace tools
From: Namhyung Kim
Date: Mon Jun 26 2023 - 17:31:57 EST
Hello,
Sorry I missed the conversation and the original change.
On Mon, Jun 26, 2023 at 6:56 AM Matthieu Baerts
<matthieu.baerts@xxxxxxxxxxxx> wrote:
>
> On 26/06/2023 15:50, David Howells wrote:
> > Matthieu Baerts <matthieu.baerts@xxxxxxxxxxxx> wrote:
> >
> >> So another issue. When checking the differences between the two files, I
> >> see there are still also other modifications to import, e.g. it looks
> >> like you also added MSG_INTERNAL_SENDMSG_FLAGS macro in socket.h. Do you
> >> plan to fix that too?
> >
> > That's just a list of other flags that we need to prevent userspace passing
> > in - it's not a flag in its own right.
>
> I agree. This file is not even used by C files, only by scripts parsing
> it if I'm not mistaken.
>
> But if there are differences with include/linux/socket.h, the warning I
> mentioned will be visible when compiling Perf.
Right, we want to keep the headers files in the tools in sync with
the kernel ones. And they are used to generate some tables.
Full explanation from Arnaldo below.
So I'm ok for the msg_flags.c changes, but please refrain from
changing the header directly. We will update it later.
With that,
Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
Also I wonder if the tool needs to keep the original flag
(SENDPAGE_NOTLAST) for the older kernels.
In Arnaldo's explanation:
There used to be no copies, with tools/ code 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.
They are sometimes used in 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.
E.g.:
$ ls -1 tools/perf/trace/beauty/*.sh | head -5
tools/perf/trace/beauty/arch_errno_names.sh
tools/perf/trace/beauty/drm_ioctl.sh
tools/perf/trace/beauty/fadvise.sh
tools/perf/trace/beauty/fsconfig.sh
tools/perf/trace/beauty/fsmount.sh
$
$ tools/perf/trace/beauty/fadvise.sh
static const char *fadvise_advices[] = {
[0] = "NORMAL",
[1] = "RANDOM",
[2] = "SEQUENTIAL",
[3] = "WILLNEED",
[4] = "DONTNEED",
[5] = "NOREUSE",
};
$
The tools/perf/check-headers.sh script, part of the tools/ build
process, points out changes in the original files.
So its important not to touch the copies in tools/ when doing changes in
the original kernel headers, that will be done later, when
check-headers.sh inform about the change to the perf tools hackers.