From: Paul Bolle <pebolle@tiscali.nl>
To: Tom Zanussi <tom.zanussi@linux.intel.com>
Cc: rostedt@goodmis.org, masami.hiramatsu.pt@hitachi.com,
namhyung@kernel.org, andi@firstfloor.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 5/7] tracing: Add 'hist' event trigger command
Date: Sat, 04 Apr 2015 17:14:56 +0200 [thread overview]
Message-ID: <1428160496.7898.132.camel@x220> (raw)
In-Reply-To: <9fe50519aa2cac1550b40a0e396dd721eff03574.1428072891.git.tom.zanussi@linux.intel.com>
What follows are a bunch of questions, and not really review remarks,
triggered by the fact that <linux/module.h> is included here for reasons
that were not really obvious when scanning the patch.
TL,DR:
- why does trace_events_hist.c include <linux/module.h>?
- why doesn't <linux/kallsyms.h> include <linux/module.h> instead?
- why does <linux/ftrace.h> still include <linux/kallsyms.h>?
- and why doesn't trace_events_hist.c include <linux/kallsyms.h>
directly instead?
Even shorter: shouldn't these files include the headers they need
directly and not rely on other headers to pull them in?
On Fri, 2015-04-03 at 10:51 -0500, Tom Zanussi wrote:
> --- a/kernel/trace/Kconfig
> +++ b/kernel/trace/Kconfig
> +config HIST_TRIGGERS
> + bool "Histogram triggers"
> + depends on ARCH_HAVE_NMI_SAFE_CMPXCHG
> + help
> + [...]
> --- a/kernel/trace/Makefile
> +++ b/kernel/trace/Makefile
> +obj-$(CONFIG_HIST_TRIGGERS) += trace_events_hist.o
To make sure I'm parsing this Makefile correctly: trace_events_hist.o
will never be part of a module, right?
> --- /dev/null
> +++ b/kernel/trace/trace_events_hist.c
> +#include <linux/module.h>
When scanning this patch I wondered why this include was needed. Because
this file will never be part of a module and I can't spot anything
obviously module related in the code.
But deleting that include triggers errors when building
trace_events_hist.o:
In file included from include/linux/ftrace.h:10:0,
from kernel/trace/trace.h:12,
from kernel/trace/trace_events_hist.c:30:
kernel/trace/trace_events_hist.c: In function ‘hist_trigger_stacktrace_print’:
include/linux/kallsyms.h:14:31: error: ‘MODULE_NAME_LEN’ undeclared (first use in this function)
2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
^
kernel/trace/trace_events_hist.c:901:11: note: in expansion of macro ‘KSYM_SYMBOL_LEN’
char str[KSYM_SYMBOL_LEN];
^
include/linux/kallsyms.h:14:31: note: each undeclared identifier is reported only once for each function it appears in
2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
^
[...]
Looking into that I noticed that <linux/kallsyms.h> doesn't include
<linux/module.h>, even though it uses MODULE_NAME_LEN. So shouldn't it
include that header too?
The error I quoted above shows that <linux/kallsyms.h> is included
indirectly (via "trace.h" and <linux/ftrace.h>). But <linux/ftrace.h>
itself doesn't use anything from <linux/kallsyms.h>[0]. So I wonder why
<linux/ftrace.h> still includes <linux/kallsyms.h>. Just so that other
files can rely on it to be pulled in if they include <linux/ftrace.h>?
See for instance trace_events_hist.c, which I'm discussing here. It uses
things like KSYM_SYMBOL_LEN, so shouldn't it include <linux/kallsyms.h>
directly instead of relying of <linux/ftrace.h> to do so on its behalf?
Paul Bolle
[0] To be thorough: the need for <linux/ftrace.h> to include
<linux/kallsyms.h> _for itself_ probably ended with commit 9c24624727f6
("KSYM_SYMBOL_LEN fixes"), which shipped in v2.6.28.
next prev parent reply other threads:[~2015-04-04 15:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-03 15:51 [PATCH v3 0/7] tracing: 'hist' triggers Tom Zanussi
2015-04-03 15:51 ` [PATCH v3 1/7] tracing: Make ftrace_event_field checking functions available Tom Zanussi
2015-04-03 15:51 ` [PATCH v3 2/7] tracing: Add event record param to trigger_ops.func() Tom Zanussi
2015-04-03 15:51 ` [PATCH v3 3/7] tracing: Add get_syscall_name() Tom Zanussi
2015-04-03 15:51 ` [PATCH v3 4/7] tracing: Add a per-event-trigger 'paused' field Tom Zanussi
2015-04-03 15:51 ` [PATCH v3 5/7] tracing: Add 'hist' event trigger command Tom Zanussi
2015-04-04 15:14 ` Paul Bolle [this message]
2015-04-04 20:09 ` Tom Zanussi
2015-04-04 20:56 ` Paul Bolle
2015-04-04 21:06 ` Tom Zanussi
2015-04-06 15:55 ` Steven Rostedt
2015-04-06 15:50 ` Steven Rostedt
2015-04-06 16:19 ` Paul Bolle
2015-04-06 16:25 ` Steven Rostedt
2015-04-06 18:07 ` Paul Bolle
2015-04-04 15:36 ` Alexei Starovoitov
2015-04-04 20:25 ` Tom Zanussi
2015-04-03 15:51 ` [PATCH v3 6/7] tracing: Add enable_hist/disable_hist triggers Tom Zanussi
2015-04-03 15:51 ` [PATCH v3 7/7] tracing: Add 'hist' trigger Documentation Tom Zanussi
2015-04-13 21:18 ` [PATCH v3 0/7] tracing: 'hist' triggers Steven Rostedt
2015-04-13 21:49 ` Tom Zanussi
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=1428160496.7898.132.camel@x220 \
--to=pebolle@tiscali.nl \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=namhyung@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tom.zanussi@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox