From nobody Mon Sep 15 07:33:21 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2B69C54EBD for ; Fri, 13 Jan 2023 12:34:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241443AbjAMMeO (ORCPT ); Fri, 13 Jan 2023 07:34:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241313AbjAMMcO (ORCPT ); Fri, 13 Jan 2023 07:32:14 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B5BC544EE; Fri, 13 Jan 2023 04:31:12 -0800 (PST) Date: Fri, 13 Jan 2023 12:31:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673613068; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B8W9VgYMwyJ7o4FzoZE/YYmq/7I6X546PhnibH4LBLo=; b=m0HCAdQCEguf39lX/MGQfnfRWoMNK0ICTOKHQZAQUnH2VqP8LlvrSqPWLjQ1w2k/I31LRR 9dkvUHO5BJa8VggIjfHZUGz1EyfThQ0FgntW2ucggDYQDqpQMVycMG198b5aI/m0a8R7vu /XAkGYdgMbKUSP0sqLTSPhSm97AGExYV/3CsAmjHplDlyKIJFHdTVSnmTDUGYHhsF7fmNK XuevKCupsE4yAtiGeXcqHJxObIN/w6evK0WqWd5ZNnpb6RCIOSX5PXktppvElLUIaGy24J 7tizgovXswWSUhb9QwLnlalVcp8zyrw3EjbbCz01XzZlp1K8AQJKX7TnJeTH4A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673613068; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B8W9VgYMwyJ7o4FzoZE/YYmq/7I6X546PhnibH4LBLo=; b=aKpAhI/T5TfpUch7Vq4NlaPGb7hVn/5PuqEs6HkX4puiYiiQMIMcLA7PzgSsm8NBWdSFuA An4nlLZp+Ht9FGBA== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] tracing: WARN on rcuidle Cc: "Peter Zijlstra (Intel)" , Ingo Molnar , Tony Lindgren , Ulf Hansson , "Rafael J. Wysocki" , Frederic Weisbecker , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230112195541.416110581@infradead.org> References: <20230112195541.416110581@infradead.org> MIME-Version: 1.0 Message-ID: <167361306830.4906.9126654515923168078.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 408b961146be4c1a776ce285c3c289afab15298a Gitweb: https://git.kernel.org/tip/408b961146be4c1a776ce285c3c289afa= b15298a Author: Peter Zijlstra AuthorDate: Thu, 12 Jan 2023 20:43:48 +01:00 Committer: Ingo Molnar CommitterDate: Fri, 13 Jan 2023 11:48:16 +01:00 tracing: WARN on rcuidle ARCH_WANTS_NO_INSTR (a superset of CONFIG_GENERIC_ENTRY) disallows any and all tracing when RCU isn't enabled. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Tested-by: Tony Lindgren Tested-by: Ulf Hansson Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Link: https://lore.kernel.org/r/20230112195541.416110581@infradead.org --- include/linux/tracepoint.h | 15 +++++++++++++-- kernel/trace/trace.c | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 4b33b95..552f80b 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -178,6 +178,17 @@ static inline struct tracepoint *tracepoint_ptr_deref(= tracepoint_ptr_t *p) #endif /* CONFIG_HAVE_STATIC_CALL */ =20 /* + * ARCH_WANTS_NO_INSTR archs are expected to have sanitized entry and idle + * code that disallow any/all tracing/instrumentation when RCU isn't watch= ing. + */ +#ifdef CONFIG_ARCH_WANTS_NO_INSTR +#define RCUIDLE_COND(rcuidle) (rcuidle) +#else +/* srcu can't be used from NMI */ +#define RCUIDLE_COND(rcuidle) (rcuidle && in_nmi()) +#endif + +/* * it_func[0] is never NULL because there is at least one element in the a= rray * when the array itself is non NULL. */ @@ -188,8 +199,8 @@ static inline struct tracepoint *tracepoint_ptr_deref(t= racepoint_ptr_t *p) if (!(cond)) \ return; \ \ - /* srcu can't be used from NMI */ \ - WARN_ON_ONCE(rcuidle && in_nmi()); \ + if (WARN_ON_ONCE(RCUIDLE_COND(rcuidle))) \ + return; \ \ /* keep srcu and sched-rcu usage consistent */ \ preempt_disable_notrace(); \ diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index a555a86..54ec159 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -3128,6 +3128,9 @@ void __trace_stack(struct trace_array *tr, unsigned i= nt trace_ctx, return; } =20 + if (WARN_ON_ONCE(IS_ENABLED(CONFIG_GENERIC_ENTRY))) + return; + /* * When an NMI triggers, RCU is enabled via ct_nmi_enter(), * but if the above rcu_is_watching() failed, then the NMI