lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 22 Jul 2021 11:02:12 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Zhang Jianhua <chris.zjh@...wei.com>
Cc:     <corbet@....net>, <paul.walmsley@...ive.com>, <palmer@...belt.com>,
        <aou@...s.berkeley.edu>, <linux-doc@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <linux-riscv@...ts.infradead.org>
Subject: Re: [PATCH -next] trace doc: Fix the wrong example of tracepoint

On Tue, 20 Jul 2021 10:06:07 +0800
Zhang Jianhua <chris.zjh@...wei.com> wrote:

> The example in tracepoints.rst is out of date, the build error below
> will occur if coding according to example in the document.
> 
> drivers/irqchip/irq-riscv-intc.c:24:24:
> error: macro "DEFINE_TRACE" requires 3 arguments, but only 1 given
>    24 | DEFINE_TRACE(test_event);
>       |                        ^
> In file included from include/trace/events/test.h:8,
> from drivers/irqchip/irq-riscv-intc.c:22:
> include/linux/tracepoint.h:368:
> note: macro "DEFINE_TRACE" defined here
>   368 | #define DEFINE_TRACE(name, proto, args)
>       |
> drivers/irqchip/irq-riscv-intc.c:24:1:
> warning: data definition has no type or storage class
>    24 | DEFINE_TRACE(test_event);
>       | ^~~~~~~~~~~~
> drivers/irqchip/irq-riscv-intc.c:24:1:
> error: type defaults to ‘int’ in declaration of ‘DEFINE_TRACE’
> [-Werror=implicit-int]
> 
> There are two reasons for this error. On the one hand, the macro DEFINE_TRACE
> has been refactored in commit d25e37d89dd2 ("tracepoint: Optimize using
> static_call()") from DEFINE_TRACE(name) to DEFINE_TRACE(name, proto, args),
> and the doc is not updated in time. On the other hand, the tracepoint has been
> defined in header file, and it does not need to define repeatedly in C file.

Actually, the above is not quite correct.

By removing DEFINE_TRACE() you just removed the tracepoint entirely,
making it non-existent. This is a very old document and probably has a
lot more wrong with it than just this.

But for this case, you probably want it to read:

        #define CREATE_TRACE_POINTS

        #include <trace/events/subsys.h>

Otherwise the tracepoint is never created.

-- Steve


> 
> --------
> 
> Signed-off-by: Zhang Jianhua <chris.zjh@...wei.com>
> ---
>  Documentation/trace/tracepoints.rst | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/Documentation/trace/tracepoints.rst b/Documentation/trace/tracepoints.rst
> index 0cb8d9ca3d60..fbb2cb4abd3d 100644
> --- a/Documentation/trace/tracepoints.rst
> +++ b/Documentation/trace/tracepoints.rst
> @@ -66,7 +66,6 @@ In subsys/file.c (where the tracing statement must be added)::
>  	#include <trace/events/subsys.h>
>  
>  	#define CREATE_TRACE_POINTS
> -	DEFINE_TRACE(subsys_eventname);
>  
>  	void somefct(void)
>  	{

Powered by blists - more mailing lists