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 F2B35C282DE for ; Thu, 13 Mar 2025 12:11:26 +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=sxFyqPvQD0EVansVQ2aDiZ8hluJuE5LBQPMaTjxBDAQ=; b=zj8Ecm4HydCF3d txgCeMeANt8TV7mbqkXRGa6YjX1s1YLjG2ASF8ZnF38hA5TI1D83eFAkz5es0Y231uCutea+ZZ4u8 obE/0SKTOQx+vLZZ26vMl9PHzbvlJLkvVW39MjBz1+bljkWld5xp8O2TsvncgUz5t9EjfMMPqPYLL VgPgijmss3eywYAA6FZquEg32OilU4a/dwwQXNs8xkNxcLLCTq3QNpvZ6SNyFRUCmlQ+nbv/GZAm6 lh73ziXRt2SISWhciDCKif4sHe6K6rIx8j4muVfeDVDeqMnBN4MQpIL3sMbxzeHcPOl+G/FNyNxq4 Bg14qYXgEbzH82+dFfEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tshPG-0000000BCFM-1sKF; Thu, 13 Mar 2025 12:11:22 +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 1tsh1A-0000000B620-1oaH for linux-riscv@lists.infradead.org; Thu, 13 Mar 2025 11:46:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741866387; 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=BMlGspdrpbJ31u0fCjYvjyAZlqg7W4BaKawB7P7nRsE=; b=AZkrlLAcmfUsD9FXNAw7UtDjTN8s7pXDRtE5Q+jpgmzaw1Y32P3YBQikL5TFYZZMEJHYzi aKG90JBs+IGO74WASufJ6PS5Lthn7P5lr0h91iq55Unf5fC88D8ijBEGVuAsY7Lb4qa50i wTdTsx94dq7fX17TV8z24IdoSCTBImY= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-488-JUGQctrFP92swUgJZ89ezg-1; Thu, 13 Mar 2025 07:45:01 -0400 X-MC-Unique: JUGQctrFP92swUgJZ89ezg-1 X-Mimecast-MFC-AGG-ID: JUGQctrFP92swUgJZ89ezg_1741866301 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-43ab5baf62cso6562695e9.0 for ; Thu, 13 Mar 2025 04:45:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741866300; x=1742471100; 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=BMlGspdrpbJ31u0fCjYvjyAZlqg7W4BaKawB7P7nRsE=; b=af0S5HJvjlOLklQq0v/ymCqyN4AExpCyMVfpiveCnn62jbQcONlqUzy5EzP3LR9wsn zVI6BbY5PYFdSv8HJL6ss7XwrRfV808rZWA4kGqFKQzB0YxLCykNLOweugswYT0Tjwzx EYgep6GHVhKh8dN2RL/n12xpBgGDY8Gr9QjrzJlW0VA1yVODhiLRVAS0AluKS/3vENrG kECGvjSBUE6o3vzJgiwSXXM2K30+8LMwZDk9FNRG7k59jW+7Iy+eqHCjW697i0c2DHxa NUIc4xj2TIzofsGZlitq5mxsTpjgeToZLequZ7qwaZf69c6VmNGX4poL+of4admRkkJQ VACA== X-Forwarded-Encrypted: i=1; AJvYcCVTcm/4+DcEVSk483QjzIbVe8pKGLyX9uCNd/Pu1Zlzz3IenUbU7rsY76DWBP4CWjMM8u+4VTTM3E6H+g==@lists.infradead.org X-Gm-Message-State: AOJu0YwpfKbhBQiRUpyltzjvZuFkTBpNtCowOtmCnGb1AwFZ366byGbu 36boYGMW6p+QSmCKJyr//CAby0Q20q4DI3k/utf+EijwthmzbX+8ODxSJdkLURWBMtrnBZyIL17 Lm1SBGt3160cQKYUjtPell+EysanAFnooZ8Ncc+rtLMSXKTTwGjL9orqgpuS/DUi2hg== X-Gm-Gg: ASbGncumVQePPRs+Zym5ErmS+qfD95T/f4lHFg4thIbMTpXbBx73+YxI16NLx0NcClS 3YYYDcsi/owjIar0E532+0g7ZQQP0H0kSsj9RRNJ5kQr0b3veUmAEos8BR5tHF2do+DqPFgXwk3 dZ9eWxZOfMnKC+xfhPJTXrtOh7VskEz+oVjIe5NjujucatFOcZOtWAdtjUCgG72XZnz7rj9T+qI lDlgml1y3ySl8yUQ1DelCODlgZxyXX2R9P9HT6b4b+HbWiC1v178OKVl1dTJUf5XKj5wjBwl0TT xlbnktWrb0CA1bWL6qKX X-Received: by 2002:a05:600c:470a:b0:43c:f44c:72a6 with SMTP id 5b1f17b1804b1-43cf44c76ccmr144327195e9.2.1741866300530; Thu, 13 Mar 2025 04:45:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERxTxm4YW1Ezaow82Z48NXt1aSx6Vv01Gh0iy7KljuVnLSLjwCs9KSAjTKcqnBX6jh4hKEWQ== X-Received: by 2002:a05:600c:470a:b0:43c:f44c:72a6 with SMTP id 5b1f17b1804b1-43cf44c76ccmr144326735e9.2.1741866300120; Thu, 13 Mar 2025 04:45:00 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Mar 2025 04:44:59 -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 , Michael Ellerman , Alessandro Carminati Subject: [PATCH v4 14/14] powerpc: Add support for suppressing warning backtraces Date: Thu, 13 Mar 2025 11:43:29 +0000 Message-Id: <20250313114329.284104-15-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: FZc6jnVOEp4IQvZS5hUD8DhEbb2minMftGCsAfHQbh8_1741866301 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250313_044628_543037_97AE562D X-CRM114-Status: GOOD ( 12.55 ) 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: Michael Ellerman Signed-off-by: Guenter Roeck Acked-by: Michael Ellerman Signed-off-by: Alessandro Carminati --- arch/powerpc/include/asm/bug.h | 37 +++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h index 1db485aacbd9..5b06745d20aa 100644 --- a/arch/powerpc/include/asm/bug.h +++ b/arch/powerpc/include/asm/bug.h @@ -14,6 +14,9 @@ .section __bug_table,"aw" 5001: .4byte \addr - . .4byte 5002f - . +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE + .4byte 0 +#endif .short \line, \flags .org 5001b+BUG_ENTRY_SIZE .previous @@ -32,30 +35,46 @@ #endif /* verbose */ #else /* !__ASSEMBLY__ */ -/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and - sizeof(struct bug_entry), respectively */ +/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3,%4 to be FILE, __func__, LINE, flags + and sizeof(struct bug_entry), respectively */ #ifdef CONFIG_DEBUG_BUGVERBOSE + +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE +# define HAVE_BUG_FUNCTION +# define __BUG_FUNC_PTR " .4byte %1 - .\n" +#else +# define __BUG_FUNC_PTR +#endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ + #define _EMIT_BUG_ENTRY \ ".section __bug_table,\"aw\"\n" \ "2: .4byte 1b - .\n" \ " .4byte %0 - .\n" \ - " .short %1, %2\n" \ - ".org 2b+%3\n" \ + __BUG_FUNC_PTR \ + " .short %2, %3\n" \ + ".org 2b+%4\n" \ ".previous\n" #else #define _EMIT_BUG_ENTRY \ ".section __bug_table,\"aw\"\n" \ "2: .4byte 1b - .\n" \ - " .short %2\n" \ - ".org 2b+%3\n" \ + " .short %3\n" \ + ".org 2b+%4\n" \ ".previous\n" #endif +#ifdef HAVE_BUG_FUNCTION +# define __BUG_FUNC __func__ +#else +# define __BUG_FUNC NULL +#endif + #define BUG_ENTRY(insn, flags, ...) \ __asm__ __volatile__( \ "1: " insn "\n" \ _EMIT_BUG_ENTRY \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (__FILE__), "i" (__BUG_FUNC), \ + "i" (__LINE__), \ "i" (flags), \ "i" (sizeof(struct bug_entry)), \ ##__VA_ARGS__) @@ -80,7 +99,7 @@ if (x) \ BUG(); \ } else { \ - BUG_ENTRY(PPC_TLNEI " %4, 0", 0, "r" ((__force long)(x))); \ + BUG_ENTRY(PPC_TLNEI " %5, 0", 0, "r" ((__force long)(x))); \ } \ } while (0) @@ -90,7 +109,7 @@ if (__ret_warn_on) \ __WARN(); \ } else { \ - BUG_ENTRY(PPC_TLNEI " %4, 0", \ + BUG_ENTRY(PPC_TLNEI " %5, 0", \ BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), \ "r" (__ret_warn_on)); \ } \ -- 2.34.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv