Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp99266rwb; Tue, 13 Dec 2022 14:37:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf6fwyt3lz97ac68am7+K39Xybjaq9TOoZFw/wsGKvWxfsmM5u0OWMAxmRsm5y2j0aMIagFx X-Received: by 2002:a17:907:8a22:b0:7af:16b5:9af8 with SMTP id sc34-20020a1709078a2200b007af16b59af8mr26062864ejc.33.1670971037849; Tue, 13 Dec 2022 14:37:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670971037; cv=none; d=google.com; s=arc-20160816; b=wV65N9HuDoUMpoiw2kGGXKTQ7WQH/Fh47R/8K7caxRFFfVaCPtb2W9kWhcjGjWj3ps Aj8jENgiTGMV0mBk347QCcnVtLqHaSkbWebT22YB2Eb6gpEANUQ9y5ZOnXU25Fk2m+Pz VoNiNirPiLOfJJDf12VdFBbxS9hEfXHqQ5HElAYwTdjbVrrTaoK+0fcqA98WqRMTqmiw Qe+ZgMMa6LqjCJk4h/0IsT3ZeBNHXbJKAhb/0g/W/bp0MOjvpO5FZG41JBQkzQPnSBKq 9qRhmWX46WflerhHxkw1S1prDyFYI0+A0S2bf9UCfSGysADl6kFXnMyq3tV4QKZrmWDF T3+w== 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 :message-id:subject:cc:to:from:date; bh=BjiwROY46J94ohQ0VTtdM4upa7u6bOXZrqu0ER18S0E=; b=wpXmybNQG/Tu2ufyQa3Q2AeR3twsgAG9OU/MOY3W+1ECZVELbW+R7H7/jIxVNwhY1u jDJCgHnNUZBONomYcrEQ1QrGcXccrSIrt4LUlecUxLtasTVgHdaPLaJ2MhsuyvX0cenN a9DcxVXVYgBQcY7qis5s0zHc3JDD13wbqkSJNsCUqWMi8UGOLxOprzWSDNog3cABf/Xg Fur2NyYHRYPmjiBIKDkzZ8vUDqUr6zaNQf4ZAig+bT8z3ptW3JhD2EIc5ez/LXtG5LlZ seEkrtPlzVBywGeTu86TJEwfiadQngwmRBcyyTzZM73Wa7LLb/WscLQQnwmgpwN+cKLl Prgw== 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 dt18-20020a170907729200b0077eca9fa444si8100787ejc.187.2022.12.13.14.37.00; Tue, 13 Dec 2022 14:37:17 -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 S236654AbiLMWYi (ORCPT + 72 others); Tue, 13 Dec 2022 17:24:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235836AbiLMWYf (ORCPT ); Tue, 13 Dec 2022 17:24:35 -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 D9B8313F89; Tue, 13 Dec 2022 14:24:33 -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 A716CB815FC; Tue, 13 Dec 2022 22:24:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D92D1C433D2; Tue, 13 Dec 2022 22:24:30 +0000 (UTC) Date: Tue, 13 Dec 2022 17:24:29 -0500 From: Steven Rostedt To: LKML , Linux Trace Kernel Cc: Masami Hiramatsu , Andrew Morton Subject: [PATCH] tracing: Do not synchronize freeing of trigger filter on boot up Message-ID: <20221213172429.7774f4ba@gandalf.local.home> 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 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. Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events_trigger.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c index 19ce9d22bfd7..e535959939d3 100644 --- a/kernel/trace/trace_events_trigger.c +++ b/kernel/trace/trace_events_trigger.c @@ -1085,8 +1085,14 @@ int set_trigger_filter(char *filter_str, rcu_assign_pointer(data->filter, filter); if (tmp) { - /* Make sure the call is done with the filter */ - tracepoint_synchronize_unregister(); + /* + * Make sure the call is done with the filter. + * It is possible that a filter could fail at boot up, + * and then this path will be called. Avoid the synchronization + * in that case. + */ + if (system_state != SYSTEM_BOOTING) + tracepoint_synchronize_unregister(); free_event_filter(tmp); } -- 2.35.1