Messages in this thread | | | From | Petr Mladek <> | Subject | [RFC 0/2] printk: Remove cyclic include dependencies with printk.h | Date | Tue, 11 Jan 2022 15:30:44 +0100 |
| |
"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
| |