From patchwork Thu Mar 13 11:43:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alessandro Carminati X-Patchwork-Id: 14014785 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 693D926A0C1 for ; Thu, 13 Mar 2025 11:44:53 +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=1741866295; cv=none; b=BkNF7FDzuuEfR6W5V0gfyosr50UEdE1TAgkgl8kzZ5nvPzt6KCxry0UwHU/ZjXELj/IYMMNQ5e2LDr1qwUZWIwA3NcoWCAZSSliv/VlPwye7fIuJNxtVqjqPtHS5SDidt6UhiCKs9/mp8RcvgKbIFdnSzRIU4ZDssAwBdZLf0HU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741866295; c=relaxed/simple; bh=0aizeDhwWkFKZsPeHlQzOAxiwKdPV8X3HwIBD/FO6ic=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-type; b=CRtZN9fs9gPgMUz8BDp5PAqSuIynkjs4HRYlJmNQcaawRdOCOI8nDahDhwhmmPLy8u4h6p4tGd62iSC8Mh8Mhm5tD2nV1TNRELh6+/0NtforQpaTEVeQu2lXbCU8FKH+qyhmwOUV5LmtfMCQGl7KRIKHfAhxKsFQyqqbOHD8sjk= 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=AlxoX2DI; 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="AlxoX2DI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741866292; 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=oNDdusV5kHSN69Wnsdcb+ESaCAhVWZZ95i0rdnVfZIo=; b=AlxoX2DI8jfL8OdV/Mj9lXXImOquR9Y7d96KgUA5r2p5KooxwGK6jULtE/qbvMjQubtV+T wmAJGrItqXp/hY71RfwhddqxcEFkWJIcezbVv5iAWjRnge35IkbPtryGuob42nNremPJJA TFPvpfnkI+ksnd2bvt7BDTbLIQsO9+o= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-627-nKhu8EJlNXuMNXRTB9Nklg-1; Thu, 13 Mar 2025 07:44:51 -0400 X-MC-Unique: nKhu8EJlNXuMNXRTB9Nklg-1 X-Mimecast-MFC-AGG-ID: nKhu8EJlNXuMNXRTB9Nklg_1741866290 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3913b2d355fso345415f8f.1 for ; Thu, 13 Mar 2025 04:44:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741866289; x=1742471089; 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=oNDdusV5kHSN69Wnsdcb+ESaCAhVWZZ95i0rdnVfZIo=; b=TP17NUEYzG6E//vDVwhx/guNs7KBBazwtUuDyEgJlGSOWsjfdxKOo9WrsC+qFdPsbs aQ9dE7U6s2eAHWDz1HT7fltIppPiENDwF8N9XG2jCeyY2UWTX27SihLvPYJsu6oH+SSG ilnrUBom2C5famAH+zyEfTRPpuF0cjyyB972awtnOIzzNhMjOEH3HbMqOc0eHdWIUBMZ g46IxGUDZv7NFVRKNRpIMOkK6GaNatTYH/C+idDVFaQMuAT24GqWmUZNeE3JjAAKxgcs MCh7QbvRy92thUsu1h/1hCN9TiYH3M+WUsSaLhwq5/2/Jex/nqRCorM1ktXnDLdWzNKs UneQ== X-Gm-Message-State: AOJu0Yza59vifowbeOVsqU3dBlFGcKyXoyOX5sGeRPRIf5w/869ZFb3B jD3Hg3iUtG/rm1ofo5TsiGZ9tICxR23lysRSfkY1veYKp/nost+1Jkydzn1EGCkaygFQ7mBoWoh kCm1k7Yrfo5zEGgSUpsLtmqPn/menBCs1XunrkVB8xmw6gp7/kTbGICFd6ogq/ZKN/Gjie08cwG 1dm0gyGeOF/JTIP3KnGou0VzDu/3VIXqGtLuJimuNNzlhizCRa6X4b X-Gm-Gg: ASbGncsUHqorWfhAOpeKZ0HNwHW0gLcYxDqZpqVNanLfGfs9O8QeWf8GN65WLSnER4e v95oD4NigeDZd2vXtnoGCMzBGEk3j83BCAhin+9GkU7N4csnIN4wFSI+l6Uyui7vj8Xv+V3WGkR wipWOWePcP96RWYPf/zFAPH2FKqmMbR61mmrmAWSZnMk73Vr0LmdIypk4ZPUHnEqkMYxZiTIsIw 0Sg7rkg+BNC03bnfoEOEDNgCYy+Ed3Bh1l+yabU5IYwxKnSkJcqhbMMDCt+vRyCTLGDaypzHJxQ B7zctVXEQ4Hu2Nn78hpQ X-Received: by 2002:a5d:6daa:0:b0:390:fbba:e64b with SMTP id ffacd0b85a97d-39132d8afb7mr18596847f8f.31.1741866289526; Thu, 13 Mar 2025 04:44:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYwocEA7kYpHNOe02FWF9uxS8M3FuzRDEqfu4GtiOXX78+oDlT7RdxLzaiu9BpsPlw7lldzQ== X-Received: by 2002:a5d:6daa:0:b0:390:fbba:e64b with SMTP id ffacd0b85a97d-39132d8afb7mr18596786f8f.31.1741866289052; Thu, 13 Mar 2025 04:44:49 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Mar 2025 04:44:48 -0700 (PDT) From: Alessandro Carminati To: linux-kselftest@vger.kernel.org Cc: David Airlie , Arnd Bergmann , =?utf-8?q?Ma=C3=ADra_Canal?= , Dan Carpenter , Kees Cook , Daniel Diaz , David Gow , Arthur Grillo , Brendan Higgins , Naresh Kamboju , Maarten Lankhorst , Andrew Morton , Maxime Ripard , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , 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 , Helge Deller , Alessandro Carminati Subject: [PATCH v4 09/14] parisc: Add support for suppressing warning backtraces Date: Thu, 13 Mar 2025 11:43:24 +0000 Message-Id: <20250313114329.284104-10-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: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-type: text/plain 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). While at it, declare assembler parameters as constants where possible. Refine .blockz instructions to calculate the necessary padding instead of using fixed values. Tested-by: Linux Kernel Functional Testing Acked-by: Dan Carpenter Acked-by: Helge Deller Signed-off-by: Guenter Roeck Signed-off-by: Alessandro Carminati --- arch/parisc/include/asm/bug.h | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h index 833555f74ffa..b59c3f7380bf 100644 --- a/arch/parisc/include/asm/bug.h +++ b/arch/parisc/include/asm/bug.h @@ -23,8 +23,17 @@ # define __BUG_REL(val) ".word " __stringify(val) #endif - #ifdef CONFIG_DEBUG_BUGVERBOSE + +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE +# define HAVE_BUG_FUNCTION +# define __BUG_FUNC_PTR __BUG_REL(%c1) +# define __BUG_FUNC __func__ +#else +# define __BUG_FUNC_PTR +# define __BUG_FUNC NULL +#endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ + #define BUG() \ do { \ asm volatile("\n" \ @@ -33,10 +42,12 @@ "\t.align 4\n" \ "2:\t" __BUG_REL(1b) "\n" \ "\t" __BUG_REL(%c0) "\n" \ - "\t.short %1, %2\n" \ - "\t.blockz %3-2*4-2*2\n" \ + "\t" __BUG_FUNC_PTR "\n" \ + "\t.short %c2, %c3\n" \ + "\t.blockz %c4-(.-2b)\n" \ "\t.popsection" \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (__FILE__), "i" (__BUG_FUNC), \ + "i" (__LINE__), \ "i" (0), "i" (sizeof(struct bug_entry)) ); \ unreachable(); \ } while(0) @@ -58,10 +69,12 @@ "\t.align 4\n" \ "2:\t" __BUG_REL(1b) "\n" \ "\t" __BUG_REL(%c0) "\n" \ - "\t.short %1, %2\n" \ - "\t.blockz %3-2*4-2*2\n" \ + "\t" __BUG_FUNC_PTR "\n" \ + "\t.short %c2, %3\n" \ + "\t.blockz %c4-(.-2b)\n" \ "\t.popsection" \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (__FILE__), "i" (__BUG_FUNC), \ + "i" (__LINE__), \ "i" (BUGFLAG_WARNING|(flags)), \ "i" (sizeof(struct bug_entry)) ); \ } while(0) @@ -74,7 +87,7 @@ "\t.align 4\n" \ "2:\t" __BUG_REL(1b) "\n" \ "\t.short %0\n" \ - "\t.blockz %1-4-2\n" \ + "\t.blockz %c1-(.-2b)\n" \ "\t.popsection" \ : : "i" (BUGFLAG_WARNING|(flags)), \ "i" (sizeof(struct bug_entry)) ); \