Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2444509lqt; Mon, 22 Apr 2024 10:49:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUBJSe3w9+l53CGWp2vmUq1C/AXmPBHAzNLxpV0M6CovwtSBF+uDGcYFjJmJos02qh40KqeWXzSKpPe6c9JSUEYBgyr/HQScTttjFZSZg== X-Google-Smtp-Source: AGHT+IFUEl2lL6BdOCnD1ZLzdaM19Ie9P51618YEptNtdCj3+uetIIZDpyh2UAwlsYfD1s6Pdqgt X-Received: by 2002:a17:903:18e:b0:1e5:caba:7fbd with SMTP id z14-20020a170903018e00b001e5caba7fbdmr14853590plg.44.1713808146575; Mon, 22 Apr 2024 10:49:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713808146; cv=pass; d=google.com; s=arc-20160816; b=v6lvdTIKtvHzYDIa32zKihCyniYvHVq2Wskkkjc98XDm3vodWe3hdEz1AkZ1X9H327 zWeaASNOHGIGk3AdkndNOpUMYwhoDGGDnwn7FIFkxgtbEEqRFugXG4RuSQiADxm4XK1R HxLZfP0nTUwUdwdSwMgZK7uLa7AtH+9XuDaLDTeaCdAJ8DTRgYGkk2rdM9rFfPFbiaWq 2nAYLAaV03ETuIIt6o11HZPMjAIa6AcjIHesrQUirfDUuDj9SZp5yMvEn0SYv8OAyh+0 a4D3QrTm8Aj6v7UnMuxEjxv4gd3VGnmXEPglw04noj6Yi50OfPY2s7d/YA+JEqGNku91 qvPg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8oSz86JzOY9DQvGvueAGk0oxmVKc1JpB72xgEu0TDts=; fh=XTABUgeEtYsbsZqiut6FRJLqAL7Zmdd6/d2OWMQq56I=; b=GdzfeqMsQwYXFX5JPUT56wKw5qIUImpKHF1Yrkhvxn/Y4Rr2jSVkvHK1NWrk4c1XNM +j8X8I8yaig3StiNFj0Q4O5awo0jfRgG8EIY4isrsfggIY5xIU2IbvllpkO6thpAXDZi wudKbyIE/kqSThmLy+MuftA7dpj6rkqnCdusLorkBpfJbWb7pJyTXff315NsCV9bh0v9 cmZ0DFbZxRpMinlS8wIZRf219aAeZuCrI2hFF7uS+FpUQw34FHHJWp3KPBw0bWISs32X NRDCpfG4OBnfg/KPOicoD7Js8ylPN9QyfxBKz48AnCmhkDCUJfu/j2j3FHhoDDGxxEku mvZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="tL9uo/+V"; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-153802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153802-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id h1-20020a170902704100b001e0be222e6dsi7819464plt.189.2024.04.22.10.49.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 10:49:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="tL9uo/+V"; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-153802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153802-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E96FAB233C4 for ; Mon, 22 Apr 2024 17:41:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0786615442C; Mon, 22 Apr 2024 17:41:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="tL9uo/+V" Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54E66153BEC for ; Mon, 22 Apr 2024 17:40:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713807661; cv=none; b=gZTHooCVfxYMUUeXPU9RTDkWXjD1LxXSPLfZHRXnICLebeJS4lpbDTKdjz5dYgpcBovgvEteEzG3BovOfa0VGZ96ABnAIyg+djq7tnWsC1yBtrE138KAF++EBH9Z92j+MWi9/AsR7/Fw8ovCHrXNHW5mxR8vfY8h/7uTxsZxPi8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713807661; c=relaxed/simple; bh=p8f3mDhOFdkK6vQBSO2RmHu0Eih8xW1uX/u+4OJ4ags=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DqiaMk6DQfXXqktVFP3NmJ/qh1dUCuEF+oDN9qo7ZVq19m3qjm7BSRGD6vefseUuTwUZWJ+iH9H0gmnadKnRV7qYoZDNOvVWpy2edrAwAMB0qwPy6w1+u2wrZlWzOamKsrBqg4OpqrKre+rPRm86Idha/qlpfZ9uqvEd0hycKOo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=tL9uo/+V; arc=none smtp.client-ip=209.85.128.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-61ae4743d36so50886577b3.2 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=vger.kernel.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=tL9uo/+V2uI9u12Ii9xymlGAoiD2oECwTjm956XUQxxl2D8pCCLu9ZtWW/X8v7Sq2P 7BxAp+XaVdiBzqL/8LJiogRdbATSfn6r14GyzFu/bjZNLRr283ahd4jFW1VCjZ3xEs5s IGSsw+0M2orJrQvtJXjqVQ9lRfPPGfoqlYcFA1WiRZ9lZTceFrB1ilqgG2OX8cBU9w45 AnzEF1VOu4dCjuj8/Ewd+GehaNAlElR2eLM7//3R0r85DMIMyd6d5Y2L+Hlu7+DzhQAu V0ECdVN0H+DFzkHV6qSajV+P5Yh+XBAv7Ot+eFzF8yx/NZIIz4Yv+9zuRHenLq5tS6+J 4iHA== 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=KzRjCcBtet6/vl3YfkjWBu2kgENQSIA5ekuQBp8Af3QA2An812MxS7THHz4bZvtbbS p1YBWtZSPx53qR74aLZhYCYcs52nGEn7S5yPoEr6rJ9LhQ1kojU9/Ue/L0cjTckWv4cQ CfurX83I4TrQUOwI83LWEcyvLfT/e23YNDoYSh8FEin2j4tIUoumpe7kl4OJEx/bhlVA jyIpW5L44yyOhmXI9Sx6inP3r4ydPibpCHDcaqkwVweXbZySYvspDYMglgfBgZNQfl7C ba835aJSJlSVj92JMAIC7kaPXa5Vqp4c331b7wj01edGpmFqLc2ed8xVOnKN3kVF44Ez nDgA== X-Forwarded-Encrypted: i=1; AJvYcCV2XjB/lQIcmhQST2kt/Lrg0cXNZxu+6r+PJQc3yy2Zg//5bZLbAghOlSh+n06d3xJ3hivYU7lKzuQxq1OtPy9DYKwXbQ34RPo5rwc/ X-Gm-Message-State: AOJu0YxcVYLGHNQ4aOWH0l5m1m61FbWQ22sOso+kszljXZXGVc0AmW9X vnMXmfJuveirWFaUyoJ4uG8mgqTvu4X2qWjgK7R8wp1tRHzjli/FJBEE64d1LUE= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240403131936.787234-15-linux@roeck-us.net> 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