Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp594397imi; Thu, 21 Jul 2022 07:15:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uTz4V+/CvrB5+azYLIT3X5+eiVeWnzyqottVI2bIsWCqrlPrJsHm/e0idIyN2E8N9k2Hpl X-Received: by 2002:a05:6402:11c7:b0:43a:c61c:21cd with SMTP id j7-20020a05640211c700b0043ac61c21cdmr56950871edw.108.1658412942230; Thu, 21 Jul 2022 07:15:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658412942; cv=none; d=google.com; s=arc-20160816; b=xM/QRT7ZmYx3Ipi8gPoiKtQZPS/bt2O61Dy/a4SiqO7JPusKaOx15HWOKm+EDgJRAr xx3mHnUuaNQ1RFLe0hW6q6vi9GXSqvUvLv8zFeNm7KqKiY+uaZbFANHfYx1Fm7rcjkX/ ZYApH4rMDuN5BxWclPukNg9nNsdXqPu00JaAMrjMTIgyxitB5iRnSCNBota4RV2N+42i mkKd9Llo8b/Mpj4AdyeVdwu2SGyBAP5kWTWL4R9W02cMlkd63YHqZfz0pMFarMbljiAj elX6WcO/0KGSo3lmU36q/PvX+IZxgOv4SqTJCufiXekK3lilSsaZQ0cOFZBAhkpkqSNO l3rw== 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=GyS0FXJMBJRzIskYTtTQPNotrjC8OAfcHTJ+RwlnaPs=; b=cmBJ/VlQUAvg5qCcGVacFZB/oDSq28B7muagY1YnrWshh4R1OHOcrorEt2Rdl8HRkK vicBQRZUMCkiv2smdgDdvIJi+7hLUCEwENsq/Gv3Vz+3bySEwVMStoTaaV1v1KG8ywTT 3Ms0I3c78IPq+P0H5VKRAijU+vo6rEFUjWp7CoWdphcfI6IPgnd9J1JFC1w5KTCa/3De 2Bqb0PRuw1O+csPF0Z6I7dxXt6Z7qAYvZfQ1z+zaC4E+cug1QWuiF2ay5ZJdTbsEifwY wacRfBWRKngfEQTHVObJZO4FHky/7eEuoAj87kIlHsmfZk3lnw39gW/YV4opZxE1Gw7/ Ho4w== 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 qf42-20020a1709077f2a00b00722668dbcacsi3149842ejc.575.2022.07.21.07.15.16; Thu, 21 Jul 2022 07:15:42 -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 S230412AbiGUN7f (ORCPT + 99 others); Thu, 21 Jul 2022 09:59:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbiGUN7c (ORCPT ); Thu, 21 Jul 2022 09:59:32 -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 4DFD33C14A; Thu, 21 Jul 2022 06:59:30 -0700 (PDT) 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 CA6F561F5F; Thu, 21 Jul 2022 13:59:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB1D0C3411E; Thu, 21 Jul 2022 13:59:26 +0000 (UTC) Date: Thu, 21 Jul 2022 09:59:24 -0400 From: Steven Rostedt To: Daniel Bristot de Oliveira Cc: Wim Van Sebroeck , Guenter Roeck , Jonathan Corbet , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Will Deacon , Catalin Marinas , Marco Elver , Dmitry Vyukov , "Paul E. McKenney" , Shuah Khan , Gabriele Paoloni , Juri Lelli , Clark Williams , Tao Zhou , Randy Dunlap , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org Subject: Re: [PATCH V6 04/16] rv/include: Add deterministic automata monitor definition via C macros Message-ID: <20220721095924.151c6f5d@gandalf.local.home> In-Reply-To: <3c0a4cb5-f88f-ec5f-e614-d1e8ceb036c2@kernel.org> References: <9ffc05b67fff087413143a420373731e0e34eef4.1658244826.git.bristot@kernel.org> <20220720160606.3e672b55@gandalf.local.home> <3c0a4cb5-f88f-ec5f-e614-d1e8ceb036c2@kernel.org> 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 Thu, 21 Jul 2022 14:08:38 +0200 Daniel Bristot de Oliveira wrote: > On 7/20/22 22:06, Steven Rostedt wrote: > >> +/* \ > >> + * da_monitor_enabled_##name - checks if the monitor is enabled \ > >> + */ \ > >> +static inline bool da_monitor_enabled_##name(void) \ > >> +{ \ > > Should we add a: > > > > smp_rmb(); > > > > here? And then a smp_wmb() where these switches get updated? > > > > Makes sense. > > Should I also add the READ_ONCE/WRITE_ONCE? like > > smp_rmb() > READ_ONCE(var) > > WRITE_ONCE(var, value) > smp_wmb() I'm not sure the WRITE_ONCE() is necessary with the memory barriers. Because they should also prevent gcc from doing anything after that barrier. As Linus once stated, most cases WRITE_ONCE() is useless, but it's fine to keep more for annotation (as to pair with the READ_ONCE()) than for anything that is critical. > > for all these on/off knobs, or just the barriers? > > > I guess how critical is it that these turn off immediately after the switch > > is flipped? > > It is not critical to continue the execution of those that have already crossed by > the variable. Still, waiting for the tracepoints to finish their execution before > returning to the user-space task that disabled the variable might be a good thing. You mean after disabling, to wait for the tracepoints that are currently running to end? > > IIRC, we can do that via RCU... like, synchronize_rcu()? We have tracepoint_synchronize_unregister() that does that, as some traceponits use SRCU and not RCU. -- Steve > > >> + /* global switch */ \ > >> + if (unlikely(!rv_monitoring_on())) \ > >> + return 0; \ > >> + \ > >> + /* monitor enabled */ \ > >> + if (unlikely(!rv_##name.enabled)) \ > >> + return 0; \ > >> + \ > >> + return 1; \ > >> +} \ > >> + \