Received: by 2002:a05:7208:3003:b0:81:def:69cd with SMTP id f3csp822280rba; Wed, 27 Mar 2024 12:52:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVvGszW38bhxkNvqv5MbpAkahoRRH7aYUZGbQFMi0VxKaW1v6ZwWTs68LsEyjO+6klQABZlEs5QfkXAHm24GcL/NGZ2hZCnDEDbz2ZJGg== X-Google-Smtp-Source: AGHT+IH4kPhTm1K1EU5HdC6qD9Rk2yNUTd+c/tFBUfpsb4A4U4ZqjCyBAxcfCct/fH4CpX5aII4F X-Received: by 2002:a17:902:f682:b0:1e0:a784:f965 with SMTP id l2-20020a170902f68200b001e0a784f965mr729406plg.65.1711569138694; Wed, 27 Mar 2024 12:52:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711569138; cv=pass; d=google.com; s=arc-20160816; b=JvQrSkGhueCDCkDXRgKMSBQq71ojtup24nyuXRfXVNbhnESLMruIEeWmt8PXNF+kxl UYEiX40UkEFcCh5KJ0MHXeDAdVGi67H1wKKDP2XYrfxWh1hoWKpCExqVViFfj2cMHQ7B JxmIuRUm8wGjnXJEhEYgEjeYUz+KiVjxrcqy7sF9uuBnpt2mrQ4W1CCZ8CiRBwNkmVcg dZLpbQIh9+D10cvfZV31uMN0xeFJ3Idtxh5cOhYzznvIT+2fwN61IZ8M/tgTQwAiqKhx 2RdloJ039hnedljYBWXgPOjIV1jRI/fuSpjhAj+HdIiEHIym2XbiIJ49phURmvk7Mnfm RJXg== 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=3XUWNYUjsqUvxDWvDqe65kSE1rhPeDXUyc7KJLTNJgI=; fh=wJ7EFfNEM5xeKAmBdAyY1bMY+0BDcOI+i7uZ/BvXxKI=; b=wHcGjOaL/Bji4N+vB4V8wKKXNOWbUWm6iKYHmBM7W/2LH+a/Q8dyBpolj6/CRoUmJX M5+NsiHwz6yLCLDIUEVnoOi1XgXXqd8fwWJA6civi9XYVDGrLy6HlD/YSPhuhxZIOEkB uEP36j/C0AFgBaqy4rSTQ5y+ML00nGL7V+HzyFpPcNxzYI5gZJpuGwkzpUuu+oBp5pR0 WbIo7TRuGHdQs2kJsngipJp3YqhM4Ystx3ULJ/00gyD9gE4gDzEEZkDgMyLYcuBbkX5d D6Tqi+pXOxUQw3qsO1SMW8flky8gJLdQatl9ZbmWEP9Hu0NVbWX1sZmyHAwB0uoVoWHw j/pQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SKHszxO4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-121917-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121917-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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-20020a170902b94100b001e10a87af7esi1762438pls.555.2024.03.27.12.52.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 12:52:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121917-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=@kernel.org header.s=k20201202 header.b=SKHszxO4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-121917-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121917-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 B4441B272F7 for ; Wed, 27 Mar 2024 19:39:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71E3515250D; Wed, 27 Mar 2024 19:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SKHszxO4" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 69CAC1E52C; Wed, 27 Mar 2024 19:39:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711568368; cv=none; b=FcxLBpnxJPTGsCQKJMaOehbjOnGZv0TNC/pyZ6T7tdFg+uBHQwVGc16bCJcdyNA+71PziK55Za2q+3nBvJUVGuDRHK1jSOYkaQ+9cYpBwUfrfdDVkO+Pv/3MXf5WgcytgMqIv95wAePvIIhynu03vdW+N3nNEUjVYn9UexMxuxI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711568368; c=relaxed/simple; bh=mgDCCV9DYm3gE81YovhkygNKHO9RS0DsGnhFgu3kHyA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ohTEiRVoma0GCSa7EZZ90JwMYtXJic6dw9IzrR9wHmJQ9MtPyovNYumX29+ZdXjgF61t624A31HreBfXT0zzfYOWEhomcosS0n6pTOUuJuYSomT1MhJBycaoToZ++zc1eKJDPY3BzxV7cmdCFuSRbFmNes9+sEUpW4BKTRVKy5o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SKHszxO4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3492BC433C7; Wed, 27 Mar 2024 19:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711568368; bh=mgDCCV9DYm3gE81YovhkygNKHO9RS0DsGnhFgu3kHyA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SKHszxO4HY0/TKQKrYd5xjeNheZExttn6ouZSQo7RamEADgZOHEGKOgxLgWnDAQsX TQk1EiCgbOjPSXUXVDKc1GHuMb8JYfr2n9dUTSMBL4fPlQCFaWvqtzr7SljGX8ozL0 d+GxeE8i5/jrK3YAq+PzsRs9yg9Ub9Ye0zUWxbvydciwA80gaS/Cm+ZdJSIaW62wjN 8mgdqhfJd0T7WESQFdfsQPBT5oU/lItq2D11cSo/Qk/7TSLc6IaPfRphmumfAFxMTP w0oml1KABCZkKYStlxNthCpMKTFGN6FZPoQQlay9J46ava0AXCk2S+OoNd/Q7U91J0 LlcAACEC05P/g== Date: Wed, 27 Mar 2024 19:39:20 +0000 From: Simon Horman To: Guenter Roeck Cc: linux-kselftest@vger.kernel.org, David Airlie , Arnd Bergmann , =?utf-8?B?TWHDrXJh?= Canal , Dan Carpenter , Kees Cook , Daniel Diaz , David Gow , Arthur Grillo , Brendan Higgins , Naresh Kamboju , Maarten Lankhorst , Andrew Morton , Maxime Ripard , Ville =?utf-8?B?U3lyasOkbMOk?= , 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, Linux Kernel Functional Testing Subject: Re: [PATCH v2 12/14] sh: Add support for suppressing warning backtraces Message-ID: <20240327193920.GV403975@kernel.org> References: <20240325175248.1499046-1-linux@roeck-us.net> <20240325175248.1499046-13-linux@roeck-us.net> <20240327144431.GL403975@kernel.org> <320aacc6-b7e5-4c3d-948e-d0743ab26c5d@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: <320aacc6-b7e5-4c3d-948e-d0743ab26c5d@roeck-us.net> On Wed, Mar 27, 2024 at 08:10:51AM -0700, Guenter Roeck wrote: > On 3/27/24 07:44, Simon Horman wrote: > > On Mon, Mar 25, 2024 at 10:52:46AM -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). > > > > > > Tested-by: Linux Kernel Functional Testing > > > Acked-by: Dan Carpenter > > > Signed-off-by: Guenter Roeck > > > --- > > > - Rebased to v6.9-rc1 > > > - Added Tested-by:, Acked-by:, and Reviewed-by: tags > > > - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option > > > > > > arch/sh/include/asm/bug.h | 26 ++++++++++++++++++++++---- > > > 1 file changed, 22 insertions(+), 4 deletions(-) > > > > > > diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h > > > index 05a485c4fabc..470ce6567d20 100644 > > > --- a/arch/sh/include/asm/bug.h > > > +++ b/arch/sh/include/asm/bug.h > > > @@ -24,21 +24,36 @@ > > > * The offending file and line are encoded in the __bug_table section. > > > */ > > > #ifdef CONFIG_DEBUG_BUGVERBOSE > > > + > > > +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE > > > +# define HAVE_BUG_FUNCTION > > > +# define __BUG_FUNC_PTR "\t.long %O2\n" > > > +#else > > > +# define __BUG_FUNC_PTR > > > +#endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ > > > + > > > > Hi Guenter, > > > > a minor nit from my side: this change results in a Kernel doc warning. > > > > .../bug.h:29: warning: expecting prototype for _EMIT_BUG_ENTRY(). Prototype was for HAVE_BUG_FUNCTION() instead > > > > Perhaps either the new code should be placed above the Kernel doc, > > or scripts/kernel-doc should be enhanced? > > > > Thanks a lot for the feedback. > > The definition block needs to be inside CONFIG_DEBUG_BUGVERBOSE, > so it would be a bit odd to move it above the documentation > just to make kerneldoc happy. I am not really sure that to do > about it. FWIIW, I agree that would be odd. But perhaps the #ifdef could also move above the Kernel doc? Maybe not a great idea, but the best one I've had so far. > I'll wait for comments from others before making any changes. > > Thanks, > Guenter > > > > #define _EMIT_BUG_ENTRY \ > > > "\t.pushsection __bug_table,\"aw\"\n" \ > > > "2:\t.long 1b, %O1\n" \ > > > - "\t.short %O2, %O3\n" \ > > > - "\t.org 2b+%O4\n" \ > > > + __BUG_FUNC_PTR \ > > > + "\t.short %O3, %O4\n" \ > > > + "\t.org 2b+%O5\n" \ > > > "\t.popsection\n" > > > #else > > > #define _EMIT_BUG_ENTRY \ > > > "\t.pushsection __bug_table,\"aw\"\n" \ > > > "2:\t.long 1b\n" \ > > > - "\t.short %O3\n" \ > > > - "\t.org 2b+%O4\n" \ > > > + "\t.short %O4\n" \ > > > + "\t.org 2b+%O5\n" \ > > > "\t.popsection\n" > > > #endif > > > +#ifdef HAVE_BUG_FUNCTION > > > +# define __BUG_FUNC __func__ > > > +#else > > > +# define __BUG_FUNC NULL > > > +#endif > > > + > > > #define BUG() \ > > > do { \ > > > __asm__ __volatile__ ( \ > > > > ... >