Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3314557rwb; Fri, 9 Dec 2022 12:48:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf6eJ7WQd35HjGIid6HQP1nv/uIxyFxXX50fUferPReiT5wY9WyS+FKXEZ4Oc80XCza3Wy1a X-Received: by 2002:a17:902:a418:b0:186:e8c1:f583 with SMTP id p24-20020a170902a41800b00186e8c1f583mr6640789plq.64.1670618904778; Fri, 09 Dec 2022 12:48:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670618904; cv=none; d=google.com; s=arc-20160816; b=on2lAb5UTT/dUgqwDTriOJTGq02E6esi8ucoXJ8d8Nja4WI25dEJuRvZB7Jcfckkgj ncAiFwEQ8VYNfqJVeIfpZ65m1JErdgj6NCKkIRduBqHiPVgv7ihtwE5JLusYs3mwDbii /LzRL8PXQL93ri0/mpJbc3KI7W3cXJ//NZ+B3O8OWbdtDzrNbbHIDjBq29TaII0mPBXh CCIGVotMjImryRywCxY0lpGdC41qz0wbA2JsjVmsR7oq7YeZNpKAdJ2oc9CxSOAmKjTx wnTRInslzzizORQJj3L0c4CwUpAUIf3WxEHh/7VL8uiz8j29MdYh0SAHQNTkzxysjo7P EM+Q== 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=Tm9vK4o8pQJxGDVNCxqAjic+1yogxSzje6NUATFsFjU=; b=nyb0QHOVDof4uC71iva4DRsgsiATZQXqoJ0SW8zMR0XHgjh6fk8aOvwa58EiaV3zsF jb+U1pv/lnrwq/k7RJPobIMrP/fgN4ygya0qVrEGQ7bcF/eKN767eO4fZpteDLmjz993 GVsH8bP0HVtPxvV36VXAqs0Q37OjWKnumepUG5TZCS40XDHRuSIa0D16/c8c8VZ3iHWj CypBig2QAL0jyspmEwjfhA2iiihz/GRhAaZQOQ52Ykizsi6NWf323SzCpNFWXG1Q4KfT a0M43JTQhOoaR6DX9rLc/tz0s/fwsDVbe4lvZeWuOSdUN9xJcLbSmKDNVMBrzfoQk7Pz Myng== 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 j3-20020a170903028300b001899e936c2csi2596388plr.531.2022.12.09.12.48.14; Fri, 09 Dec 2022 12:48:24 -0800 (PST) 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 S229861AbiLIUgB (ORCPT + 75 others); Fri, 9 Dec 2022 15:36:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229738AbiLIUf7 (ORCPT ); Fri, 9 Dec 2022 15:35:59 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD3DBA0F8C; Fri, 9 Dec 2022 12:35:57 -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 77C2BB82910; Fri, 9 Dec 2022 20:35:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43800C433EF; Fri, 9 Dec 2022 20:35:54 +0000 (UTC) Date: Fri, 9 Dec 2022 15:35:52 -0500 From: Steven Rostedt To: Daniel Bristot de Oliveira Cc: Masami Hiramatsu , Jonathan Corbet , Juri Lelli , Clark Williams , Bagas Sanjaya , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V4 2/3] tracing/osnoise: Add preempt and/or irq disabled options Message-ID: <20221209153552.4c7099cd@gandalf.local.home> In-Reply-To: References: 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 Wed, 30 Nov 2022 19:19:10 +0100 Daniel Bristot de Oliveira wrote: Hi Daniel, As I was adding this series, I noticed an issue that needs to be fixed. > static int run_osnoise(void) > { > + bool irq_disable = test_bit(OSN_IRQ_DISABLE, &osnoise_options); > struct osnoise_variables *osn_var = this_cpu_osn_var(); > u64 start, sample, last_sample; > u64 last_int_count, int_count; > @@ -1315,11 +1323,18 @@ static int run_osnoise(void) > s64 total, last_total = 0; > struct osnoise_sample s; > unsigned int threshold; > + bool preempt_disable; Let's use a different name for the above variable. > u64 runtime, stop_in; > u64 sum_noise = 0; > int hw_count = 0; > int ret = -1; > > + /* > + * Disabling preemption is only required if IRQs are enabled, > + * and the options is set on. > + */ > + preempt_disable = !irq_disable && test_bit(OSN_PREEMPT_DISABLE, &osnoise_options); > + > /* > * Considers the current thread as the workload. > */ > @@ -1335,6 +1350,15 @@ static int run_osnoise(void) > */ > threshold = tracing_thresh ? : 5000; > > + /* > + * Apply PREEMPT and IRQ disabled options. > + */ > + if (irq_disable) > + local_irq_disable(); > + > + if (preempt_disable) > + preempt_disable(); > + The only reason the above works is because preempt_disable() is a macro. If it was a function, then it would likely fail to build (as you are overriding the name with a bool variable). -- Steve