Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2702979lqz; Wed, 3 Apr 2024 06:23:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBfeNUr0n4SH+fYAUEietX8ALxw2RgiqpPN+tsPYFOUGt5UYISz9MSklsvNqdjbFdxkIK1DS9ObnHJroQKLB2ZHkAEXBqufiDvbGIZYg== X-Google-Smtp-Source: AGHT+IGhItzD5m9dmn5d0dW/U+k1CDtiECzNotgCPhA3Y85N15cS/YWYnRulJITGIGzhO3eOo2cg X-Received: by 2002:a17:906:f155:b0:a4e:62b4:97ec with SMTP id gw21-20020a170906f15500b00a4e62b497ecmr7864508ejb.35.1712150620983; Wed, 03 Apr 2024 06:23:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712150620; cv=pass; d=google.com; s=arc-20160816; b=aif2gUP1PuOQYvldFqiybldFyB25+J4HXK4J1qCuGkd/fovLpVtDu9sEOvwE6TmxOA Zm1GcVWgrzAhEyiQrP76WNNiBTQBGKMrTKGCEzBjilIdD5Fw4JlsVBAUCLomRZuuFckc qyLXcH9/cDCAoljWYzYVS+D5E0ecG76npXlRabdYQz4zgAcys+yjGpSGNfUB24q2pyoE X7D4nwty3P2Ppx0f3xAmASJdsvdVz95iFgl2b5WzFqibgR2wtzYh5DlJjHE+T8/ssNbt rcKW5kw7qcFrn3yRecD1EceIN/KVlneytcGoHA8cgHSImSJi1oBB9dsMaUvJLjAVzJLQ UEMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:sender:dkim-signature; bh=acDD7oYfD3QQ420QQJRR06Qs6MsGb4dTYH+kiSwK7vU=; fh=WiiB1L9dHR8fzqLD6ouW+yCYBtpWbSsT0K2NB198yXU=; b=focDuoaBe2QKyw9AGYbMI/p+9VccTb86Fp+8AcuZJ3wKpo8mdsXJUQMMJiFGH2SJny eACBtw2uI/pPWQgeYnpeNFn9JEk4tlrrm3lEhkfdZUmcIwRFckIU4jiNY/4QrNy2iKKh U89VRJ7v3IWVn5tfLxh86IrF2f6yBZyjd6jfDdNDiQ+ph25nA9siwecGa59AnPnQurmT 2prmf30gi6oO91aRvndzI1GiaJYl89J/seRAAa2FqdtWbXilSuSTsgZ/drAou5x3wxYY 7ko6Xy3SvDr2jQo7Kjz8XREQaIkCxBeHOdGYFh1EmbCrsj7UdPJ5u6t0onUtUgpaxmxW MQ6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=m29Hj2RB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-129814-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129814-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h16-20020a1709063c1000b00a466ae1be36si6511294ejg.145.2024.04.03.06.23.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 06:23:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129814-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=m29Hj2RB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-129814-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129814-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8A33D1F2848D for ; Wed, 3 Apr 2024 13:23:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE39514D2A0; Wed, 3 Apr 2024 13:20:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m29Hj2RB" Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (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 CC3EB14A621; Wed, 3 Apr 2024 13:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712150405; cv=none; b=PXZ5XxDUVKS0Jih4H8MAX76jKZ+GKNj7eyrkyvtjDCyLr2mNOzubHK5tKnWs3+hQi6oGQ/L3ZTOiJ/hV/vXFD1Ym3Q57/M+iKhuh/2aannb0fexnxo6rOKP0+H11UslL4sBa2tTWMIkRkojuIf7qJtYUSvQ1wZ23YXqsx/3dRcE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712150405; c=relaxed/simple; bh=ZgmrdIG6yAEONHV4JnGuj9TrKexMhxErWuY9DJdDsqY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fYORVKN9IuboWJ+EiWAdJEq9XjKNj4IQDdZyc2DZ/zBH0aVsitBo2d+5gHvKXgHgiu/zLAYAhxpOJfXRlTomM/HjRwUKxnOHgdwtQUKjNM+fzB32K8dCgrSxkWyiW7/FwgQvnB2vcvYwpylhLIeADnxThxi9N27hlz2iGX1X3kU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=m29Hj2RB; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6e6afb754fcso6031285b3a.3; Wed, 03 Apr 2024 06:20:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712150403; x=1712755203; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=acDD7oYfD3QQ420QQJRR06Qs6MsGb4dTYH+kiSwK7vU=; b=m29Hj2RBkW/LjIZdIKgQhdwrUyWs6MfyIy+8NbvE1nSCTInzwEabdKT16xdV/BwZIu gl3vysGr9JiWhHk0v6hIW8XRc0uEqo+7KRIkQGVb9Pt7iPNnLQe9cWMiC+tKMYPxNyXM aj5/jlsj1TlOlTn9fZW7yYgdenHhxeiaPbY+RT7udygA5RLYXOoD5mqHb1enZP8f13Ta DrbMSk+dLiC+Ut93SO3Xi1YcqpWFycPAixEGrJl5v3ErhZafeum9Riuxc2CcQhK9zosd T1YjFskLFdpOCp9vQN+HNhsxEnCcIG8VLeUMh8RnPRLjw5p5gXaylIpo8EUQfev+YW+R Bl8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712150403; x=1712755203; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=acDD7oYfD3QQ420QQJRR06Qs6MsGb4dTYH+kiSwK7vU=; b=lnPfYoZxhReFDxTPhOP3MjC/rf3ap5/Sd6YLCv+oV1Xy7/VtGuYiD3mlaSnsftxfyM CpAPUgKdWd++7ONLKCzra1vXY5dCJxbPi/yJ6kLGtwyVlat+KeRQCkpIkGWgembdaWlX alSA3fdGlBhpyX9KlSQb/GqgLsxAz89Wz0v2ViLvAxwOSEzOv22DYiYxbt5A/DXKIAHA /zwuxMgdNg1QzLTgNDNSDvkiukr25ztF2SHLqu9j8xc48lDcqRPF0cF34CU8q0eHqrI+ QmxsuNDVKq0Ut6rnURqJ14AVc67w5q/fjqIszU/zI5wA9BLE0fy0FOP580PFMvj3Zqtr 4zQQ== X-Forwarded-Encrypted: i=1; AJvYcCW0v8VRDulOQI2kAOvNPfart7k/B/5kru2Q1/2qviHcY5tHqSytv3wAiYqk/fk9bfilc2Wu7kETK2ILQG5QUDFQQey69uUwzLJmUmTT5yNXjaQQv2imD/MUOJ0bDDF+6oN8o2q4SVlGrmVvT+0RVi0hCnTuFGbpPPyFLeNUzldycwkty6pygocIkINcrxPnNPuNacgatUygDZSOhLNMtRkcP/Ip5tjLWDpGsrcAACU/TctlVutMkXf0J67DZT20Ft8G8f3j+2jjhLSKSUsZFhW9JVA0XnOJeYnF75Qe+3sty/C/lFUhniMs5AHQaUpc9A== X-Gm-Message-State: AOJu0Yz5n1URdzF6OmsfLAXt7ZKx78NyZr9MdTcbc4Fct0NGwXEkCsV9 p5RBxPwwB3gD81E+va5I2rwCM204cQjYlah5fGrsXlp1zUpCdawC7BXFV45i X-Received: by 2002:a05:6a00:21cf:b0:6ea:c9c3:94a5 with SMTP id t15-20020a056a0021cf00b006eac9c394a5mr19496685pfj.0.1712150402646; Wed, 03 Apr 2024 06:20:02 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id u32-20020a634720000000b005e838955bc4sm11440044pga.58.2024.04.03.06.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 06:20:02 -0700 (PDT) Sender: Guenter Roeck From: Guenter Roeck 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 , 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, Guenter Roeck , Linux Kernel Functional Testing , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz Subject: [PATCH v3 12/15] sh: Add support for suppressing warning backtraces Date: Wed, 3 Apr 2024 06:19:33 -0700 Message-Id: <20240403131936.787234-13-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240403131936.787234-1-linux@roeck-us.net> References: <20240403131936.787234-1-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-Transfer-Encoding: 8bit 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 --- 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/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 +#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))); \ -- 2.39.2