Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp752654imi; Thu, 21 Jul 2022 10:13:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tuPjJcuiq65GKiT5SeJJefuVtEcm/ewgwZ55ZfKpF1VwvQM5XFx6DpIE+Evn/X6LlhVtMO X-Received: by 2002:a05:6402:3488:b0:43a:e33d:7d26 with SMTP id v8-20020a056402348800b0043ae33d7d26mr58499965edc.279.1658423586189; Thu, 21 Jul 2022 10:13:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658423586; cv=none; d=google.com; s=arc-20160816; b=LLrG6o9RyeYWE8EpGl+hSURxDczV1PX2MRB9PE1ryFEX7QaFYLQmzz43nRRBXNVUCZ mHIGePQsj/z51qFs8YQRGv389wbniqEeAFGXhFd3173o6URaTCRzlQrqxEIPzkjvSelh +9V+mKXW8lACpFEGzf9cB9MwWbw4rRU9FpRw2MZ+kw6OcsRI/hPh15N3Lwcg+ycXHgfr dhikFAUzG/CsdMYI0nE7Z/kchgih1z4jzMCyxmjSXdLuGwVSvTeEkenGPZfOIBHqFr3p K/oLBknO8fxy5fM2QiX7hTLZFs24U3b3UcSLVCtH6h+VE6LbJxRWqR1VGDZyC/wGMSKg 4ExQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Cfz1pS5vY+XI1kr0FeF1kLbcx7TY+3MK71Mv4cEinbY=; b=WC12CAy1O6DPsnVaPoDk38Cbhau29rTL7JwpyY8apr34UVyZGcsMbjZePWYpvD+Ior HB6eTHABis1d6GM9fwo7SLavwnm4zBWqfOTgTbad6hr8FFD1AZ3eT8C5aLDXT3eFU9IW bxIhYpafyv8VNyJY0RTnxLvi8KwwkhjbW+iVtEFLyFUCEHDDQyZhgFbRVGgFfjnQhQOK VdInV/UHg8dLUxcUcgnz6mBBaCPBSKGpeH/Y4WMtOItQaT/4hngNdqwU6MYOzCGBZNJp jTrEl/YQc60SwV3aHelOeXjb868SDd4D7nrMYCMdVJW6yelmJFsSew/vM1uXYsB/PS0c vsLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="M/Uh2T7k"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l21-20020a056402125500b0042dbc7920d7si2740163edw.126.2022.07.21.10.12.40; Thu, 21 Jul 2022 10:13:06 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="M/Uh2T7k"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230328AbiGUQi6 (ORCPT + 99 others); Thu, 21 Jul 2022 12:38:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230302AbiGUQi5 (ORCPT ); Thu, 21 Jul 2022 12:38:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 580337C18E; Thu, 21 Jul 2022 09:38:54 -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 ams.source.kernel.org (Postfix) with ESMTPS id 0707FB8258F; Thu, 21 Jul 2022 16:38:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43162C3411E; Thu, 21 Jul 2022 16:38:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658421531; bh=XQuaI9JDOz1OBn9ObdPK5HEn8VD/Fw7EKM1NPRG5An0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=M/Uh2T7kTP3dCVvPz+LAe+f4IOJVm/09AEsKH1uHLzIeH+V/Lx5oQOb12/zYBuTcw N1p+JBreNfBebraTaMw1n9SjLLYNZZJrFvmr1iEVwv03R9KyxYQq3xevqZZQIDNPIs R/wZo3Qwr3IRUy/etzDCIiQNtDO8hwIzRK+SGae6Jq14nfqYBF4XyELRPlXL6gjg5d Deo3f281WwJqbDQmNquxwYZ5OQ9it9JgbfccUmg7p7+yYICqQUyOmPdWTv5wGVdI8l 138Bn41gCCM33yVu6h323aRWbTS0n3TScA8H8e/h7jVlir3y3K1bGZnIPN4p/TSfQU fH4ZYEz4oYeMg== Message-ID: <26c5c095-2aff-3c7b-80ad-7b21702a3fdd@kernel.org> Date: Thu, 21 Jul 2022 18:38:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH V6 04/16] rv/include: Add deterministic automata monitor definition via C macros Content-Language: en-US To: Steven Rostedt 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 References: <9ffc05b67fff087413143a420373731e0e34eef4.1658244826.git.bristot@kernel.org> <20220720160606.3e672b55@gandalf.local.home> <3c0a4cb5-f88f-ec5f-e614-d1e8ceb036c2@kernel.org> <20220721095924.151c6f5d@gandalf.local.home> From: Daniel Bristot de Oliveira In-Reply-To: <20220721095924.151c6f5d@gandalf.local.home> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, 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 7/21/22 15:59, Steven Rostedt wrote: > 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. Ack, I can keep for annotation. >> >> 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? yes, after disabling tracepoints. >> >> 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. yep, that is it! -- Daniel > -- Steve > > >> >>>> + /* global switch */ \ >>>> + if (unlikely(!rv_monitoring_on())) \ >>>> + return 0; \ >>>> + \ >>>> + /* monitor enabled */ \ >>>> + if (unlikely(!rv_##name.enabled)) \ >>>> + return 0; \ >>>> + \ >>>> + return 1; \ >>>> +} \ >>>> + \ >