From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1102DC3DA7A for ; Fri, 6 Jan 2023 04:07:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230481AbjAFEHq convert rfc822-to-8bit (ORCPT ); Thu, 5 Jan 2023 23:07:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbjAFEHp (ORCPT ); Thu, 5 Jan 2023 23:07:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50141625F1; Thu, 5 Jan 2023 20:07:44 -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 ams.source.kernel.org (Postfix) with ESMTPS id E4FDEB81BF2; Fri, 6 Jan 2023 04:07:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 783E7C433D2; Fri, 6 Jan 2023 04:07:40 +0000 (UTC) Date: Thu, 5 Jan 2023 23:07:37 -0500 From: Steven Rostedt To: =?UTF-8?B?6L+Q6L6J5bSU?= Cc: mhiramat@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, duanxiongchun@bytedance.com, kuniyu@amazon.com, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: Re: [External] Re: [PATCH v2] sock: add tracepoint for send recv length Message-ID: <20230105230737.426abfdd@gandalf.local.home> In-Reply-To: References: <20230105100014.1935-1-cuiyunhui@bytedance.com> <20230105090807.51213cea@gandalf.local.home> 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=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-trace-kernel@vger.kernel.org On Fri, 6 Jan 2023 11:24:18 +0800 运辉崔 wrote: > Regardless of whether the MSG_PEEK flag is set or not, it is possible > to return -errno, > but based on your suggestion, I plan to modify it like this: > > trace_sock_recvmsg_length(sock->sk, sock->sk->sk_family, > sock->sk->sk_protocol, > !(flags & MSG_PEEK) ? ret : (ret < 0 ? ret : 0), > > what do you think? Sure. But note, from your original patch: > + trace_sock_recvmsg_length(sock->sk, sock->sk->sk_family, > + sock->sk->sk_protocol, > + (ret > 0 && !(flags & MSG_PEEK)) ? > + ret : 0, > + (ret > 0 && !(flags & MSG_PEEK)) ? 0 : ret, > + flags); If flags MSG_PEEK is set, you return ret in error regardless, so error would be ret even if it was positive. So I'm guessing that this change actually fixed a bug. ;-) -- Steve