From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m29Hj2RB" 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-Google-Smtp-Source: AGHT+IH8rm/3VYkllAG+Ph/J3KijfrTneW29i0jWUjHAEJZozpI7yZ7ux/mQaa8T08FdPB1wOfWR4w== 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-arch@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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28B5BCD128A for ; Wed, 3 Apr 2024 13:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jcjBrCHKEJp1m+DMER0m9trfSEylWJub97IdAqz/jow=; b=KyNmqSg/rfpYvu AzwyEbVykp1jxDE48uEqrXmslTW6FlCafsOuLzha0ZwNjEbc8r4O/ci+/cmgZYVgoU/cD5v6URwzZ 9+KJEpahbK9uSAfENGD8wORZVEng3xbPht8FNYanGYEZTtSaxDNrqAJyQqxbtfE/trkeDpGdR5Jh2 ivsqIuSc9BUzuMk2otWN/drs7r6JelXhyldCjmTHh3b1b6i+eIHjqR52kjaReKU7wUzj8TACtrXOa jL1fy2jcBFYpE3dvoBQESGCstHKcbr0deXN67Zi4QBxNtJ9ISDsnOiO+800E0QZa7DcINKh8rggJB l8g6+JrTSAbzQoC2gjHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs0YX-0000000G9hQ-05Ul; Wed, 03 Apr 2024 13:21:33 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs0XI-0000000G8nb-1Wxe; Wed, 03 Apr 2024 13:20:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=acDD7oYfD3QQ420QQJRR06Qs6MsGb4dTYH+kiSwK7vU=; b=IAPInJyOb5j8f6gBTcqim8FtOk NnG3uqTM3Frj7r7G4OmGakQrbYo5Jkko1y4QAZPEFu8obAz321M+spMMvomIV91Q4h+eCIRXabqC1 2jJe/WquDFqQ8eqoFs54M4LGQdmSlJho2KUSdWOFNbaUCV8kfs0S83u0cFW+Nf/VJf0p9CQb1V+w7 qLc7/RkmmKQFDRVHduJZuike93PIkhBZRP1tZIc6M+ilJtpTn6yD/vWZ4NSTfDvs51VOAcZ6DfKz+ eNPDGJCv7IkECH475UJbJs27eF7/bK7OO1hujsmgvkEg1OuteREdHeNWWCc76vn7H37n3loHy/x3I 6WQ2Wbpw==; Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs0XB-00000005eWQ-0QNs; Wed, 03 Apr 2024 13:20:15 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e6bee809b8so5980729b3a.1; Wed, 03 Apr 2024 06:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712150403; x=1712755203; darn=lists.infradead.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=DbPmfoLYc/SUogg2TMO+vdJegvOdTRm2qyDpr0EtuwHaB5BSNIf8SIxZlYEwR33SPs hH7RkVubc4pjBg+pRLjgxdIfBEc0ETMdfEibOTeFWpDzeH5YsR4U3TX/eyF+AdDhoofz nrUiEUxF+eKmMdV9uSKszTlAl14Jekgxp2XeUVz0Bgi1rS2o9fLk38ThfpfDvgqD+7A4 DM6Be+slwXE7Orsqz92V+QXgxRr0IqN8GkVD07/VXUbSmgancdaB9qgpe/eVRec2NNt8 b8QNvK2aWo/rC8GoDHxgc5DDnXgL1VxSkNvOR+nvN6mcwejAM1s337O1KbaEkIewvCXM a8cw== 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=Pry9kjywV1aYxxu9D/L8dlFQzzpntIn+vxFQHH2OkgKQ/7ktgjLE2jZKclJNL365jD fuq07MrcRS0Jk/69BTDJ4PcS4LwsH2b+kFJ+spjkWZB4xn5dMnm+oQot4BfCDicphaCU djQd85sxadl2+aBqNE+TKGr1fTjhGwt6xqreXM/rNnnoUaBYtjekdLF+YEwRvWq/UsBV eqaXlzn7COk1VkLZgCtidp3Gg42z+JelqdBEHPEwB7JakUeDBCvo96OEq+BY3EifMBFb A/HQI0GM5sEhtjFrumUoOXLbUHRBS8t+p6bnrZUCBwBcXhOYM3ENVR8HdXuiLQgWAtaf PCfA== X-Forwarded-Encrypted: i=1; AJvYcCV1lXBZkceeJXCH4dsZQAVJx0mFTuUR7RBDxyhsb/IGdrewYa6NaV6qMSbvvV57Tdm3aEQHR6/zRbk+7w/adSCKUPstQKhhdtQNiM+Bi4ZZBst6LitPDXbfeXv5ftWZOyX1TSdQaqbR+TmOv7nsL18d3uA0mcU= X-Gm-Message-State: AOJu0YzzXYDPXkGjD89tAPKFpiasRtgKVnwznTtAUITUxITsGUXDwAdt MskeKwZvzFr/JClIA8EZdKs/WlXNrhbp4cAEfYvs+jaFdgwZ5pQk X-Google-Smtp-Source: AGHT+IH8rm/3VYkllAG+Ph/J3KijfrTneW29i0jWUjHAEJZozpI7yZ7ux/mQaa8T08FdPB1wOfWR4w== 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) 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240403_142009_209201_5EE88428 X-CRM114-Status: GOOD ( 13.13 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 21F48CD128A for ; Wed, 3 Apr 2024 13:29:00 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=exSjyAOh; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4V8lvZ5g03z3vtT for ; Thu, 4 Apr 2024 00:28:58 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=exSjyAOh; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::42d; helo=mail-pf1-x42d.google.com; envelope-from=groeck7@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4V8ljK2P4Dz3w2x for ; Thu, 4 Apr 2024 00:20:05 +1100 (AEDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6eae2b57ff2so5151911b3a.2 for ; Wed, 03 Apr 2024 06:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712150403; x=1712755203; darn=lists.ozlabs.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=exSjyAOhPQlXntjBlcZtc+a2mrkPBKsGRpclOHvPC8IGHN5ZJdwJAeVPNON0teqdPP eQTDXnLo+SmkX5xkR9mUDSN48euUdPq8h5kIrFiJ+P4YE3ITXFoA33ZfLJithhdRSRGo uGePKBqA7pGbXIcnC3DFovts4SYKp56H1dB39QmLP1y+L2vJvwovvag8SFSTFyAMgAev l1rlQ0qZxebN2nRqGv2Hib83jDIO/PAggui8zuYroRUQp7qe4QxMltpyY2yoEvCK362e TNZaQq8ZauJ2AaEIsJcZD3vj8yJQm1CKXzeLGWAZZEFcOGYoSNd5ly1CETGrMd2sboDs FRAg== 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=JcyjZdUhzaN/Y3rre2pu8wdqWTbb5J1pGUcnrgC5iLmYgtu+LH+yjzyLrdHJ68ikTh naR8EoXyCpY2hOYRxfJjcj3tWVa/Ux3P3CvxDcmeI7+bJloayk3VJaRZzxFqkY1ZUh+O SqlmrJtTJaNgrhkLJpSSXbi88KsyJcNcAz3M1e1jlFmuOcF/XrNm41SYzLq8c4EKNJrF C9vcA3qca+3BS6lGeH9wiUopM3+oN007bDHf2pBWSCgCz4F0kbzRla9inn1UZ1j9BAGU 4c8CCY/v3nHpamDeqz1Q15JK5PtDyeD/fTdRqO6+PriSzJyW5iLazwtXwBx8g0A4C+W9 If0w== X-Forwarded-Encrypted: i=1; AJvYcCUM4JagjjGCiEFkVZVCQI/Au8r49fwfgumnBYbl1IIp/faqPIOTlQVdlAs4sysrPYewAg3pqRLwjgtiPz2XQSypm83MuLcksebpaNSxHw== X-Gm-Message-State: AOJu0Yx/Ikh0SID/wrVa0fpDPZFNvlLqQboKQTpZUaih/82a2kmch5ja vhItx7vXEhZT4p0x148v+AdqcKhufhnTF7trgvgrupZdYeQNjDO8 X-Google-Smtp-Source: AGHT+IH8rm/3VYkllAG+Ph/J3KijfrTneW29i0jWUjHAEJZozpI7yZ7ux/mQaa8T08FdPB1wOfWR4w== 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) From: Guenter Roeck To: linux-kselftest@vger.kernel.org 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> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: x86@kernel.org, loongarch@lists.linux.dev, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, Brendan Higgins , Rich Felker , linux-riscv@lists.infradead.org, David Airlie , Arthur Grillo , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Daniel Diaz , Yoshinori Sato , linux-sh@vger.kernel.org, Naresh Kamboju , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Dan Carpenter , Linux Kernel Functional Testing , Guenter Roeck , Kees Cook , Arnd Bergmann , Maarten Lankhorst , Maxime Ripard , David Gow , John Paul Adrian Glaubitz , Daniel Vetter , linux-arm-kernel@lists.infradead.org, kunit-dev@googlegroups.com, linux-parisc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Zimmermann , Andrew Morton , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B98B7CD128A for ; Wed, 3 Apr 2024 14:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=67t9nEKrMjH2GkLoe4LxD+tXEqTby4QlkjMXyWwIauY=; b=jdagRDzzfp7TS1 vyPr10kHyHhHfGcfNfte86Rx2uOxQb+RKwx8o++OUKo8QmyAQRTNyiAdi9K2dmnNKGDSZ34FSxTrT BtkKqLo/pvs1ogPocqEY+47xCBwMX+iTEpjYZdG4M9KID6MFVSP1Uyj6qYhvcawLjQMHPPYbOc1PM yFAlJAECy38BZt4QAJURdYU13B92iTtxBRB+P9YFl8GaGWEIxy4zfmblN8zVR4cyVXti5adbjNR02 +s027CKtRWR2J58jEIZvJ+icq5GzrhfFjYsFndXDE0vuit0Ak7Nmm8zB+DagwWT/YCd7a7eqFzqmK 4/IDUkt0mIdH8FtGTjxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs1h1-0000000GUjA-1L9e; Wed, 03 Apr 2024 14:34:23 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs0XI-0000000G8nb-1Wxe; Wed, 03 Apr 2024 13:20:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=acDD7oYfD3QQ420QQJRR06Qs6MsGb4dTYH+kiSwK7vU=; b=IAPInJyOb5j8f6gBTcqim8FtOk NnG3uqTM3Frj7r7G4OmGakQrbYo5Jkko1y4QAZPEFu8obAz321M+spMMvomIV91Q4h+eCIRXabqC1 2jJe/WquDFqQ8eqoFs54M4LGQdmSlJho2KUSdWOFNbaUCV8kfs0S83u0cFW+Nf/VJf0p9CQb1V+w7 qLc7/RkmmKQFDRVHduJZuike93PIkhBZRP1tZIc6M+ilJtpTn6yD/vWZ4NSTfDvs51VOAcZ6DfKz+ eNPDGJCv7IkECH475UJbJs27eF7/bK7OO1hujsmgvkEg1OuteREdHeNWWCc76vn7H37n3loHy/x3I 6WQ2Wbpw==; Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs0XB-00000005eWQ-0QNs; Wed, 03 Apr 2024 13:20:15 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e6bee809b8so5980729b3a.1; Wed, 03 Apr 2024 06:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712150403; x=1712755203; darn=lists.infradead.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=DbPmfoLYc/SUogg2TMO+vdJegvOdTRm2qyDpr0EtuwHaB5BSNIf8SIxZlYEwR33SPs hH7RkVubc4pjBg+pRLjgxdIfBEc0ETMdfEibOTeFWpDzeH5YsR4U3TX/eyF+AdDhoofz nrUiEUxF+eKmMdV9uSKszTlAl14Jekgxp2XeUVz0Bgi1rS2o9fLk38ThfpfDvgqD+7A4 DM6Be+slwXE7Orsqz92V+QXgxRr0IqN8GkVD07/VXUbSmgancdaB9qgpe/eVRec2NNt8 b8QNvK2aWo/rC8GoDHxgc5DDnXgL1VxSkNvOR+nvN6mcwejAM1s337O1KbaEkIewvCXM a8cw== 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=Pry9kjywV1aYxxu9D/L8dlFQzzpntIn+vxFQHH2OkgKQ/7ktgjLE2jZKclJNL365jD fuq07MrcRS0Jk/69BTDJ4PcS4LwsH2b+kFJ+spjkWZB4xn5dMnm+oQot4BfCDicphaCU djQd85sxadl2+aBqNE+TKGr1fTjhGwt6xqreXM/rNnnoUaBYtjekdLF+YEwRvWq/UsBV eqaXlzn7COk1VkLZgCtidp3Gg42z+JelqdBEHPEwB7JakUeDBCvo96OEq+BY3EifMBFb A/HQI0GM5sEhtjFrumUoOXLbUHRBS8t+p6bnrZUCBwBcXhOYM3ENVR8HdXuiLQgWAtaf PCfA== X-Forwarded-Encrypted: i=1; AJvYcCV1lXBZkceeJXCH4dsZQAVJx0mFTuUR7RBDxyhsb/IGdrewYa6NaV6qMSbvvV57Tdm3aEQHR6/zRbk+7w/adSCKUPstQKhhdtQNiM+Bi4ZZBst6LitPDXbfeXv5ftWZOyX1TSdQaqbR+TmOv7nsL18d3uA0mcU= X-Gm-Message-State: AOJu0YzzXYDPXkGjD89tAPKFpiasRtgKVnwznTtAUITUxITsGUXDwAdt MskeKwZvzFr/JClIA8EZdKs/WlXNrhbp4cAEfYvs+jaFdgwZ5pQk X-Google-Smtp-Source: AGHT+IH8rm/3VYkllAG+Ph/J3KijfrTneW29i0jWUjHAEJZozpI7yZ7ux/mQaa8T08FdPB1wOfWR4w== 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) 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240403_142009_209201_5EE88428 X-CRM114-Status: GOOD ( 13.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel