Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6368646rwl; Mon, 9 Jan 2023 07:32:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXvx/U+eZHcHE0rEgmlG8q/3YH1xp8+JrStw2HKn4fuI+V79MTGNxsXGt9K9IkODBCuMQIQz X-Received: by 2002:a05:6a20:2d1f:b0:b5:c751:78bb with SMTP id g31-20020a056a202d1f00b000b5c75178bbmr5004046pzl.6.1673278359632; Mon, 09 Jan 2023 07:32:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673278359; cv=none; d=google.com; s=arc-20160816; b=ja5i6riCTzlvfQjxnCYu0k79O84xe4rO/hYfLytUReA0OdzBqTJJW3yk7b+HMX6KNO HfdL/W3jBb4Efkh/RWlSqOFbBrPzl0Nv0wAqj3vWZE/K5NrayC5lcE7eYmPvn6qHMYBJ RU7OBbc2JlvIKDtZd0RcHLeRMO1qwAsP+lQcMZfvwPBCheIZ4rQtcvxJ5Yif+wTnT5iD QJYhyYdIoecTLRw3bDR6TS0/VXYknm283x8lOw024L26fApwCpizXfdtF8lEPZh26n9a C6UyxNzbojyH95ObX1eaRolgdD+jny2mU4qShLnEhC/xyE1ESHOu1CqGp8DrjZw1e3dt I9SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=WaLSf8ye2G8tZcCcouoDh5ukmVKY6ABvJcweruSG7gA=; b=f3yEe5LVSBep2TMCEpijt/4FiG7G0T9k0esLPtddX2ZEGIXYsdHIc8hQ18BNvQmCP6 kTzaqDILvi9rFayUwuVjJ3/+jj6DNp/9s2ZnSpUTxQ0wxRcZuO+94hQFSFXrFBI2Eswo +bWEctYoMkHjnwT3+LlWlXJWTEiTzLHgNqkQZ2CS6pks8SdzZ6abXckbuTLEHnCMi4X2 rFk38HlT02mvtVQrzwtIWQQROb++BFVY2zLBOPSTuQZLrOl4jkcEZjwdMTYN9BVFvR5s vmLIXOl/AQx20WQH8U4dyPenEKKDXcsf2Je9cfANbvJeL/rpYbBnf4G5IBR19jmGU+XN NgeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 33-20020a631461000000b0046f5808167asi9677934pgu.812.2023.01.09.07.32.32; Mon, 09 Jan 2023 07:32:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234410AbjAIPJG (ORCPT + 53 others); Mon, 9 Jan 2023 10:09:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236956AbjAIPIk (ORCPT ); Mon, 9 Jan 2023 10:08:40 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B6231A07F; Mon, 9 Jan 2023 07:08:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21FA66118C; Mon, 9 Jan 2023 15:08:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4023AC433EF; Mon, 9 Jan 2023 15:08:35 +0000 (UTC) Date: Mon, 9 Jan 2023 10:08:33 -0500 From: Steven Rostedt To: Eric Dumazet Cc: =?UTF-8?B?6L+Q6L6J5bSU?= , 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 Message-ID: <20230109100833.03f4d4b1@gandalf.local.home> In-Reply-To: References: <20230108025545.338-1-cuiyunhui@bytedance.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 9 Jan 2023 15:54:38 +0100 Eric Dumazet 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?