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.129.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 C5FF4269CF6 for ; Thu, 13 Mar 2025 11:44:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741866289; cv=none; b=f3sXdFHd7wkUnv+DgaLomsxsiVHRCM4PBv1kwOBSWnTued0z6cRsl/LKl9h7u1XdXa5WsqLAgKJio/PBe3AClJzVbd5ThzpXZspp4Tmb7p3V3SjpuhFA18Yz+/65MsM2zo3thvPihaG/8lhfTvP+9ifCQJHYyR/t/vaCpL9A0wE= 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=g1lW8dPM; arc=none smtp.client-ip=170.10.129.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="g1lW8dPM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741866286; 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=g1lW8dPMf+Mln25X2Rjyxa1uP3VdBtCo+x6CfoMJVJNQzCBLxoLW9jvr5yHMIY4X8jxUGm CMnAWgHUTXoL4X+QCmmrBx/obLd8i/+e9EZDOgyPwIb1m9/j0xU5UppAFfo1s/NC8KlCsr JDQSI3sa7TOlCXEwaCb6uW+JYoj1rKA= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-495-rDfENyX-OcWHMg-8w4h3-Q-1; Thu, 13 Mar 2025 07:44:46 -0400 X-MC-Unique: rDfENyX-OcWHMg-8w4h3-Q-1 X-Mimecast-MFC-AGG-ID: rDfENyX-OcWHMg-8w4h3-Q_1741866285 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-43ceed237efso5985945e9.0 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=cZVVru72hZVhIt1JcM8jOzcel2ZyL0WF1CndcPXn84zBJeqi3D3XnQxTpF+0SaEZqm /VUJm0HhtXs4xCGsE1w5Z3OjdqHjOolEw+Gpvp1Kj6S4FuFDIXV14oXmLBMxpfS8VGjT hEsQ/k00+iBEoHjGDNN2w4LW9hkxOdHnpFcM9yvelq+eoni9NgidOfDcpc6fjyOhhKx5 abwDrYGK7Tm/bQ46ABI/2BenpVTeT3T+Gk76ov9fE57ZBTEX7D+IOtLbtSvQy2BX7TTo i0vtSGBiJuF0LM/EaLMECZ8px+8mwX/ODky68aynv/GASpXMwsCgkr7IzZHcf51Q//Xf AslQ== X-Forwarded-Encrypted: i=1; AJvYcCV3nVVGknjN9FU8y6HtY72K0a8QWVTZci5pXbzh6imUVIHnbuVYRj5r4B2414ek+vpgLyiTEHN1X9U=@lists.linux.dev X-Gm-Message-State: AOJu0YyR5wgllWei5JvlE6z5TTu0xoo5Gmtbhj+zuVKWAjAAO9KIqeWR OieLPv5AXh7OXLihc7pbE9QM0TGMviDkWCQgVMPUv+h2xz7O5PM9ypBY8BAnmloboIBC1hRdl0l W4ZzonJPvXiiK75laYLKBwKmZmIMDqPEJfItzSBwdVVCJM5U7ecY4diw1bQ== X-Gm-Gg: ASbGncuY6gBGlAbla3qG+kx9im8QWcQaxk6QWC1Z/Fue5SULR3Qj5rqQsAHaNWlgZk/ aZ1ZHE10gutD+Cg6uSFP7TgSRXFmXpjzI73Gdvxr+X+gOzjAXrJfjjKMl41JPHOL0W5KLHlBA6I r8a0iEGo1JxL42MwJG28kUUAZi/g+U5ARyNY1fYCmCGAxB77+57FE7A1kQWor5Y81pto/enYBew k6Cod56Dyy8+roN2SuEjaQLa1+tnJXG1SZCIUxqpVErpxuvylOrn1pWRziUEkReIa6hiR4T6dld lM+N8uTKKQmVoKmRQ+gb X-Received: by 2002:a05:600c:5493:b0:43c:fb8e:aec0 with SMTP id 5b1f17b1804b1-43d01bd21e2mr95038675e9.1.1741866284839; 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: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: roLmfJkGHIZ7haBtqZTdR09SxkrAYk78oWi2sNM6ZhA_1741866285 X-Mimecast-Originator: redhat.com 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 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 64A4CC28B2E for ; Thu, 13 Mar 2025 12:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+L3/KG3KCuOWtUwcNyBbWMLqCeu8g56uby6alWk9wQI=; b=cgdwhY5STjlHo4 uidzedemjFrK+QGBqjQhpQCzfkANHCKxkRId4iyxNEXfq2QyBUzDJ5g1zQgR8OKUraCMVXiwSK4lh 844C2ko90vY/c96pPm8ZnEIw+WFg5gubiX2Hi4C/KIzXLQ+ygSe5klpYcMJlOEeYJUM2CD+tIH/Jk RlZRD8GAXs6K1bp0SpzKlj/NNt3YPFqerBagPzLNBmL1/W5/zhJt271WxM4sLvRDmQUeo3/iPIdKF 2RSiBQTc0dVr0A5XyJ7JdH8rRWkrIUIWQUvuRJmd+WCXOMbr+wLH1lCO4LeXNneA/gJ00rHtOy4KC hX2L76U9+lQdYtEkYi/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tshQt-0000000BCZN-39jt; Thu, 13 Mar 2025 12:13:03 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tsh1J-0000000B63l-2i3I for linux-riscv@lists.infradead.org; Thu, 13 Mar 2025 11:46:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741866396; 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=cU0dokWj1srKD5fHQ4mcj10jud89raeAlP1sExA1G2/zRngfHK2ZPP/0N425cBnrwu3u1q eHyCESZjZFLOsdiIJQc4UCPam+eu+1PYBvRjtDL4vUkf38OD+pQCWHvBHHorLN6sGn2ok6 Q2CBmBDN9JhDnvXd3cdWwr90Doo7N78= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-460-papvK-B_MhuQvcj3ODv14w-1; Thu, 13 Mar 2025 07:44:46 -0400 X-MC-Unique: papvK-B_MhuQvcj3ODv14w-1 X-Mimecast-MFC-AGG-ID: papvK-B_MhuQvcj3ODv14w_1741866285 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-43cf327e9a2so5858605e9.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=W4ZoKNlK8+sC1Toi5tTqpouS5ry+rzlUAppMwkPyTo+wSX/CxFEjfgeOx2FMN0uuCS ElKvg6IAvtYwLs6TsN1G8FfMe2YHNnfbJ/1WuQmfIm9Qpy/xUMwTD365PnO2ONORYbNg fZ3XXgwH0R7BpXiOvrZ6dLB2icmNsR0vdq7v8XIIufmtWiv8bbJIxwHC8BuAjHuwXkxn boncmRKz2N3c6vzs/GOEV0AdAutKELxvn78NPp3kfgxNXD10MR8OUH6l4qzIJupfChF8 mNPyP3oAcrak9U0U2Rqklz0PbeGip2x6255ZD3t/LlGESqHBkG8U1cqY2jOZb44Lx0hI Ti1A== X-Forwarded-Encrypted: i=1; AJvYcCVPd2a4vd+y85Q1xJIY4IwXbBUO2yX50f6cSz5PasZdIY1oy7DLJuLLEcGGjNBcflenKpNVyIKLCjn3cw==@lists.infradead.org X-Gm-Message-State: AOJu0Yw7Z9Kf+l1dic3A/yEajB+N7nsvR3Ao/w7mdxqyH1yupnhxTved mJswq+utmhvcdcvDB9dgohPZGiIcoMQOEcmaRltNhdt6MSwOZgnBw71dyoxNLIqBopTC6LrFyQB 2mH0QxH0w5ya3vSCCmkxgAQ10QaLiWfh3S0X115LL2H3YUaC2W9ZVUe4mOsG86A57Dw== X-Gm-Gg: ASbGncul1xcsgMV/gdi/ut/NOcwCHjjPuSsJAp9WnPrPDGrfQFzmPYV7A5jqu2ASNsI +3UD6/iWefW75nemb2NBaIWZkpBl9slaDQckNqZqq/DIUlkir2Al2V3UQupCSxzBRt8Ue8mVIaB AfQ/YbiOf71Xm7cSGeqe/B8WZHbyoCBs9hp8cUUIGBwrHyT0s63fHx88Vv/HnXHNA4w5KrOqQWw lV2BvShr54gtkJrPqp+5Vg2sBcnftrwGDcLD/6709C+0xexmFNlIqBx4rker9gY97JFls2t3mBE 59Y/nlteTPqG+MLRw3VG X-Received: by 2002:a05:600c:5493:b0:43c:fb8e:aec0 with SMTP id 5b1f17b1804b1-43d01bd21e2mr95038645e9.1.1741866284837; 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> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: S6XXB4fl441q-EUfNtVayRCdU0HdWMkc8RhoQlxxQlw_1741866285 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250313_044637_749566_2C5A7009 X-CRM114-Status: GOOD ( 12.27 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv