Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1442645 > unrolled thread
| Started by | Luis de Bethencourt <luisbg@osg.samsung.com> |
|---|---|
| First post | 2016-07-13 19:20 +0200 |
| Last post | 2016-07-14 00:30 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[RFC PATCH] dynamic_debug: only add header when used Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-07-13 19:20 +0200
Re: [RFC PATCH] dynamic_debug: only add header when used Andrew Morton <akpm@linux-foundation.org> - 2016-07-13 22:40 +0200
Re: [RFC PATCH] dynamic_debug: only add header when used Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-07-13 22:50 +0200
Re: [RFC PATCH] dynamic_debug: only add header when used Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-07-14 00:30 +0200
| From | Luis de Bethencourt <luisbg@osg.samsung.com> |
|---|---|
| Date | 2016-07-13 19:20 +0200 |
| Subject | [RFC PATCH] dynamic_debug: only add header when used |
| Message-ID | <rUvZf-63d-13@gated-at.bofh.it> |
kernel.h header doesn't directly use dynamic debug, instead we can include it in module.c (which used it via kernel.h). printk.h only uses it if CONFIG_DYNAMIC_DEBUG is on, changing the inclusion to only happen in that case. Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> --- Hi, While studying the problem that surfaced when adding #include <linux/kernel.h> in include/linux/string.h to have access to the MAX_SIZE macro [0]. I noticed that dynamic_debug.h is included in kernel.h even though it isn't necessary. Which in the case of adding kernel.h to string.h would mean a circular dependency. Not entirely sure if there is a reason for this beyond making dynamic debug available to module.c. Which is why I am sending this patch as an RFC. Thanks for the feedback, Luis [0] https://lkml.org/lkml/2016/7/11/753 include/linux/kernel.h | 1 - include/linux/printk.h | 3 ++- kernel/module.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index c420821..d96a611 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -11,7 +11,6 @@ #include <linux/log2.h> #include <linux/typecheck.h> #include <linux/printk.h> -#include <linux/dynamic_debug.h> #include <asm/byteorder.h> #include <uapi/linux/kernel.h> diff --git a/include/linux/printk.h b/include/linux/printk.h index 41ac0fc..c2158f0 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -307,10 +307,11 @@ asmlinkage __printf(1, 2) __cold void __pr_info(const char *fmt, ...); no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif -#include <linux/dynamic_debug.h> /* If you are writing a driver, please use dev_dbg instead */ #if defined(CONFIG_DYNAMIC_DEBUG) +#include <linux/dynamic_debug.h> + /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ #define pr_debug(fmt, ...) \ dynamic_pr_debug(fmt, ##__VA_ARGS__) diff --git a/kernel/module.c b/kernel/module.c index beaebea..e70a2fa 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -60,6 +60,7 @@ #include <linux/jump_label.h> #include <linux/pfn.h> #include <linux/bsearch.h> +#include <linux/dynamic_debug.h> #include <uapi/linux/module.h> #include "module-internal.h" -- 2.5.1
[toc] | [next] | [standalone]
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Date | 2016-07-13 22:40 +0200 |
| Message-ID | <rUz6N-83G-7@gated-at.bofh.it> |
| In reply to | #1442645 |
On Wed, 13 Jul 2016 18:09:53 +0100 Luis de Bethencourt <luisbg@osg.samsung.com> wrote: > kernel.h header doesn't directly use dynamic debug, instead we can include > it in module.c (which used it via kernel.h). printk.h only uses it if > CONFIG_DYNAMIC_DEBUG is on, changing the inclusion to only happen in that > case. > > Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> > --- > Hi, > > While studying the problem that surfaced when adding #include <linux/kernel.h> > in include/linux/string.h to have access to the MAX_SIZE macro [0]. I noticed > that dynamic_debug.h is included in kernel.h even though it isn't necessary. > Which in the case of adding kernel.h to string.h would mean a circular > dependency. > > Not entirely sure if there is a reason for this beyond making dynamic debug > available to module.c. Which is why I am sending this patch as an RFC. It would be good if we can do this. What is it in kernel.h that requires dynamic_debug.h? I tried your patch along with --- a/kernel/module.c~dynamic_debug-only-add-header-when-used-fix +++ a/kernel/module.c @@ -60,7 +60,6 @@ #include <linux/jump_label.h> #include <linux/pfn.h> #include <linux/bsearch.h> -#include <linux/dynamic_debug.h> #include <uapi/linux/module.h> #include "module-internal.h" and module.o builds OK.
[toc] | [prev] | [next] | [standalone]
| From | Luis de Bethencourt <luisbg@osg.samsung.com> |
|---|---|
| Date | 2016-07-13 22:50 +0200 |
| Message-ID | <rUzgv-87F-51@gated-at.bofh.it> |
| In reply to | #1442824 |
On 13/07/16 21:32, Andrew Morton wrote: > On Wed, 13 Jul 2016 18:09:53 +0100 Luis de Bethencourt <luisbg@osg.samsung.com> wrote: > >> kernel.h header doesn't directly use dynamic debug, instead we can include >> it in module.c (which used it via kernel.h). printk.h only uses it if >> CONFIG_DYNAMIC_DEBUG is on, changing the inclusion to only happen in that >> case. >> >> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> >> --- >> Hi, >> >> While studying the problem that surfaced when adding #include <linux/kernel.h> >> in include/linux/string.h to have access to the MAX_SIZE macro [0]. I noticed >> that dynamic_debug.h is included in kernel.h even though it isn't necessary. >> Which in the case of adding kernel.h to string.h would mean a circular >> dependency. >> >> Not entirely sure if there is a reason for this beyond making dynamic debug >> available to module.c. Which is why I am sending this patch as an RFC. > > It would be good if we can do this. > > What is it in kernel.h that requires dynamic_debug.h? I tried your > patch along with > > --- a/kernel/module.c~dynamic_debug-only-add-header-when-used-fix > +++ a/kernel/module.c > @@ -60,7 +60,6 @@ > #include <linux/jump_label.h> > #include <linux/pfn.h> > #include <linux/bsearch.h> > -#include <linux/dynamic_debug.h> > #include <uapi/linux/module.h> > #include "module-internal.h" > > and module.o builds OK. > Hi Andrew, Thanks for looking at this so quickly. The kbuild test robot has replied with one driver that needs to be changed as well for this to work. Will send a v2 in the next few hours. Thanks, Luis
[toc] | [prev] | [next] | [standalone]
| From | Luis de Bethencourt <luisbg@osg.samsung.com> |
|---|---|
| Date | 2016-07-14 00:30 +0200 |
| Message-ID | <rUAPf-Ph-9@gated-at.bofh.it> |
| In reply to | #1442824 |
On 13/07/16 21:32, Andrew Morton wrote: > On Wed, 13 Jul 2016 18:09:53 +0100 Luis de Bethencourt <luisbg@osg.samsung.com> wrote: > >> kernel.h header doesn't directly use dynamic debug, instead we can include >> it in module.c (which used it via kernel.h). printk.h only uses it if >> CONFIG_DYNAMIC_DEBUG is on, changing the inclusion to only happen in that >> case. >> >> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> >> --- >> Hi, >> >> While studying the problem that surfaced when adding #include <linux/kernel.h> >> in include/linux/string.h to have access to the MAX_SIZE macro [0]. I noticed >> that dynamic_debug.h is included in kernel.h even though it isn't necessary. >> Which in the case of adding kernel.h to string.h would mean a circular >> dependency. >> >> Not entirely sure if there is a reason for this beyond making dynamic debug >> available to module.c. Which is why I am sending this patch as an RFC. > > It would be good if we can do this. > > What is it in kernel.h that requires dynamic_debug.h? I tried your > patch along with > > --- a/kernel/module.c~dynamic_debug-only-add-header-when-used-fix > +++ a/kernel/module.c > @@ -60,7 +60,6 @@ > #include <linux/jump_label.h> > #include <linux/pfn.h> > #include <linux/bsearch.h> > -#include <linux/dynamic_debug.h> > #include <uapi/linux/module.h> > #include "module-internal.h" > > and module.o builds OK. > Hi Andrew, Replying to why dynamic_debug.h is needed in module.c, which I didn't explain before since I wanted to double-check. kernel/module.c only needs dynamic_debug.h when CONFIG_DYNAMIC_DEBUG is not set. Which is probably why you could build it in your side. If you deactivate that config you get an error in the two uses of ddebug_remove_module and one for ddebug_dyndbg_module_param_cb(). For example: ------------------------------------------------------ kernel/module.c: In function ‘free_module’: kernel/module.c:2080:2: error: implicit declaration of function ‘ddebug_remove_module’ [-Werror=implicit-function-declaration] ddebug_remove_module(mod->name); ------------------------------------------------------ By the way, since you added my patch in your -mm tree I resent with you listed as Signed-off-by, I hope that is OK. Let me know if it isn't for the future. Thanks :) Luis
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web