From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC91CC3601A for ; Tue, 1 Apr 2025 17:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QwFzB9rgmSr+DDy/b0Hd/aaJjyUrXEHFSgwJ+5QTAZE=; b=lWpAkRMPWuUTV8PeNsAunmiQbh 41FNniEWTRctupSObxohCEn1CiZFFulE6gGycKw9Bj9iTFBVsp41v6xdly79w5MIut6T4Wg9BKzPd C9gC6pcmBR8gKXZUXI9FckMT0UjKYbnLP19Yi5SAY4eAqNHWGWIO24HqxKiCQQEtHuSRrw69ja2/T pkE720tsEdZgfPsQebdX4sugz5gEzdRNIdEprfyKEecKRfySzAiapnfQI11v7LqKMfgJZ5x3aNXpA 7blFzZHch0SmF2siemVddUa/Bgf/GSDXAPstVX7UjiQlNvgVec2qzoBFhRXLSjD6/kCQvtV6HzCRi L98pPv9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzf8A-00000003yab-21F1; Tue, 01 Apr 2025 17:10:30 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzf6N-00000003yDG-1pKy; Tue, 01 Apr 2025 17:08:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=QwFzB9rgmSr+DDy/b0Hd/aaJjyUrXEHFSgwJ+5QTAZE=; b=SkQff7ui2dNykAT/PDqf0vlSCq JvsCdACSYe6T3hSLfM3FS6XnoTUAWaC8QlDsGfSHAfpe3/1xMVYJjq+Ehpkz9GRAJZCdFb8EvtwBF iljWyv4a77vp98tDoDmbknBxwJr/Ku7C441orgCjgmX5MTGO1jD0vg5GjeLbUkjz7kfmLhYFNDD1Q XlvxjXhT4fRnPenmqAN0T7HKdRn6O7ymBiNQB6qVgVVnoc6IYGnALtk9chuv+O9zRJ3YCbXis/703 u/jnLw1FwOHLiS4NfA9/hp64nCVZZHYbIfpxDLawE14K4BvpIe4Kdf2BHTdR3CHh1eLXfeo3Dtz1N pbzxgLSw==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzf6D-00000006qiQ-3phb; Tue, 01 Apr 2025 17:08:30 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 1849630049D; Tue, 1 Apr 2025 19:08:29 +0200 (CEST) Date: Tue, 1 Apr 2025 19:08:29 +0200 From: Peter Zijlstra To: Alessandro Carminati Cc: linux-kselftest@vger.kernel.org, David Airlie , Arnd Bergmann , =?iso-8859-1?Q?Ma=EDra?= Canal , Dan Carpenter , Kees Cook , Daniel Diaz , David Gow , Arthur Grillo , Brendan Higgins , Naresh Kamboju , Maarten Lankhorst , Andrew Morton , Maxime Ripard , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Daniel Vetter , Thomas Zimmermann , Guenter Roeck , Alessandro Carminati , Jani Nikula , dri-devel@lists.freedesktop.org, kunit-dev@googlegroups.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, loongarch@lists.linux.dev, x86@kernel.org, Linux Kernel Functional Testing , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen Subject: Re: [PATCH v4 06/14] x86: Add support for suppressing warning backtraces Message-ID: <20250401170829.GO5880@noisy.programming.kicks-ass.net> References: <20250313114329.284104-1-acarmina@redhat.com> <20250313114329.284104-7-acarmina@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250313114329.284104-7-acarmina@redhat.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Mar 13, 2025 at 11:43:21AM +0000, Alessandro Carminati wrote: > From: Guenter Roeck > > Add name of functions triggering warning backtraces to the __bug_table > object section to enable support for suppressing WARNING backtraces. > > To limit image size impact, the pointer to the function name is only added > to the __bug_table section if both CONFIG_KUNIT_SUPPRESS_BACKTRACE and > CONFIG_DEBUG_BUGVERBOSE are enabled. Otherwise, the __func__ assembly > parameter is replaced with a (dummy) NULL parameter to avoid an image size > increase due to unused __func__ entries (this is necessary because __func__ > is not a define but a virtual variable). > > Tested-by: Linux Kernel Functional Testing > Acked-by: Dan Carpenter > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: Dave Hansen > Signed-off-by: Guenter Roeck > Signed-off-by: Alessandro Carminati > --- > arch/x86/include/asm/bug.h | 21 ++++++++++++++++----- > 1 file changed, 16 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h > index e85ac0c7c039..f6e13fc675ab 100644 > --- a/arch/x86/include/asm/bug.h > +++ b/arch/x86/include/asm/bug.h > @@ -35,18 +35,28 @@ > > #ifdef CONFIG_DEBUG_BUGVERBOSE > > +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE > +# define HAVE_BUG_FUNCTION > +# define __BUG_FUNC_PTR __BUG_REL(%c1) > +# define __BUG_FUNC __func__ > +#else > +# define __BUG_FUNC_PTR > +# define __BUG_FUNC NULL > +#endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ > + > #define _BUG_FLAGS(ins, flags, extra) \ > do { \ > asm_inline volatile("1:\t" ins "\n" \ > ".pushsection __bug_table,\"aw\"\n" \ > "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ > "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \ > - "\t.word %c1" "\t# bug_entry::line\n" \ > - "\t.word %c2" "\t# bug_entry::flags\n" \ > - "\t.org 2b+%c3\n" \ > + "\t" __BUG_FUNC_PTR "\t# bug_entry::function\n" \ > + "\t.word %c2" "\t# bug_entry::line\n" \ > + "\t.word %c3" "\t# bug_entry::flags\n" \ > + "\t.org 2b+%c4\n" \ > ".popsection\n" \ > extra \ > - : : "i" (__FILE__), "i" (__LINE__), \ > + : : "i" (__FILE__), "i" (__BUG_FUNC), "i" (__LINE__),\ > "i" (flags), \ > "i" (sizeof(struct bug_entry))); \ > } while (0) > @@ -92,7 +102,8 @@ do { \ > do { \ > __auto_type __flags = BUGFLAG_WARNING|(flags); \ > instrumentation_begin(); \ > - _BUG_FLAGS(ASM_UD2, __flags, ANNOTATE_REACHABLE(1b)); \ > + if (!KUNIT_IS_SUPPRESSED_WARNING(__func__)) \ > + _BUG_FLAGS(ASM_UD2, __flags, ANNOTATE_REACHABLE(1b)); \ > instrumentation_end(); \ > } while (0) NAK, this grows the BUG site for now appreciable reason.