All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Randy Dunlap <rdunlap@xenotime.net>
Cc: dhowells@redhat.com, hpa@kernel.org, matthew@wil.cx,
	linux-arch@vger.kernel.org, ralf@linux-mips.org
Subject: Re: [PATCH 00/39] UAPI header file split [ver #2]
Date: Mon, 11 Jul 2011 15:38:10 +0100	[thread overview]
Message-ID: <17749.1310395090@redhat.com> (raw)
In-Reply-To: <20110710213827.2779b0c3.rdunlap@xenotime.net>

Randy Dunlap <rdunlap@xenotime.net> wrote:

> Could you give a small bit of background on the "recursion problems," please?

Well, I occasionally run into a problem where I can't write an inline function
in a header file because I need to access something from another headerfile
that includes this one.  Due to this, I end up writing it as a #define instead.

The problems are mainly due to inline functions.  If we split some headers
(linux/sched.h being the biggest culprit) to separate the inline functions from
the data structs (e.g. task_struct) then we could reduce the problems.

Quite often it's a case of an inline function in header A wanting a struct[*]
from header B, but header B already has an inline function that wants a struct
from header A.

[*] or constant or whatever.


Recently someone tried to add a kernel-offsets file (an analogue to
asm-offsets) to deal with the problems of dealing with both linux/rcupdate.h
and linux/sched.h.

> > (7) Provide a script to go through and rejig the #includes of each source
> >     file to have just the ones that are actually required.
> 
> How is "actually required" defined?
> We traditionally want to see #include <hdrfile> for any interfaces that are
> used, even if other header files suck in some other needed header files.

Yes, but with the amount of copy'n'paste going on, there are quite a lot of
unnecessary #includes in the codebase.  Furthermore, headers sometimes get
rearranged and new #includes added - and sometimes obsolete ones don't get
removed.

Whilst these aren't strictly a part of the recursion problem, what they do do
is slow down recompilation by causing recompilation of things that didn't
actually need it.

> >  (8) Provide a make target that tests all the KAPI and UAPI headers by
> >      simply passing them one at a time to the compiler and attempting to
> >      compile them.
> 
> Interesting.

If gcc can have its sources piped in, then this should be fairly
straightforward.  Admittedly, there may be some headers that can't go through
this process as they're meant to be #included after #defining some parameters,
but those can be flagged in some way.

> > The uapi/ directories are also added with -I to the CPP flags after the
> > include/ directories so that if the KAPI file does not exist, the UAPI file
> > will be used directly.  This is not as elegant as using #include_next might
> > be, but it does work.
> 
> Is this v2 patchset meant to avoid the use of #include_next?
> I don't see that used, but patch 22 description refers to #include_next.

Yeah...  I need to vet the patch descriptions.

Btw, what's your reason for disliking #include_next?  Note that the kernel
already uses it in places.

David

  reply	other threads:[~2011-07-11 14:38 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-08 14:22 [PATCH 00/39] UAPI header file split [ver #2] David Howells
2011-07-08 14:22 ` [PATCH [ver #2] 01/39] UAPI: Add script to convert #include "..." to #include <path/...> in sys headers David Howells
2011-07-08 14:23 ` [PATCH [ver #2] 02/39] UAPI: Convert #include "..." to #include <path/...> in kernel system headers David Howells
2011-07-08 14:23 ` [PATCH [ver #2] 03/39] UAPI: Add script to audit drivers/gpu/ for #including system headers with "..." David Howells
2011-07-08 14:23 ` [PATCH [ver #2] 05/39] UAPI: Add include/uapi/ directories to build David Howells
2011-07-08 14:23 ` [PATCH [ver #2] 06/39] UAPI: Differentiate userspace build and kernelspace build include path sets David Howells
2011-07-08 14:24 ` [PATCH [ver #2] 07/39] UAPI: Fix AHZ multiple inclusion when __KERNEL__ is removed David Howells
2011-07-08 14:24 ` [PATCH [ver #2] 08/39] UAPI: ac_etime in linux/acct.h must keep its __KERNEL__ guards David Howells
2011-07-08 14:24 ` [PATCH [ver #2] 09/39] UAPI: Make linux/patchkey.h easier to parse David Howells
2011-07-08 14:24 ` [PATCH [ver #2] 10/39] UAPI: Don't have a #elif clause in a __KERNEL__ guard in linux/soundcard.h David Howells
2011-07-08 14:24 ` [PATCH [ver #2] 11/39] UAPI: Fix nested __KERNEL__ guards in video/edid.h David Howells
2011-07-08 14:24 ` [PATCH [ver #2] 12/39] UAPI: Split trivial #if defined(__KERNEL__) && X conditionals David Howells
2011-07-08 14:25 ` [PATCH [ver #2] 13/39] UAPI: Remove the inclusion of linux/types.h from x86's asm/page.h David Howells
2011-07-08 14:25 ` [PATCH [ver #2] 14/39] UAPI: Fix definition of HZ in asm-generic/param.h David Howells
2011-07-08 14:25 ` [PATCH [ver #2] 15/39] UAPI: elf_read_implies_exec() is a kernel-only feature - so hide from userspace David Howells
2011-07-08 14:25 ` [PATCH [ver #2] 16/39] UAPI: Fix sigset_t ordering problem David Howells
2011-07-08 14:25 ` [PATCH [ver #2] 17/39] UAPI: Fix E820_X_MAX " David Howells
2011-07-08 14:25 ` [PATCH [ver #2] 18/39] UAPI: Fix linux/netfilter.h inclusion order David Howells
2011-07-08 14:26 ` [PATCH [ver #2] 19/39] UAPI: Fix linux/input.h " David Howells
2011-07-08 14:26 ` [PATCH [ver #2] 20/39] UAPI: Fix up linux/netfilter/xt_policy.h David Howells
2011-07-08 14:26 ` [PATCH [ver #2] 21/39] UAPI: Fix linux/auto_fs.h inclusion order David Howells
2011-07-08 14:26 ` [PATCH [ver #2] 22/39] UAPI: Fix drmP.h to use #include <...> when referring to system header files David Howells
2011-07-08 14:26 ` [PATCH [ver #2] 23/39] UAPI: sound/sound_core.c should include linux/fs.h David Howells
2011-07-08 14:26 ` [PATCH [ver #2] 24/39] UAPI: Fix SNDRV_*_ENDIAN ordering problem David Howells
2011-07-08 14:26 ` [PATCH [ver #2] 25/39] UAPI: Fix u_quad_t ordering problem in linux/coda.h David Howells
2011-07-08 14:27 ` [PATCH [ver #2] 26/39] UAPI: Fix linux/coda.h David Howells
2011-07-08 14:27 ` [PATCH [ver #2] 27/39] UAPI: Guard linux/isdn_divertif.h David Howells
2011-07-08 14:27 ` [PATCH [ver #2] 28/39] UAPI: Guard linux/sound.h David Howells
2011-07-08 14:27 ` [PATCH [ver #2] 29/39] UAPI: Fix linux/ncp.h David Howells
2011-07-08 14:27 ` [PATCH [ver #2] 30/39] UAPI: Fix x86_64 system call count and generation David Howells
2011-07-08 14:27 ` [PATCH [ver #2] 31/39] UAPI: Fix arch/mips/include/asm/Kbuild to have separate header-y lines David Howells
2011-07-08 16:04   ` Ralf Baechle
2011-07-08 14:28 ` [PATCH [ver #2] 32/39] UAPI: Add a script to create a commit to set up new UAPI dirs David Howells
2011-07-08 14:28 ` [PATCH [ver #2] 33/39] UAPI: Set up UAPI Kbuild files David Howells
2011-07-08 14:28 ` [PATCH [ver #2] 34/39] UAPI: Plumb the UAPI Kbuilds into the user header handling system David Howells
2011-07-08 14:28 ` [PATCH [ver #2] 35/39] UAPI: Set up uapi/asm/Kbuild.asm David Howells
2011-07-08 14:28 ` [PATCH [ver #2] 36/39] UAPI: Move linux/version.h David Howells
2011-07-08 14:29 ` [PATCH [ver #2] 37/39] UAPI: Make UAPI headers install to usr/include/ David Howells
2011-07-08 14:29 ` [PATCH [ver #2] 38/39] UAPI: Fix the page-types query program in the docs David Howells
2011-07-08 14:29 ` [PATCH [ver #2] 39/39] UAPI: Scripts to disintegrate header files David Howells
2011-07-11  4:38 ` [PATCH 00/39] UAPI header file split [ver #2] Randy Dunlap
2011-07-11 14:38   ` David Howells [this message]
2011-07-14 21:53 ` H. Peter Anvin

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=17749.1310395090@redhat.com \
    --to=dhowells@redhat.com \
    --cc=hpa@kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=ralf@linux-mips.org \
    --cc=rdunlap@xenotime.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.