From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 3DE502698A3 for ; Thu, 13 Mar 2025 11:44:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741866289; cv=none; b=Qv85tLuITh5QvpTBjdRpAKxQacoi/ID6gDlylJLhlbNiM4LTiq209NYEUuAXtfzdTnJ7zmo2T1dz2uWkRKo6QeRQc7Z0CBMPOxHKQYKA74bajp64oBNHngYF6MEdNnjJYz/CVSPOSAbRF9xyrr58H7BWWphhE+GyClGYAL+RfCE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741866289; c=relaxed/simple; bh=liO3eLVl1wJXmy8vDx1YCNgXVebD8YdGrdwAIJcfcmo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-type; b=KiMfAtvkRBf1Y0FY0GTGHQtqvKxu1cbkaQwUB+jslxUKTNutGvcSl/Bpi/JE5Ymf+s1NjOnbrzRais5TYOhT5wxuI/ISzFz400PXa6uflMQegloc3iEAXDPb3Y3q2uyWzNBA0go2ODIjlHS+lbCTXpafo4VE0PztiJo4h5lfPTI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XO5VPXe0; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XO5VPXe0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741866287; h=from:from: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=GROr3WSjkuWJZb5whyX7QQnwj0kVrCWo4LNK5GIabXk=; b=XO5VPXe0NBfQWbh3tLFkVefDubfuOo+XDt6lhuKHMBWQu2K8lHIMAznoR/y1ULKDqiryXE XPGGtMAlF6/zT+621RSPCD67Cj+8Bn/v18inl13XoISRtWj3FCSAq3qqp4BKjpDh3dafQs fjaejtCcrclcDhm6piul8HgTbkUU4wk= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-56-LFMLoOmoNqSNvibQBVD58g-1; Thu, 13 Mar 2025 07:44:46 -0400 X-MC-Unique: LFMLoOmoNqSNvibQBVD58g-1 X-Mimecast-MFC-AGG-ID: LFMLoOmoNqSNvibQBVD58g_1741866285 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-43cf327e9a2so5858625e9.3 for ; Thu, 13 Mar 2025 04:44:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741866285; x=1742471085; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GROr3WSjkuWJZb5whyX7QQnwj0kVrCWo4LNK5GIabXk=; b=gJNy3XlxHJ0g/pR63e/U4MKPnCagBVowi8jVRZnNHJP6au6NB6PGSms1oZMLQMLIex CMqOb8qTkouzSXB0THFmt6+YvOxtMmKeSfGyKf5YvAkoY4A0NJAL2tR7yWdH6iDYxRqW GVxp6FbQ+NPj/76+3dUs+oKZHFKpC1CNGcT87odwwIJ07FfiNSJwbOH6up+1tpFP9QhN Na6X8QzxwgUAvXegK4ITI/GQO8gMiuyHRd9SZ3Rtla4mLIYup6nb+NENE+31BwXFYXAo 4DLgqqLozV1g6FHv7lC6myOQ7EryP6LYiVhti5UqHr57IUT140hvZkIgPM1b+ZdvJMPx /CXw== X-Forwarded-Encrypted: i=1; AJvYcCVXJwoffdu91MMa43/DGdMHgnk8aKNEPJGtDqrQHdB2wjROtTLZpoRsSjCIieTN43PrBVU6q+6pZZ67@vger.kernel.org X-Gm-Message-State: AOJu0YxVtacwHPFXcQdAGCUV9NcwmYvkVGdvU4iAmPOd/1OF75kHuuAb YmVZcRSz8b5tp0E9KU7Xdooq+vP8TrRN7zWBYJnUbDVUhXnU9A5Wv5WKwYX/rszgsQWb3vO1iBt 69CBNxv5gvRg/CDYKi82LLOtMG1am1D//on9enSprxYRiIpXIuVihL5JE73g= X-Gm-Gg: ASbGncs4SugCl5zGMh0nXE4MNK965jdzzvlZG8CCRqXTbB/FR509syIrVfvFiwC6goT pA3A9VHgPagzzYJ5zxtYllqmKvjTP/lmNF8gD4GVPj0aFxAyjg42jlExgldN7z1qEYpiDT7CFCO ouEPZxIXsXu1xPflnRclQwPJGzhCnOyg3jLv1I1NeVkSJuJoYor/2pKiA+jWrIDgzFMW8GtUtVT ofVeiDbov4D0w1eSIkXHRUVge/5ZrrI+e6fpCSoMILr6Ck5o/wmGGhqw4oUQ4q7rpzA/FtgsOpB n2ZV1y7Mtpsa1GIA8eI5 X-Received: by 2002:a05:600c:5493:b0:43c:fb8e:aec0 with SMTP id 5b1f17b1804b1-43d01bd21e2mr95038825e9.1.1741866284852; Thu, 13 Mar 2025 04:44:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmAbVJJ3Axf7J+/aQFhSVgbztnHuV0D3aaCUWl74kfxPn81ZspK5wVSFqWrESjIWmYzw2aJw== X-Received: by 2002:a05:600c:5493:b0:43c:fb8e:aec0 with SMTP id 5b1f17b1804b1-43d01bd21e2mr95038375e9.1.1741866284399; Thu, 13 Mar 2025 04:44:44 -0700 (PDT) Received: from lab.hqhome163.com ([81.57.75.210]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43d188b754asm17844115e9.14.2025.03.13.04.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Mar 2025 04:44:43 -0700 (PDT) From: Alessandro Carminati To: linux-kselftest@vger.kernel.org Cc: David Airlie , Arnd Bergmann , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Dan Carpenter , Kees Cook , Daniel Diaz , David Gow , Arthur Grillo , Brendan Higgins , Naresh Kamboju , Maarten Lankhorst , Andrew Morton , Maxime Ripard , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , 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 , Catalin Marinas , Will Deacon , Alessandro Carminati Subject: [PATCH v4 07/14] arm64: Add support for suppressing warning backtraces Date: Thu, 13 Mar 2025 11:43:22 +0000 Message-Id: <20250313114329.284104-8-acarmina@redhat.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250313114329.284104-1-acarmina@redhat.com> References: <20250313114329.284104-1-acarmina@redhat.com> Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit 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: Catalin Marinas Cc: Will Deacon Signed-off-by: Guenter Roeck Signed-off-by: Alessandro Carminati --- arch/arm64/include/asm/asm-bug.h | 27 ++++++++++++++++++--------- arch/arm64/include/asm/bug.h | 8 +++++++- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/arch/arm64/include/asm/asm-bug.h b/arch/arm64/include/asm/asm-bug.h index 6e73809f6492..bf0a5ba81611 100644 --- a/arch/arm64/include/asm/asm-bug.h +++ b/arch/arm64/include/asm/asm-bug.h @@ -8,37 +8,46 @@ #include #ifdef CONFIG_DEBUG_BUGVERBOSE -#define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line) -#define __BUGVERBOSE_LOCATION(file, line) \ + +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE +# define HAVE_BUG_FUNCTION +# define __BUG_FUNC_PTR(func) .long func - .; +#else +# define __BUG_FUNC_PTR(func) +#endif + +#define _BUGVERBOSE_LOCATION(file, func, line) __BUGVERBOSE_LOCATION(file, func, line) +#define __BUGVERBOSE_LOCATION(file, func, line) \ .pushsection .rodata.str,"aMS",@progbits,1; \ 14472: .string file; \ .popsection; \ \ .long 14472b - .; \ + __BUG_FUNC_PTR(func) \ .short line; #else -#define _BUGVERBOSE_LOCATION(file, line) +#define _BUGVERBOSE_LOCATION(file, func, line) #endif #ifdef CONFIG_GENERIC_BUG -#define __BUG_ENTRY(flags) \ +#define __BUG_ENTRY(flags, func) \ .pushsection __bug_table,"aw"; \ .align 2; \ 14470: .long 14471f - .; \ -_BUGVERBOSE_LOCATION(__FILE__, __LINE__) \ +_BUGVERBOSE_LOCATION(__FILE__, func, __LINE__) \ .short flags; \ .align 2; \ .popsection; \ 14471: #else -#define __BUG_ENTRY(flags) +#define __BUG_ENTRY(flags, func) #endif -#define ASM_BUG_FLAGS(flags) \ - __BUG_ENTRY(flags) \ +#define ASM_BUG_FLAGS(flags, func) \ + __BUG_ENTRY(flags, func) \ brk BUG_BRK_IMM -#define ASM_BUG() ASM_BUG_FLAGS(0) +#define ASM_BUG() ASM_BUG_FLAGS(0, .) #endif /* __ASM_ASM_BUG_H */ diff --git a/arch/arm64/include/asm/bug.h b/arch/arm64/include/asm/bug.h index 28be048db3f6..044c5e24a17d 100644 --- a/arch/arm64/include/asm/bug.h +++ b/arch/arm64/include/asm/bug.h @@ -11,8 +11,14 @@ #include +#ifdef HAVE_BUG_FUNCTION +# define __BUG_FUNC __func__ +#else +# define __BUG_FUNC NULL +#endif + #define __BUG_FLAGS(flags) \ - asm volatile (__stringify(ASM_BUG_FLAGS(flags))); + asm volatile (__stringify(ASM_BUG_FLAGS(flags, %c0)) : : "i" (__BUG_FUNC)); #define BUG() do { \ __BUG_FLAGS(0); \ -- 2.34.1