Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp26753rbe; Wed, 28 Feb 2024 10:57:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWVTwNxurE0UNKLtGVt+6kVfIJPP8BcaHRi9VwRPaCrERbvpWIxcNxf7Ud5ceY+AUa+Za7re4yXncQogrU3gdEJaMIOuTUJOR61/5maaA== X-Google-Smtp-Source: AGHT+IFO7paNUgcwVO8nEowAEWiJB2LlJ2vk+rpQ2xPYGzYyH49HmToAz2KewHWL75ScHtDwkY9Y X-Received: by 2002:a17:906:348c:b0:a3f:c3f0:69bf with SMTP id g12-20020a170906348c00b00a3fc3f069bfmr90330ejb.13.1709146634381; Wed, 28 Feb 2024 10:57:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709146634; cv=pass; d=google.com; s=arc-20160816; b=vBqZ627TKB0k0of2kC9boVO7R+1tiB/8ARZB0VYUHuTzO/M5lxnI5LY6+Z6TwcG9Ug q3HFqKlN6G8pgfAPrtfJu7aq89P31gm3BhL/E4bPNR5xqjFO+o7HgBZUd48HHFrjlGiM 25XJl4wMp2xG1HLtVT+WWGY+qqb7wkWebpT85WdiZSMTSXZHtaChdyKlAp+UNKoqG4fG Y+l1OUsKOe1j4720RRkvyD5sM892Jk32q8ZUf3SlVwJZuXCA6u5iBnWHbqKTxJzlU3+M 2KFI9e2LQ+fg/7Wn37TdOGkwurqLutKAOC8Q/VWOiUAWWvdCXNJVzRUOoZIWhF+u2sE6 DOAA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=v5N6u5ZSfBKNa0FfTVjRwbxAdERgYUf+xIiNhcukpto=; fh=WSUl/O3CT/LlWLOYDznchhxz6wBM1R17pZj5gmPu8O0=; b=kjxME0iuN7P5EYc1L7GBxLet+seKKweg41OKf196DARZfcx5V+Mc1Gnl0jsAuJ62Mt MunOID8xarVXXZU7L5pMr0nE2OE3md7Jl67tX5RXjLlfbKPJuLwQ+6dHn9Y4BxzfAMjs iLSF1aBrIDgPGXXUbhruphUmDUguiMJlv/f+LM96vHfH1TUxcRVkbza7Ti5rYPVPDTKB X10mqS6QyIWV1bodno3ZQKXKAG89kgAr6cwt631UdS8UjE0OTx/ws5/s5IbgWscrdoib YZx2Ly8tgYcFLZuEb1USoTmHHepATIB6hpjKs47CF+PRGmcA7S2q4KO+olq6a/OdvHvb cY5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jqdIO8tH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-85552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id u10-20020a17090663ca00b00a3e6b8363e1si1899814ejk.533.2024.02.28.10.57.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 10:57:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jqdIO8tH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-85552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C83FD1F2A2D2 for ; Wed, 28 Feb 2024 18:48:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0033071EC8; Wed, 28 Feb 2024 18:48:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jqdIO8tH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 251B871EAE; Wed, 28 Feb 2024 18:48:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709146113; cv=none; b=kbYvDlikFsKxANcYqPln4bLNfh350NLb2/pJbUsN/XQ/fPIphFZCpRMLKQwE/LkWBSoOf3cFZoHNL5lCNCQkKpqH3ZmYUmrSY2i+c4A6tlXiUAG5NX3my0TToRvAkGRn6yQGAehNTUlNK2zj2GKbO2YwtxuV5Lh1auDvXpyXOCM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709146113; c=relaxed/simple; bh=I1FvYieTX2lMCO6HW6oRx/DgD5ZUO5pYflH+dqxQSng=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pVINBu1JoJQE/qU3jFuSoYD85mWlMq2ni8q9AnHp+ILzYJendatO3h+ZlH5yvVXfbT8u69/xNrrARxFDe1RADWpvv008gxgPd9CFNwNrGnr3MjEbF2dmE9gPXEoDAb+ZNFNDDfXIP7ZVLcHptMN53i4ImXpU1gH7PszPsXP8oeo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jqdIO8tH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A71CC433C7; Wed, 28 Feb 2024 18:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709146112; bh=I1FvYieTX2lMCO6HW6oRx/DgD5ZUO5pYflH+dqxQSng=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=jqdIO8tHM3uGKe8pv5ysvLhoq4IOs9HFHDWQDhPTxG6BeA3vlZHY6OtcVIkA7VXbw M89Fs7z6k9gNnYIoSlr4sOcu/VUw1pBGeG177PNsJqSQdluOFLVNhn3cr6rHRHrV9w tTXazdvUHLxclGVvffSZfHqlCI35ScxuWDXorBj8gyC+CdQ/qcV76d21adR3hLSOc2 TI6WQZU1LafFB5d1wAc/dnIrzFct+CoTLEWSCmQlypP27eDS75ddSiTEDM0JTXukiS HlmQmS73NFDLQniye+Vv8RbZHc7relEffN11zK1KrAiSxIZ+nA6Kkfmn1o0hC+BgLU 4CUAlX9bzLH2g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 13D5BCE0358; Wed, 28 Feb 2024 10:48:32 -0800 (PST) Date: Wed, 28 Feb 2024 10:48:32 -0800 From: "Paul E. McKenney" To: Steven Rostedt Cc: LKML , Linux Trace Kernel , Masami Hiramatsu , Mathieu Desnoyers , Borislav Petkov , Thomas Gleixner Subject: Re: [PATCH] tracepoints: Use WARN() and not WARN_ON() for warnings Message-ID: <23ffccec-8fb5-4f44-a193-0d21eaf07d1b@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20240228133112.0d64fb1b@gandalf.local.home> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240228133112.0d64fb1b@gandalf.local.home> On Wed, Feb 28, 2024 at 01:31:12PM -0500, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > There are two WARN_ON*() warnings in tracepoint.h that deal with RCU > usage. But when they trigger, especially from using a TRACE_EVENT() > macro, the information is not very helpful and is confusing: > > ------------[ cut here ]------------ > WARNING: CPU: 0 PID: 0 at include/trace/events/lock.h:24 lock_acquire+0x2b2/0x2d0 > > Where the above warning takes you to: > > TRACE_EVENT(lock_acquire, <<<--- line 24 in lock.h > > TP_PROTO(struct lockdep_map *lock, unsigned int subclass, > int trylock, int read, int check, > struct lockdep_map *next_lock, unsigned long ip), > [..] > > Change the WARN_ON_ONCE() to WARN_ONCE() and add a string that allows > someone to search for exactly where the bug happened. > > Reported-by: Borislav Petkov > Signed-off-by: Steven Rostedt (Google) Reviewed-by: Paul E. McKenney > --- > include/linux/tracepoint.h | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h > index 88c0ba623ee6..689b6d71590e 100644 > --- a/include/linux/tracepoint.h > +++ b/include/linux/tracepoint.h > @@ -199,7 +199,8 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) > if (!(cond)) \ > return; \ > \ > - if (WARN_ON_ONCE(RCUIDLE_COND(rcuidle))) \ > + if (WARN_ONCE(RCUIDLE_COND(rcuidle), \ > + "Bad RCU usage for tracepoint")) \ > return; \ > \ > /* keep srcu and sched-rcu usage consistent */ \ > @@ -259,7 +260,8 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) > TP_ARGS(args), \ > TP_CONDITION(cond), 0); \ > if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \ > - WARN_ON_ONCE(!rcu_is_watching()); \ > + WARN_ONCE(!rcu_is_watching(), \ > + "RCU not watching for tracepoint"); \ > } \ > } \ > __DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \ > -- > 2.43.0 >