linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Eric Dumazet <edumazet@google.com>
Cc: 运辉崔 <cuiyunhui@bytedance.com>,
	mhiramat@kernel.org, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, kuniyu@amazon.com, xiyou.wangcong@gmail.com,
	duanxiongchun@bytedance.com, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [External] Re: [PATCH v4] sock: add tracepoint for send recv length
Date: Mon, 9 Jan 2023 10:08:33 -0500	[thread overview]
Message-ID: <20230109100833.03f4d4b1@gandalf.local.home> (raw)
In-Reply-To: <CANn89iKY5gOC97NobXkhYv6d9ik=ks5ZEwVe=6H-VTwux=BwGQ@mail.gmail.com>

On Mon, 9 Jan 2023 15:54:38 +0100
Eric Dumazet <edumazet@google.com> wrote:

> > static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg)
> > {
> >         int ret = INDIRECT_CALL_INET(sock->ops->sendmsg, inet6_sendmsg,
> >                                      inet_sendmsg, sock, msg,
> >                                      msg_data_left(msg));
> >         BUG_ON(ret == -EIOCBQUEUED);
> >
> >         if (trace_sock_send_length_enabled()) {  
> 
> A barrier() is needed here, with the current state of affairs.
> 
> IMO, ftrace/x86 experts should take care of this generic issue ?

trace_*_enabled() is a static_branch() (aka. jump label).

It's a nop, where the if block is in the out-of-line code and skipped. When
the tracepoint is enabled, it gets turned into a jump to the if block
(which returns back to this location).

That is, when the tracepoint in the block gets enabled so does the above
branch. Sure, there could be a race between the two being enabled, but I
don't see any issue if there is. But the process to modify the jump labels,
does a bunch of synchronization between the CPUs.

What barrier are you expecting?

-- Steve

> 
> 
> 
> >                 call_trace_sock_send_length(sock->sk, sock->sk->sk_family,
> >                                             sock->sk->sk_protocol, ret, 0);
> >         }
> >         return ret;
> > }
> >
> > What do you think?

  reply	other threads:[~2023-01-09 15:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-08  2:55 [PATCH v4] sock: add tracepoint for send recv length Yunhui Cui
2023-01-09  9:56 ` Eric Dumazet
2023-01-09 13:13   ` [External] " 运辉崔
2023-01-09 14:54     ` Eric Dumazet
2023-01-09 15:08       ` Steven Rostedt [this message]
2023-01-09 15:20         ` Eric Dumazet
2023-01-09 15:39           ` Steven Rostedt
2023-01-10  8:58             ` 运辉崔
2023-01-10  2:40 ` Dust Li

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=20230109100833.03f4d4b1@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=cuiyunhui@bytedance.com \
    --cc=davem@davemloft.net \
    --cc=duanxiongchun@bytedance.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=xiyou.wangcong@gmail.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).