public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: linux-kernel@vger.kernel.org, "Willy Tarreau" <w@1wt.eu>,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	willy@infradead.org, "Namhyung Kim" <namhyung@kernel.org>
Subject: Re: limits.h in tools/
Date: Tue, 23 Apr 2024 17:07:45 -0300	[thread overview]
Message-ID: <ZigVEdYKyYw36NoM@x1> (raw)
In-Reply-To: <ZigMG8ZsBryO57zz@smile.fi.intel.com>

On Tue, Apr 23, 2024 at 10:29:31PM +0300, Andy Shevchenko wrote:
> On Tue, Apr 23, 2024 at 04:22:01PM -0300, Arnaldo Carvalho de Melo wrote:
> > On Tue, Apr 23, 2024 at 09:58:07PM +0300, Andy Shevchenko wrote:
> > > It seems tons of the code in tools include linux/limits.h. But I haven't found
> > > where do we copy it. Any pointers?

> > > Based on the discussion 20220603183231.15159C385A9@smtp.kernel.org.

<SNIP>

> > But then is for building tools/, not the kernel, right? The discussion
> > you said this question was based on is about changing
> > include/linux/xarray.h, a kernel file, so should really be including
> > just kernel headers, files in the kernel source tree, outside tools/, I
> > don't see where what tools/ uses to build is relevant here? Can you
> > please elaborate?
> 
> I believe the tool in question is tools/testing/radix-tree/xarray.c.

And it is including stuff from the kernel directly, something we stopped
doing long ago in tools/ to avoid breakage when a kernel developer
changes kernel code:

⬢[acme@toolbox perf-tools-next]$ cd tools/testing/radix-tree/
⬢[acme@toolbox radix-tree]$ grep -A1 -- -I Makefile 
# SPDX-License-Identifier: GPL-2.0

CFLAGS += -I. -I../../include -I../../../lib -g -Og -Wall \
	  -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined
⬢[acme@toolbox radix-tree]$ realpath ../../include
/home/acme/git/perf-tools-next/tools/include

So far so good, no kernel files included, only tools/ stuff, but then:

⬢[acme@toolbox radix-tree]$ grep xarray *.c | grep include
xarray.c:#include "../../../lib/xarray.c"
xarray.c:#include "../../../lib/test_xarray.c"
⬢[acme@toolbox radix-tree]$ realpath ../../../lib/xarray.c
/home/acme/git/perf-tools-next/lib/xarray.c
⬢[acme@toolbox radix-tree]$

And this in turn will:

⬢[acme@toolbox radix-tree]$ grep ^#include  ../../../lib/xarray.c
#include <linux/bitmap.h>
#include <linux/export.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/xarray.h>
#include "radix-tree.h"
⬢[acme@toolbox radix-tree]$

Includes kernel headers, as it _is_ kernel code.

Perhaps since it does that we need to add -I../../../include to the
include path to really include kernel headers?

⬢[acme@toolbox radix-tree]$ pwd
/home/acme/git/perf-tools-next/tools/testing/radix-tree
⬢[acme@toolbox radix-tree]$ realpath ../../../include
/home/acme/git/perf-tools-next/include
⬢[acme@toolbox radix-tree]$

- Arnaldo

      parent reply	other threads:[~2024-04-23 20:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 18:58 limits.h in tools/ Andy Shevchenko
2024-04-23 19:22 ` Arnaldo Carvalho de Melo
2024-04-23 19:29   ` Andy Shevchenko
2024-04-23 19:30     ` Andy Shevchenko
2024-04-24 13:46       ` Liam R. Howlett
2024-04-24 14:19         ` Andy Shevchenko
2024-04-24 14:40           ` Liam R. Howlett
2024-04-24 14:46             ` Liam R. Howlett
2024-04-24 14:19         ` Arnaldo Carvalho de Melo
2024-04-23 20:07     ` Arnaldo Carvalho de Melo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZigVEdYKyYw36NoM@x1 \
    --to=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=namhyung@kernel.org \
    --cc=w@1wt.eu \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox