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 210F0C07C79 for ; Mon, 22 Apr 2024 17:41:18 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=brjOFAJU1NCp9u01p8qyc6wBlNieZ1zTZaEZMPTQ95c=; b=boRW11gs5eLvP+ 51vI6IVAm843dpVwY+NhLltGY4y0cl3QTlUYokwwOBB+4JOKu1N6/UlFAFI/Ios4K65aet/iJoI0D 5esqV07fLAtMIIBmwhGQME8RPBZ2zy4QUQataPXT6jJ1F+OOXt/hvTepcMU+6u7DSDod40gp/wSqx SXp6tlH6l4L+Myoe5NtYjLEcy5KTcHBTlnD7TRzkPPWes+LWFwt0DEacbIhGuNmvbDu/FaNDv5Mig wvAOxhsMPrO85JNki1zuydfYXFGf7qMmZTSIzYYIEi0pyfpC6fmx7pTscUj/dzvbsD4W+QwPedRcf bXEXd9dTgWegwtHXrVDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryxf7-0000000EV10-1HQA; Mon, 22 Apr 2024 17:41:05 +0000 Received: from mail-yw1-x1132.google.com ([2607:f8b0:4864:20::1132]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryxf3-0000000EUzn-0Z3D for linux-arm-kernel@lists.infradead.org; Mon, 22 Apr 2024 17:41:02 +0000 Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-61816fc256dso41151377b3.0 for ; Mon, 22 Apr 2024 10:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713807657; x=1714412457; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=8oSz86JzOY9DQvGvueAGk0oxmVKc1JpB72xgEu0TDts=; b=pG9O/huP4kdgHlXgMhQGsxjfc1S/I90yVtdzGvoPDN6rJcUMMee0q1RlkU3jI7njj6 Bgz/c2Fwugr+jzariGAxVr+ryI7oJbCbXmXzMtfQguQK/BqHELRIyU34V4S8l9eTlEhZ 62w/0DtaxFD7C+5P1OoUlWnq+n488+eZDdJp9xA0WbiXc2/2Yb7xjXF1NWr/9wOkKss/ TDmkXWBpfWfrNpUXJ2yWoW4IC/QWQmHav+m5C1of/mOQC2dWUZG7AjVEP7eVtAb+BRbi gLItyFYNT+2X2uU01UIdXFlhz05LbmU9NYIDS0tzMEP0tPIRVuzPtAd96Mppq2D28qjJ a1mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713807657; x=1714412457; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8oSz86JzOY9DQvGvueAGk0oxmVKc1JpB72xgEu0TDts=; b=iPAwDuExEma6hBQG4HVnVpHg7I4UeqU66eBkM88u+S5d4e/GNKmwiDcWWtvVunVV9L W0O0m2QSeLCoQ5aC6SUnFy/PB7D4BGNubgl4611kh6Y6MHfSbHYesDI9JDiIEJ7tROTj tF/WolkrDxtHMFVWBmAHge/pZRzq/JQAfarJ+lXOQqmRz0fk/JIfSXbj3SMl6HFJ0uFf U0ORDxg96LX4Aj3mt0M308ZCnMqqxP/AAdkKZk2+9owUrNe4yx67+h5PJ91T6/zIYzBy GfkQkbNJxsVSvyUAnT7wCOQcwc1U78+XSH565EyM2Wm2X6VJkSyv16+q8OCyh33vKnwZ i5LA== X-Forwarded-Encrypted: i=1; AJvYcCWBdFQDoF5dfSQs2ArWt3JgvzF5ddSUHLj3/OXw/XxR/EgfxGQM0dDLMXtsKefJbuFFwOqq+SQtg7vLcDN+Rm7Jm99mx4JYS5nr/hXameL4qZmn5Xc= X-Gm-Message-State: AOJu0YwIi7duiYcPneuqmnFh46e6wX0bftcT4EVWaFcrrDXxG6NuVkpr c1MwrBvnd8TrNSBvkFcDo4bN8uvVZVlHi0iUwXQu3jJLyArMn+f/TPxuuvkft6Q= X-Google-Smtp-Source: AGHT+IF6LQ8zdofhxJ/PNSOv5IQXexYxxfrsaWAs34RmUulyK1yyuZ4SFyNwWs4DcElioVxSqpYRPw== X-Received: by 2002:a05:690c:3685:b0:617:c9b0:e12c with SMTP id fu5-20020a05690c368500b00617c9b0e12cmr10651242ywb.38.1713807655898; Mon, 22 Apr 2024 10:40:55 -0700 (PDT) Received: from ghost ([50.146.0.2]) by smtp.gmail.com with ESMTPSA id r29-20020a81441d000000b00608876ed731sm2060370ywa.126.2024.04.22.10.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 10:40:55 -0700 (PDT) Date: Mon, 22 Apr 2024 13:40:53 -0400 From: Charlie Jenkins To: Guenter Roeck 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 , 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, netdev@vger.kernel.org, x86@kernel.org, Linux Kernel Functional Testing , Paul Walmsley , Palmer Dabbelt , Albert Ou Subject: Re: [PATCH v3 14/15] riscv: Add support for suppressing warning backtraces Message-ID: References: <20240403131936.787234-1-linux@roeck-us.net> <20240403131936.787234-15-linux@roeck-us.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240403131936.787234-15-linux@roeck-us.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240422_104101_209743_CF37B4F7 X-CRM114-Status: GOOD ( 25.06 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Apr 03, 2024 at 06:19:35AM -0700, Guenter Roeck wrote: > 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). > > To simplify the implementation, unify the __BUG_ENTRY_ADDR and > __BUG_ENTRY_FILE macros into a single macro named __BUG_REL() which takes > the address, file, or function reference as parameter. > > Tested-by: Linux Kernel Functional Testing > Acked-by: Dan Carpenter > Cc: Paul Walmsley > Cc: Palmer Dabbelt > Cc: Albert Ou > Signed-off-by: Guenter Roeck > --- > v2: > - Rebased to v6.9-rc1 > - Added Tested-by:, Acked-by:, and Reviewed-by: tags > - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option > v3: > - Rebased to v6.9-rc2 > > arch/riscv/include/asm/bug.h | 38 ++++++++++++++++++++++++------------ > 1 file changed, 26 insertions(+), 12 deletions(-) > > diff --git a/arch/riscv/include/asm/bug.h b/arch/riscv/include/asm/bug.h > index 1aaea81fb141..79f360af4ad8 100644 > --- a/arch/riscv/include/asm/bug.h > +++ b/arch/riscv/include/asm/bug.h > @@ -30,26 +30,39 @@ > typedef u32 bug_insn_t; > > #ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS > -#define __BUG_ENTRY_ADDR RISCV_INT " 1b - ." > -#define __BUG_ENTRY_FILE RISCV_INT " %0 - ." > +#define __BUG_REL(val) RISCV_INT " " __stringify(val) " - ." > #else > -#define __BUG_ENTRY_ADDR RISCV_PTR " 1b" > -#define __BUG_ENTRY_FILE RISCV_PTR " %0" > +#define __BUG_REL(val) RISCV_PTR " " __stringify(val) > #endif > > #ifdef CONFIG_DEBUG_BUGVERBOSE > + > +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE > +# define HAVE_BUG_FUNCTION > +# define __BUG_FUNC_PTR __BUG_REL(%1) > +#else > +# define __BUG_FUNC_PTR > +#endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ > + > #define __BUG_ENTRY \ > - __BUG_ENTRY_ADDR "\n\t" \ > - __BUG_ENTRY_FILE "\n\t" \ > - RISCV_SHORT " %1\n\t" \ > - RISCV_SHORT " %2" > + __BUG_REL(1b) "\n\t" \ > + __BUG_REL(%0) "\n\t" \ > + __BUG_FUNC_PTR "\n\t" \ > + RISCV_SHORT " %2\n\t" \ > + RISCV_SHORT " %3" > #else > #define __BUG_ENTRY \ > - __BUG_ENTRY_ADDR "\n\t" \ > - RISCV_SHORT " %2" > + __BUG_REL(1b) "\n\t" \ > + RISCV_SHORT " %3" > #endif > > #ifdef CONFIG_GENERIC_BUG > +#ifdef HAVE_BUG_FUNCTION > +# define __BUG_FUNC __func__ > +#else > +# define __BUG_FUNC NULL > +#endif > + > #define __BUG_FLAGS(flags) \ > do { \ > __asm__ __volatile__ ( \ > @@ -58,10 +71,11 @@ do { \ > ".pushsection __bug_table,\"aw\"\n\t" \ > "2:\n\t" \ > __BUG_ENTRY "\n\t" \ > - ".org 2b + %3\n\t" \ > + ".org 2b + %4\n\t" \ > ".popsection" \ > : \ > - : "i" (__FILE__), "i" (__LINE__), \ > + : "i" (__FILE__), "i" (__BUG_FUNC), \ > + "i" (__LINE__), \ > "i" (flags), \ > "i" (sizeof(struct bug_entry))); \ > } while (0) > -- > 2.39.2 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv Reviewed-by: Charlie Jenkins - Charlie _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel