Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp15710425rwd; Sun, 25 Jun 2023 23:38:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6pPbIsbXTJUk17N1QDPPZjABPLxBktV8LRbKzhp2ugAXJXFMWLYyChtbr7nX6AP3Hjm2YO X-Received: by 2002:a17:907:3181:b0:988:6bd2:b0b3 with SMTP id xe1-20020a170907318100b009886bd2b0b3mr17877383ejb.60.1687761539641; Sun, 25 Jun 2023 23:38:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687761539; cv=none; d=google.com; s=arc-20160816; b=HE/s7an+AIstFHukOD5ZZU48N8D/C9zKjdldr+1HQ4FV3439fmYZxFOULaX6b61Uqq 6Oh0R2B8lbPN5S4MlY+Ez5kvb1tBoyZ+D1JF3mueEvW1Gn+2NYvIFqj5PllV6CKdKSEy u71cYGS/GfWsyLqBXivKSox1DBAxbXTul/HcVRkNBAsqyfJ3YWlosjp8sO0H/Uul6xee bbb2q8Ld40bJZH1KCw3Gk7AcBxnLGj/pfOJFLRb9bR5gySG5pnLT2LN1nW21uDcUOa3+ KiRtMT/1JkyrXkfOSadELNOry0E5O+lNn0xG2DoRdOW+K4XgG+SxHdk3mBCxbgglTqsN MNgw== 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=duGteIGnHIuV4i4RDvyIjNkDYTpn0Kj8MYInnn1kzMw=; fh=ctP+TjgaWrUkTBRshTS5knjVcARxk+RkRIkHbQYhWb8=; b=korCT5vaISDHKOxMfPSxrBJPNyMuslBMEIl+llLGwS9hoOm2NDki7GSUjqwxhnhedE nwfXYojYQ1EQhaScTYta00zauup8a5vnkjEw0NT3TV9eFK22yOv3n83HnW+Lp0l/IV1W 6yResJ4FSgjk8DKiItYCv2QGvvJaByoMAa2CFUVzoeCwDCE9iOSMazEl1kI8Wfhuz+aP QIkGP+Nl9wuApl/UVDXYuX/QGQAS7capaHLe5Xy5HWWbYZyNmRBFXYzv9trgKXfp66re OPqh8cdKh4hUTja+74DrrSDqxSYz3i9qUpQ64pFGTNNPenH/f113eRjs41mas+citdkM rohg== 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 cb9-20020a170906a44900b009888e294b10si2358640ejb.413.2023.06.25.23.38.33; Sun, 25 Jun 2023 23:38:59 -0700 (PDT) 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 S229541AbjFZGPp (ORCPT + 99 others); Mon, 26 Jun 2023 02:15:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229724AbjFZGPi (ORCPT ); Mon, 26 Jun 2023 02:15:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51DBAF4; Sun, 25 Jun 2023 23:15:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DC45D60C8C; Mon, 26 Jun 2023 06:15:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6963DC433C8; Mon, 26 Jun 2023 06:15:34 +0000 (UTC) Date: Mon, 26 Jun 2023 02:15:30 -0400 From: Steven Rostedt To: sunliming Cc: mhiramat@kernel.org, beaub@linux.microsoft.com, kelulanainsley@gmail.com, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds Subject: Re: [PATCH v3 1/3] tracing/user_events: Fix incorrect return value for writing operation when events are disable Message-ID: <20230626021530.26603164@rorschach.local.home> In-Reply-To: <20230621060827.151564-2-sunliming@kylinos.cn> References: <20230621060827.151564-1-sunliming@kylinos.cn> <20230621060827.151564-2-sunliming@kylinos.cn> 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=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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, 21 Jun 2023 14:08:24 +0800 sunliming wrote: > The writing operation return the count of writes regardless of whether events > are enabled or disabled. Switch it to return 0 to indicates that the event > is disabled. > > Signed-off-by: sunliming > --- > kernel/trace/trace_events_user.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c > index 1ac5ba5685ed..c085ff829a58 100644 > --- a/kernel/trace/trace_events_user.c > +++ b/kernel/trace/trace_events_user.c > @@ -1957,7 +1957,8 @@ static ssize_t user_events_write_core(struct file *file, struct iov_iter *i) > > if (unlikely(faulted)) > return -EFAULT; > - } > + } else > + return 0; > sunliming, If you missed the conversation about the pull request with Linus, he pointed out (correctly) that we were mistaken to tell you to return zero. It should return an error if the ring buffer is disabled. But instead of returning -EFAULT, let's follow the behavior of trace_marker and return -EBADF. This way user space has a better idea why it failed. Care to send another update? Thanks! -- Steve > return ret; > }