Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7983574rwd; Tue, 20 Jun 2023 08:40:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4KeJvQfTyS81IDfno5/EDBMP8E4qrD65xKvbx/a1MGChfVwZGwQHl9MvhMwcABYNIjTJym X-Received: by 2002:a17:90a:19ca:b0:25f:20f:2f7d with SMTP id 10-20020a17090a19ca00b0025f020f2f7dmr6558715pjj.2.1687275630142; Tue, 20 Jun 2023 08:40:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687275630; cv=none; d=google.com; s=arc-20160816; b=oc0Kr81LvKXX3O7mva+wnDWhW1jmhlzPDSbyfc2XD3JUPdRuwyOCzFoQqq/GGHNQuy dLnAgAh1ikHd9vmMbTIMZxxC8iEDq0fFmypd2XHM62JVdRBb5IL5wX5xlxtVQ/W/sbEL Okh5TJSTzPULpmKxuQHZSFhdqEJn5TgkmW/RtuJM6iKB+9tDMcu0uVPxLra6euGj6J9+ SGLo4eddKtgF9vNs1TMnCLkiqo18yXZ5RpKRTmGg3eGcfLHsfYBH5J5gvrsZx1LB8gTA yJ/LojCgNEv3skYkt3rH5rfa+pOJOKOWmll1544O5DNaFjl9V0FP+/jxT3cpj1aDX6we 8hzQ== 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=tGcFU100vC0V7+u2SasajntD8fu5YE6SrI7HCP0zN6o=; b=u1OY1bhVoOVfCUu0+fXrjoaFIeTEu0sg5MwVDl2z4Eu9dL5aWGa3TD9VMLBch9tLpP BXihydGnRLWQBp0PlUby4GfQaWiUKG4so9Eyr590SFwcEV8mUitvASbkFIO1z/K0qv64 y10FEccVdyXvQ6k3yalZL9L+jlttA7eP+WDeevaQ4pEUKSaY3cOluHMI42tFeccp61J+ 3ViPtBzhm2uUu3H+gmDFsy4dKLAwheWDA/KdA8gVNCi16rdpAwaFILZSsmIs9DcEhcIe uvEHatq3wVvxYIpy1/yR9yRVgGfe1YSyAlbUyQBbTgjlwyMmnssKLNi2WxngZ9MXfrLo BI+w== 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 bg9-20020a17090b0d8900b002586dbee167si2088932pjb.170.2023.06.20.08.40.15; Tue, 20 Jun 2023 08:40:30 -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 S233648AbjFTPOI convert rfc822-to-8bit (ORCPT + 99 others); Tue, 20 Jun 2023 11:14:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233696AbjFTPNv (ORCPT ); Tue, 20 Jun 2023 11:13:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9C321996; Tue, 20 Jun 2023 08:13:42 -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 7AA39612DF; Tue, 20 Jun 2023 15:13:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F06AC433C8; Tue, 20 Jun 2023 15:13:41 +0000 (UTC) Date: Tue, 20 Jun 2023 11:13:39 -0400 From: Steven Rostedt To: Beau Belgrave Cc: sunliming , mhiramat@kernel.org, shuah@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2 1/3] tracing/user_events: Fix incorrect return value for writing operation when events are disabled Message-ID: <20230620111339.44c84a83@gandalf.local.home> In-Reply-To: <20230619184044.GA88@W11-BEAU-MD.localdomain> References: <20230609030302.1278716-1-sunliming@kylinos.cn> <20230609030302.1278716-2-sunliming@kylinos.cn> <20230616160845.GA88@W11-BEAU-MD.localdomain> <20230619184044.GA88@W11-BEAU-MD.localdomain> 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 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, 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 Mon, 19 Jun 2023 11:40:44 -0700 Beau Belgrave wrote: > > Now,when the event is disabled, the trace record appears to be lost. > > I'm taking this to mean, if in between the time of the bit check and the > actual write() /writev() syscall the event becomes disabled, the event > won't write to the buffer. Yes, that is expected. > > > In some situations > > where data timing is sensitive, it may cause confusion. In this case, > > not returning an > > error (as mentioned in your reply, it is not considered this case an > > actual error) and > > returning 0 ( meaning that the number of data to be written is 0) may > > be a good way > > to handle it? > > This is where I get a little lost. What would a user process do with a > return of 0 bytes? It shouldn't retry, since it just hit that small > timing window. In reality, it just incurred a temporary excessive > syscall cost, but no real data loss (the operator/admin turned the event > off). Note, this is similar to the race in the kernel with several tracing activities. If a disable happens and the buffer is now off, but the trace is still attempted, zero or NULL (depending on the function) is returned. This just means that tracing is off, and the event should just be dropped. -- Steve