linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Manjusaka <me@manjusaka.me>
Cc: Joe Perches <joe@perches.com>,
	edumazet@google.com, bpf@vger.kernel.org, davem@davemloft.net,
	dsahern@kernel.org, kuba@kernel.org,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	mhiramat@kernel.org, ncardwell@google.com,
	netdev@vger.kernel.org, pabeni@redhat.com
Subject: Re: [PATCH v3] tracepoint: add new `tcp:tcp_ca_event` trace event
Date: Wed, 16 Aug 2023 11:02:06 -0400	[thread overview]
Message-ID: <20230816110206.13980573@gandalf.local.home> (raw)
In-Reply-To: <8b0f2d2b-c5a0-4654-9cc0-78873260a881@manjusaka.me>

On Wed, 16 Aug 2023 14:09:06 +0800
Manjusaka <me@manjusaka.me> wrote:

> > +# trace include files use a completely different grammar
> > +		next if ($realfile =~ m{(?:include/trace/events/|/trace\.h$/)});
> > +
> >  # check multi-line statement indentation matches previous line
> >  		if ($perl_version_ok &&
> >  		    $prevline =~ /^\+([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) {
> > 
> > 
> >   
> 
> Actually, I'm not sure this is the checkpatch style issue or my code style issue.
> 
> Seems wired.

The TRACE_EVENT() macro has its own style. I need to document it, and
perhaps one day get checkpatch to understand it as well.

The TRACE_EVENT() typically looks like:


TRACE_EVENT(name,

	TP_PROTO(int arg1, struct foo *arg2, struct bar *arg3),

	TP_ARGS(arg1, arg2, arg3),

	TP_STRUCT__entry(
		__field(	int,		field1				)
		__array(	char,		mystring,	MYSTRLEN	)
		__string(	filename,	arg3->name			)
	),

	TP_fast_assign(
		__entry->field1 = arg1;
		memcpy(__entry->mystring, arg2->string);
		__assign_str(filename, arg3->name);
	),

	TP_printk("field1=%d mystring=%s filename=%s",
		__entry->field1, __entry->mystring, __get_str(filename))
);

The TP_STRUCT__entry() should be considered more of a "struct" layout than
a macro layout, and that's where checkpatch gets confused. The spacing
makes it much easier to see the fields and their types.

-- Steve

  reply	other threads:[~2023-08-16 15:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 18:33 [PATCH] tracepoint: add new `tcp:tcp_ca_event_set` trace event Manjusaka
2023-08-07 20:00 ` Neal Cardwell
2023-08-08  4:29   ` Manjusaka
2023-08-08  4:50   ` Manjusaka
2023-08-08  5:58   ` [PATCH v2] tracepoint: add new `tcp:tcp_ca_event` " Manjusaka
2023-08-08  8:26     ` Eric Dumazet
2023-08-08  8:46       ` Manjusaka
2023-08-08  8:48         ` Eric Dumazet
2023-08-12 20:12           ` [PATCH v3] " Zheao Li
2023-08-12 20:17             ` Manjusaka
2023-08-12 23:00               ` Steven Rostedt
2023-08-13  0:59             ` Steven Rostedt
2023-08-13  1:01               ` Steven Rostedt
2023-08-13  1:04                 ` Steven Rostedt
2023-08-13  1:17                   ` Joe Perches
2023-08-13  1:53                     ` Steven Rostedt
2023-08-13  2:08                       ` Joe Perches
2023-08-16  6:09                         ` Manjusaka
2023-08-16 15:02                           ` Steven Rostedt [this message]
2023-08-16 16:58                             ` Manjusaka
2023-08-19  1:51             ` Jakub Kicinski
2023-08-19  3:10               ` Eric Dumazet
2023-08-19  8:15                 ` Manjusaka
2023-08-08 20:21     ` [PATCH v2] " Jakub Kicinski
2023-08-09 16:55       ` Manjusaka

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=20230816110206.13980573@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=joe@perches.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=me@manjusaka.me \
    --cc=mhiramat@kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).