Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp873574rwb; Thu, 12 Jan 2023 13:34:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXs+cB6zw7y9iI9qct6LghE5xQHyZ5x1MA/C8+AvqeVuzDeXvy2fEe+A8HMpG62Ccs0fg71/ X-Received: by 2002:a05:6a20:138f:b0:a3:1e96:96a4 with SMTP id w15-20020a056a20138f00b000a31e9696a4mr11481936pzh.43.1673559258871; Thu, 12 Jan 2023 13:34:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673559258; cv=none; d=google.com; s=arc-20160816; b=yW4yqOwNOtHxEoeA8+QXpSKHZ6pIVWpGH4D289NhA0hyRc1jtBTjAyr5+snfLe9bRj dXVQgbBDsNHoW9rFi5Pzv3YqKx8OfZvfbTfxjdOZXz8DyomLIJ52f6fss28DzPkCd/Vj pGbLr5LK1izNxGgMSm3hxKgXbdKY4KMhrHwmXV//+l2TPHZGMar/MPhvL8wLIgZTYvYt i21G++c7G3Ajj4sDuTfTRMh64URR4B3wor+AIhHsB+gubeHW17a6fxd/3YqQDTAUAL+W ASksePCS+Ep8g70wypiAJD94wELFbCgVkO4zUqW8q62tK1w0tTj29h6xbdxqtKBa2JHt hQXw== 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=zcSbLmDcXf7VV1LFFpulP6hA0hc/vpENayXLfV9wXHY=; b=wsLlJ7fDAA6qwSaX4zxNM0Hk2CPfR7gXBDId4+D7mzon5kbytKV2UIysEWn8lfoDYv FIOQThtlJtthWB+rOZzB3OJl7267neKhystWFzdp0Xy+uOv8aQmrvP9SbcSJpiDDVbLe rRL10dE0/PoOTHB5vjs/Q43/jbvQ3gkYEha4eM/qE9QHRdls9PI8jKxhaWq/QETYW3eL btNC/uLR9qRNPtlqgcAGTfj6zNf5inQdWadV3Xvneudiv0OqF0F8r8YBMSMRUpiQUsc4 qK4De61vzvsid88Nt+BHIo7T1sD7NuYLX71mS/0POJRexS0KoRL+WD/qumX7YMR/Nvnz i+LQ== 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 s7-20020a639247000000b00478fd997431si17744126pgn.872.2023.01.12.13.34.12; Thu, 12 Jan 2023 13:34:18 -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 S230385AbjALUww convert rfc822-to-8bit (ORCPT + 50 others); Thu, 12 Jan 2023 15:52:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230135AbjALUw3 (ORCPT ); Thu, 12 Jan 2023 15:52:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FE296698E; Thu, 12 Jan 2023 12:24:11 -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 3D20B62177; Thu, 12 Jan 2023 20:24:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52CBBC433D2; Thu, 12 Jan 2023 20:24:09 +0000 (UTC) Date: Thu, 12 Jan 2023 15:24:07 -0500 From: Steven Rostedt To: Yunhui Cui Cc: mhiramat@kernel.org, davem@davemloft.net, edumazet@google.com, 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, dust.li@linux.alibaba.com Subject: Re: [PATCH v6] sock: add tracepoint for send recv length Message-ID: <20230112152407.7acad054@gandalf.local.home> In-Reply-To: <20230111065930.1494-1-cuiyunhui@bytedance.com> References: <20230111065930.1494-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: 8BIT 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 Wed, 11 Jan 2023 14:59:30 +0800 Yunhui Cui wrote: > Signed-off-by: Yunhui Cui > Signed-off-by: Xiongchun Duan > --- > include/trace/events/sock.h | 45 +++++++++++++++++++++++++++++++++++++ > net/socket.c | 33 +++++++++++++++++++++++---- > 2 files changed, 74 insertions(+), 4 deletions(-) > > diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h > index 777ee6cbe933..71492e8276da 100644 > --- a/include/trace/events/sock.h > +++ b/include/trace/events/sock.h > @@ -263,6 +263,51 @@ TRACE_EVENT(inet_sk_error_report, > __entry->error) > ); > > +/* > + * sock send/recv msg length > + */ > +DECLARE_EVENT_CLASS(sock_msg_length, > + > + TP_PROTO(struct sock *sk, int ret, int flags), > + > + TP_ARGS(sk, ret, flags), > + > + TP_STRUCT__entry( > + __field(void *, sk) > + __field(__u16, family) > + __field(__u16, protocol) > + __field(int, ret) > + __field(int, flags) > + ), > + > + TP_fast_assign( > + __entry->sk = sk; > + __entry->family = sk->sk_family; > + __entry->protocol = sk->sk_protocol; > + __entry->ret = ret; > + __entry->flags = flags; > + ), > + > + TP_printk("sk address = %p, family = %s protocol = %s, length = %d, error = %d, flags = 0x%x", > + __entry->sk, show_family_name(__entry->family), > + show_inet_protocol_name(__entry->protocol), > + !(__entry->flags & MSG_PEEK) ? > + (__entry->ret > 0 ? __entry->ret : 0) : 0, > + __entry->ret < 0 ? __entry->ret : 0, > + __entry->flags) > +); > + > +DEFINE_EVENT(sock_msg_length, sock_send_length, > + TP_PROTO(struct sock *sk, int ret, int flags), > + > + TP_ARGS(sk, ret, flags) > +); > + > +DEFINE_EVENT(sock_msg_length, sock_recv_length, > + TP_PROTO(struct sock *sk, int ret, int flags), > + > + TP_ARGS(sk, ret, flags) > +); From the tracing POV: Reviewed-by: Steven Rostedt (Google) -- Steve