lkml.org 
[lkml]   [2016]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] dynamic_debug: only add header when used
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

\
 
 \ /
  Last update: 2016-07-14 01:01    [W:0.043 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site