From mboxrd@z Thu Jan 1 00:00:00 1970 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 C949F1F63D6 for ; Thu, 13 Mar 2025 22:05:26 +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=1741903526; cv=none; b=RakVgaY6dok+Bl8MiG4qbvQXuPkzsITTg6cvqMD/kotBUYcpCNxPULLmNGtBRqIv8w0q/Rn5IzO767k5mxBPi625ULQwfVQ+MYLyf2y+SpprSFXx6Yr/1xWvpqMMPKxcyqWTV0V9xjxuHyUXFbnBe8/N92FzqFI9P0Z7q8WuD2s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741903526; c=relaxed/simple; bh=CL3LPkKBLadK4e8ljJE7ZWzqk29FGjXOBQ0SY1pxTOY=; h=Date:To:From:Subject:Message-Id; b=cpdG+NHGWN/MY1NimaB86EYZSiPSe5cbDvMPMGS5iNev73P338MHQKR/0txhTOPu2igV+hMzcX8rModQIY5N7+Zr9dowsI+RCVibNi5RcqC9XUyAGI8UTejaDDxDEyVirTps3NX9mufmj0g01BJIJyscIyEFbVPsx+ykIM3EK8A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=DmgSl5bC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="DmgSl5bC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 362DAC4CEDD; Thu, 13 Mar 2025 22:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1741903526; bh=CL3LPkKBLadK4e8ljJE7ZWzqk29FGjXOBQ0SY1pxTOY=; h=Date:To:From:Subject:From; b=DmgSl5bCTucQHdvwnC5y64Jbp1TR3jnMryQrHBzhT2cPxKnbi9DTBKpNpvg1iwFGY gFt7zqZZER4ic1VEqN/Cd2ugVqZbua7zDPL+FnGu6sFDCVB/oLRvVUY5M4u1uK+z0b 7jhOEhxBw74lems8H/4dBS4sBEwZ4x3lijaoLXiw= Date: Thu, 13 Mar 2025 15:05:25 -0700 To: mm-commits@vger.kernel.org,ysato@users.sourceforge.jp,will@kernel.org,ville.syrjala@linux.intel.com,tzimmermann@suse.de,tglx@linutronix.de,rmoar@google.com,paul.walmsley@sifive.com,palmer@dabbelt.com,naresh.kamboju@linaro.org,mripard@kernel.org,mpe@ellerman.id.au,mingo@redhat.com,mcanal@igalia.com,maarten.lankhorst@linux.intel.com,lkft@linaro.org,keescook@chromium.org,jani.nikula@intel.com,horms@kernel.org,hca@linux.ibm.com,gor@linux.ibm.com,glaubitz@physik.fu-berlin.de,deller@gmx.de,davidgow@google.com,dave.hansen@linux.intel.com,daniel@ffwll.ch,daniel.diaz@linaro.org,dan.carpenter@linaro.org,dalias@libc.org,chenhuacai@kernel.org,charlie@rivosinc.com,catalin.marinas@arm.com,brendan.higgins@linux.dev,bp@alien8.de,arthurgrillo@riseup.net,arnd@arndb.de,aou@eecs.berkeley.edu,airlied@gmail.com,agordeev@linux.ibm.com,acarmina@redhat.com,linux@roeck-us.net,akpm@linux-foundation.org From: Andrew Morton Subject: + x86-add-support-for-suppressing-warning-backtraces.patch added to mm-nonmm-unstable branch Message-Id: <20250313220526.362DAC4CEDD@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The patch titled Subject: x86: add support for suppressing warning backtraces has been added to the -mm mm-nonmm-unstable branch. Its filename is x86-add-support-for-suppressing-warning-backtraces.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/x86-add-support-for-suppressing-warning-backtraces.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Guenter Roeck Subject: x86: add support for suppressing warning backtraces Date: Thu, 13 Mar 2025 11:43:21 +0000 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). Link: https://lkml.kernel.org/r/20250313114329.284104-7-acarmina@redhat.com Signed-off-by: Guenter Roeck Signed-off-by: Alessandro Carminati Tested-by: Linux Kernel Functional Testing Acked-by: Dan Carpenter Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: Albert Ou Cc: Alexander Gordeev Cc: Arnd Bergmann Cc: Arthur Grillo Cc: Brendan Higgins Cc: Catalin Marinas Cc: Charlie Jenkins Cc: Daniel Diaz Cc: Daniel Vetter Cc: Dave Airlie Cc: David Gow Cc: Heiko Carstens Cc: Helge Deller Cc: Huacai Chen Cc: Jani Nikula Cc: John Paul Adrian Glaubitz Cc: Kees Cook Cc: Maarten Lankhorst Cc: MaĆ­ra Canal Cc: Maxime Ripard Cc: Michael Ellerman Cc: Naresh Kamboju Cc: Palmer Dabbelt Cc: Paul Walmsley Cc: Rae Moar Cc: Rich Felker Cc: Simon Horman Cc: Thomas Zimemrmann Cc: Vasily Gorbik Cc: Ville Syrjala Cc: Will Deacon Cc: Yoshinori Sato Signed-off-by: Andrew Morton --- arch/x86/include/asm/bug.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) --- a/arch/x86/include/asm/bug.h~x86-add-support-for-suppressing-warning-backtraces +++ a/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) _ Patches currently in -mm which might be from linux@roeck-us.net are bug-kunit-core-support-for-suppressing-warning-backtraces.patch kunit-bug-count-suppressed-warning-backtraces.patch kunit-add-test-cases-for-backtrace-warning-suppression.patch kunit-add-documentation-for-warning-backtrace-suppression-api.patch drm-suppress-intentional-warning-backtraces-in-scaling-unit-tests.patch x86-add-support-for-suppressing-warning-backtraces.patch arm64-add-support-for-suppressing-warning-backtraces.patch loongarch-add-support-for-suppressing-warning-backtraces.patch parisc-add-support-for-suppressing-warning-backtraces.patch s390-add-support-for-suppressing-warning-backtraces.patch sh-add-support-for-suppressing-warning-backtraces.patch sh-move-defines-needed-for-suppressing-warning-backtraces.patch riscv-add-support-for-suppressing-warning-backtraces.patch powerpc-add-support-for-suppressing-warning-backtraces.patch