All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/2] printk: Remove cyclic include dependencies with printk.h
@ 2022-01-11 14:30 Petr Mladek
  2022-01-11 14:30 ` [RFC 1/2] printk/dynamic_debug: Remove cyclic dependency between printk.h and dynamic_debug.h Petr Mladek
  2022-01-11 14:30 ` [RFC 2/2] printk/bug: Remove cyclic dependency between bug.h and printk.h Petr Mladek
  0 siblings, 2 replies; 13+ messages in thread
From: Petr Mladek @ 2022-01-11 14:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: John Ogness, Sergey Senozhatsky, Steven Rostedt,
	Rasmus Villemoes, Chris Down, Marc Zyngier, Andrew Scull,
	Will Deacon, Jason Baron, Peter Zijlstra, Josh Poimboeuf,
	linux-kernel, Petr Mladek

"make headerdep" reports two cycles where printk.h is involved. Both are
a bit complicated. All involved headers provide inlined functions that
have to be inlined because they add caller-specific metadata.

There are several possible solutions:

1. Ignore the problem because the cycles do not cause any real problem
   at the moment. I would say that it works by chance. See the patches
   for more details.


2. Move the printk-calls from the headers into .c sources so that printk.h
   is included in .c instead of .h. It is relatively easy except that it
   makes the code a bit more complicated.


3. Use a simple declaration somewhere. It is problematic because
   the inlined functions are more complex.

   But printk() is complex because it adds metadata for the list
   of strings in /sys/kernel/debug/printk/index. The index already misses
   a lot of strings that are printed via some subsystem specific wrappers.
   It should be acceptable to miss the few strings used in the affected
   headers.


This patchset implements the 3rd solution. It does not complicate
the existing code. It is quite the opposite. It splits the long
printk.h. It puts some low-level definitions into separate printk_core.h.
The lightweight header file might be useful also in other situations.

What do you think, please?

Petr Mladek (2):
  printk/dynamic_debug: Remove cyclic dependency between printk.h and
    dynamic_debug.h
  printk/bug: Remove cyclic dependency between bug.h and printk.h

 MAINTAINERS                   |  1 +
 include/asm-generic/bug.h     |  4 +-
 include/linux/dynamic_debug.h | 10 ++--
 include/linux/printk.h        | 68 +--------------------------
 include/linux/printk_core.h   | 87 +++++++++++++++++++++++++++++++++++
 5 files changed, 96 insertions(+), 74 deletions(-)
 create mode 100644 include/linux/printk_core.h

-- 
2.26.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-01-17 22:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 14:30 [RFC 0/2] printk: Remove cyclic include dependencies with printk.h Petr Mladek
2022-01-11 14:30 ` [RFC 1/2] printk/dynamic_debug: Remove cyclic dependency between printk.h and dynamic_debug.h Petr Mladek
2022-01-11 14:53   ` Chris Down
2022-01-11 16:01   ` Rasmus Villemoes
2022-01-12 12:12     ` Petr Mladek
2022-01-13  3:38       ` jim.cromie
2022-01-13  8:35         ` Petr Mladek
2022-01-17 22:39           ` jim.cromie
2022-01-13  9:02       ` Rasmus Villemoes
2022-01-11 14:30 ` [RFC 2/2] printk/bug: Remove cyclic dependency between bug.h and printk.h Petr Mladek
2022-01-11 14:54   ` Chris Down
2022-01-11 15:57   ` kernel test robot
2022-01-11 17:09   ` kernel test robot

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.