From nobody Thu Dec 18 18:09:21 2025 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 C3E8326BD98 for ; Thu, 13 Mar 2025 11:45:14 +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=1741866316; cv=none; b=eJ53kDH3DkKJ0gp6XutQHZdXMKsH2vM0RlL6PDCh6kHqprsv4eqp0rwuMNm9VhJZOESujXcKze1YdYYY1cMk6N8XINgXVeuzcelQLNqwZMIQOTZ0YcXFIQ35f7fRf5EgQIAXyDNTUPOLcEX1b+smwgKDSZ5AZo1uwkGaKjiTjPA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741866316; c=relaxed/simple; bh=NbfqpVn1osOn99nDNr/w9uuM1r2DWHYwWsVBZu8K+4o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-type; b=juU2eXEWgtls7aTj889oU4b8QI77oFiUyPNbYkkm69p+W3lGX7ZYVpxZCzkl7w1ljdQC+J0+AYYh1NScDj3/bq6tsrD8EXGxyzYJeD9c0llZTsuOWnAf1G7NBSl8ti176EcY/uRHnkvrmAuP0Gvdwrhrv9diJt8iH3booMuonO8= 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=VPDkZAXy; 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="VPDkZAXy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741866313; 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=fuCFF39iXwBMHtdVpJheMeZKmjdk+AFM9NbRaPloTHM=; b=VPDkZAXyh21FxMvtQBZQG2NFLpelK1kWJrYJI9z1ghnZSRekx6GJYjmO4zeH78Gb/u4Z3J K8jM1p7LLq8fn1/drle8lv0HaAiUMSfj2NHTqgGJZr4PTuABOPZap/zsiKJTQWjzG1j4Bq zDT4wEc6cHJ+h/gmdLoe9Pz+AJFeuSE= 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-21-_yHzAmiqM2iF-kLKAjWXoA-1; Thu, 13 Mar 2025 07:44:55 -0400 X-MC-Unique: _yHzAmiqM2iF-kLKAjWXoA-1 X-Mimecast-MFC-AGG-ID: _yHzAmiqM2iF-kLKAjWXoA_1741866294 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-43d00017e9dso4357185e9.0 for ; Thu, 13 Mar 2025 04:44:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741866294; x=1742471094; 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=fuCFF39iXwBMHtdVpJheMeZKmjdk+AFM9NbRaPloTHM=; b=Jontuk8q2CZuMmmUN3od1ioXfAtTFwcT0giVfofVaojNh2D2nnsfuSwgcwzwKR0xzM SkU7PezfyUX1bwLcWvyw/OuMSQtzrgZ+RBCQd/ZLap5KzjINtjKzLgXh/uUU7IXNo00l gv8g3EGTpG8wgeACzLZ7hOKqhrATtT/jVWXoy14RMNK7y026BiWLupp9BkpXpDXaGkyg TmqNcgYBQk+ZzRP4W4VaI6RrSpWEmPqoz0jiUVTRR0DP0SbXWgJ8ggVg46ic7B62OIfg ak/yMp8VbO3SOoQP7FEt+Awa0zVr5ojgaGpbw++N3YXSMFDTzJ0OhPupHJsvg75xvNj9 3sVw== X-Forwarded-Encrypted: i=1; AJvYcCVhbHs4rtCrSSw5BAIK4pujUM2qRhzYP3F2uNMQfOeRNjlmDKbkI/udKUwf91wkFLxCkqeR07ZuHbSoUeg=@vger.kernel.org X-Gm-Message-State: AOJu0YyreVQ/o++w5eEw06ow/RwsMIGOzKogBPMEQRzk0rYgCF2wrLoV XFZn3UpNeTBhSH6yh8ChbRUeslRHm2848vrWe+oJgfDk3Pzu4y+1yUFMRujpYBkm53SwWNRI50x LFQ0ia7vf1jjikpN7zibVGRbc7UbSBsLltvuwqUtwWv46rsVdAEntXiEOgbA1Hg== X-Gm-Gg: ASbGnctFzBHjDPUyhr8TjSVDEhgcGivtopwm05/AG3LOAPeG/qEG9wUlUTeR+XRcDUC zBQZq3qN9RViIWmjeQii+sVGywWhMm2ULE7rzV4+TgWM6im/gB6ozPZDgjtd2fS223jCFr+1rFG mPG75qmKaS3dnXeeDmREhi/MT8qFQL7bARdgBWUISWccOEGpgxfDIf4nARt/3TDX+MWOVsDW5Gi nkR1DpdN3lqaZbD7uIHrzaVNqdHBtA8YWcwodFP8KscHobmN3hduk3v6Ss4XtmjgtqkZmp/JjTO F3VyJ1GrMBzE5hrUwGNf X-Received: by 2002:a05:600c:448a:b0:43c:ee62:33f5 with SMTP id 5b1f17b1804b1-43cee6235b7mr136023245e9.27.1741866293862; Thu, 13 Mar 2025 04:44:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0wHJ2zwJ8yj3cYw/s9VH9lfhVlHVsfQsMYeCFjOVxBPaF+5L2/VWS3+5UdzriUt/uCnhyuw== X-Received: by 2002:a05:600c:448a:b0:43c:ee62:33f5 with SMTP id 5b1f17b1804b1-43cee6235b7mr136023005e9.27.1741866293519; Thu, 13 Mar 2025 04:44:53 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Mar 2025 04:44:52 -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 , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Alessandro Carminati Subject: [PATCH v4 11/14] sh: Add support for suppressing warning backtraces Date: Thu, 13 Mar 2025 11:43:26 +0000 Message-Id: <20250313114329.284104-12-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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: Yoshinori Sato Cc: Rich Felker Cc: John Paul Adrian Glaubitz Signed-off-by: Guenter Roeck Signed-off-by: Alessandro Carminati --- 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 */ + #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 =20 +#ifdef HAVE_BUG_FUNCTION +# define __BUG_FUNC __func__ +#else +# define __BUG_FUNC NULL +#endif + #define BUG() \ do { \ __asm__ __volatile__ ( \ @@ -47,6 +62,7 @@ do { \ : \ : "n" (TRAPA_BUG_OPCODE), \ "i" (__FILE__), \ + "i" (__BUG_FUNC), \ "i" (__LINE__), "i" (0), \ "i" (sizeof(struct bug_entry))); \ unreachable(); \ @@ -60,6 +76,7 @@ do { \ : \ : "n" (TRAPA_BUG_OPCODE), \ "i" (__FILE__), \ + "i" (__BUG_FUNC), \ "i" (__LINE__), \ "i" (BUGFLAG_WARNING|(flags)), \ "i" (sizeof(struct bug_entry))); \ @@ -85,6 +102,7 @@ do { \ : \ : "n" (TRAPA_BUG_OPCODE), \ "i" (__FILE__), \ + "i" (__BUG_FUNC), \ "i" (__LINE__), \ "i" (BUGFLAG_UNWINDER), \ "i" (sizeof(struct bug_entry))); \ --=20 2.34.1