Received: by 2002:a05:6359:100d:b0:dc:7f35:3994 with SMTP id ib13csp17754rwb; Wed, 14 Dec 2022 12:59:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf7YVO5urSmbXLlgCb9wrumXLUgDkzDcr7kMlSP+bUO50CXTK87x1mSxfhK4XgW7VnGBgELX X-Received: by 2002:a17:906:4803:b0:7c1:59d2:db59 with SMTP id w3-20020a170906480300b007c159d2db59mr14898400ejq.64.1671051552734; Wed, 14 Dec 2022 12:59:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671051552; cv=none; d=google.com; s=arc-20160816; b=m3XANJm68GnTzKogGbEpmvizxVIeN2WxSKNsfQnRd8df2oKburl8APhvaOjlB3E5cU ZPvNiv3u+wgmZv+fTLvXpORFQ9qAjE/ynLFiYCP/A7tjWOIyRDSpY/AZHug//ICsKnIV nK9QdXOktFM9Y0yUJKZS5R8SoZwxlziBKPnTB73i8ljNxN09HAjXaB++rU+ZMdpgxaRQ IMzIZsV/jpErnxVqFRoRhe9czhGC/1VdJe8D58CAQGaoJXkLDjgQGScRePRDD6jzHumW 4ofyoYEDFiS9vWlDVdFRqxrUa4YdF7PzBw/aYZzCYTi7USPV489WNRI3/pOwEAKiniyP h7ug== 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=qNouywBopEY8//JM//nu6EMTuSASMaoLHy6sKLe3lZk=; b=n2VV3ysya63G8cJTQkT1nSGVhjXLD1EakqYsiz53jCbrbWZ7DNC9i1fj/UsEYNzZ4h tIHl97DZV5E0gTlBWYoAolXxyTOIWFyEpujy0hJUObJvedP+HVqJVI/OfFjKNRKoWpnU MJRrNGE+U+toLKKekR4TBqt0RTlC4MVoq7HbRtqikqY55dMaXULAbe/BD/rOzcCUmKZk 6RboLe0ldQBwMbXoVrz7PnHxBq5Hp4du6Av1XJVeW3/11RXKMuf+PyZQ0O6/O7G8BQ63 rSK/nOlyCXoChJAB5LIfCoM1M/AsPSTAEt3//72hTlp6aCOJ+YvlAeT/0kD1w6Sk+eb+ xWCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=o2EjVNY7; 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=efficios.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb16-20020a1709077e9000b007c177fe6023si3920917ejc.256.2022.12.14.12.58.54; Wed, 14 Dec 2022 12:59:12 -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; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=o2EjVNY7; 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=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229700AbiLNUjV (ORCPT + 69 others); Wed, 14 Dec 2022 15:39:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbiLNUjA (ORCPT ); Wed, 14 Dec 2022 15:39:00 -0500 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9211B2C666; Wed, 14 Dec 2022 12:36:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1671050211; bh=42hiEfvX2Y36168DMLrfaAMe71ofZ7gUQkp33pRi+lY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=o2EjVNY7nsJ2a6wA2qmvdQRpxLsQ3h3jjjFWa1jY1I/VifxgdiREjb10wHk0PPJEz 6x/ZQBS/2onS+hEP3AZzG36l9IsqCGHQaAWt1qe0RWha4Tdmo4gOsiB+hVF+b4Ibyk yHXZ42dJS8Hb0wMmOPDLQeQ5ZjYsAKTpAlHONptZ5lPIdhZU81126k7kwUbKaza3xj RDprLbdJ9yq61dAJPVyEJ05pV1GURo63igXEPK9pz5xJX+R//8wcjPbEmlWUd/LAVE kMPT2U2PKnLzwRUmrMxzB0GGkxJi1QVHHurX6SWNzisjmboAq/XVzllY0/aMdv9z3s UPro3UK6ynGRA== Received: from [172.16.0.118] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4NXRwy6NYXzbdh; Wed, 14 Dec 2022 15:36:50 -0500 (EST) Message-ID: Date: Wed, 14 Dec 2022 15:37:13 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH] tracing: Do not synchronize freeing of trigger filter on boot up Content-Language: en-US To: paulmck@kernel.org, Masami Hiramatsu Cc: Steven Rostedt , LKML , Linux Trace Kernel , Andrew Morton References: <20221213172429.7774f4ba@gandalf.local.home> <20221214084954.e759647a2f5f1a38bc78b371@kernel.org> <20221214200333.GA3208104@paulmck-ThinkPad-P17-Gen-1> From: Mathieu Desnoyers In-Reply-To: <20221214200333.GA3208104@paulmck-ThinkPad-P17-Gen-1> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 2022-12-14 15:03, Paul E. McKenney wrote: > On Wed, Dec 14, 2022 at 08:49:54AM +0900, Masami Hiramatsu wrote: >> On Tue, 13 Dec 2022 17:24:29 -0500 >> Steven Rostedt wrote: >> >>> From: "Steven Rostedt (Google)" >>> >>> If a trigger filter on the kernel command line fails to apply (due to >>> syntax error), it will be freed. The freeing will call >>> tracepoint_synchronize_unregister(), but this is not needed during early >>> boot up, and will even trigger a lockdep splat. >>> >>> Avoid calling the synchronization function when system_state is >>> SYSTEM_BOOTING. >> >> Shouldn't this be done inside tracepoint_synchronize_unregister()? >> Then, it will prevent similar warnings if we expand boot time feature. > > How about the following wide-spectrum fix within RCU_LOCKDEP_WARN()? > Just in case there are ever additional issues of this sort? Hi Paul, Your approach makes sense. Thanks for looking into this. Reviewed-by: Mathieu Desnoyers > > Thanx, Paul > > ------------------------------------------------------------------------ > > commit d493ffca2df6c1963bd1d7b8f8c652a172f095ae > Author: Paul E. McKenney > Date: Wed Dec 14 11:41:44 2022 -0800 > > rcu: Make RCU_LOCKDEP_WARN() avoid early lockdep checks > > Currently, RCU_LOCKDEP_WARN() checks the condition before checking > to see if lockdep is still enabled. This is necessary to avoid the > false-positive splats fixed by commit 3066820034b5dd ("rcu: Reject > RCU_LOCKDEP_WARN() false positives"). However, the current state can > result in false-positive splats during early boot before lockdep is fully > initialized. This commit therefore checks debug_lockdep_rcu_enabled() > both before and after checking the condition, thus avoiding both sets > of false-positive error reports. > > Reported-by: Steven Rostedt > Reported-by: Masami Hiramatsu (Google) > Reported-by: Mathieu Desnoyers > Signed-off-by: Paul E. McKenney > Cc: Boqun Feng > Cc: Matthew Wilcox > Cc: Thomas Gleixner > > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h > index aa1b1c3546d7a..1aec1d53b0c91 100644 > --- a/include/linux/rcupdate.h > +++ b/include/linux/rcupdate.h > @@ -364,11 +364,18 @@ static inline int debug_lockdep_rcu_enabled(void) > * RCU_LOCKDEP_WARN - emit lockdep splat if specified condition is met > * @c: condition to check > * @s: informative message > + * > + * This checks debug_lockdep_rcu_enabled() before checking (c) to > + * prevent early boot splats due to lockdep not yet being initialized, > + * and rechecks it after checking (c) to prevent false-positive splats > + * due to races with lockdep being disabled. See commit 3066820034b5dd > + * ("rcu: Reject RCU_LOCKDEP_WARN() false positives") for more detail. > */ > #define RCU_LOCKDEP_WARN(c, s) \ > do { \ > static bool __section(".data.unlikely") __warned; \ > - if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \ > + if (debug_lockdep_rcu_enabled() && (c) && \ > + debug_lockdep_rcu_enabled() && !__warned) { \ > __warned = true; \ > lockdep_rcu_suspicious(__FILE__, __LINE__, s); \ > } \ -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com