From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (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 6121113AA4C; Tue, 12 Mar 2024 17:03:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710263011; cv=none; b=Kms+KaQ+ZhDpY6ZqxWYw3wdzceo10aTLV+jDR7aFSIXDzIFLq0FBpxBAgJ0kmMMGC01D6rXtXNYhHEfilEPkjG6Lr1a0TqppmU7tBVaY3V2NHj0jhUL827zSH70pcS9gNxWznhcbq69iAGDUc45V3gkhU7NYDQpKDikeHzQDers= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710263011; c=relaxed/simple; bh=2NHIPSEeh5V+X5+GdK5eLhFVjFh0D1jEmjx7oDfzWbY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SR2e4hAFVRoGFHZpA2W35FrRkzd/iu02nUwDFV2i39qnhG47qYv+iBOumC+VMVBP2xMhAr8bJTcz9qDF/9L8eP7Jx6uIPKlS62DKF8VdPFdnLp9bhi79d27yKUTGRSnG1DX/pCLR38XpEFOkWhtMn0FDfjutVpnOgk2GHfe9NWg= 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=KaeG/q4k; arc=none smtp.client-ip=209.85.215.177 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="KaeG/q4k" Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-5e152c757a5so3350307a12.2; Tue, 12 Mar 2024 10:03:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710263009; x=1710867809; 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=5e/E6ddr2rv0O0qI6ESGYNVGq97JQ/YRs1mbYMxZhW0=; b=KaeG/q4k2oTvKthueq3In95ouKsGzvDChhRbSwKB9rGceH2ZIqnow3ELZSd4ldzY3I 3qmwFcc9fZRV+5zf9Ep5sL5ZNnYfGFFeb/5/pUBRwn2a3f4GDo7z1SXiXUlmmjRUTSNW 2FrmB/13kuQaDgj/QBoofnCtB9jhgkm2VAtJ5MU+z67tiYA/ZqJDWajhEazgxVKTqpkq 9OIE+X1oyMPNn8Xg8N1mzYulx7l1l3Juf+w+q0lhj5hbmZoWMgKSE0V1UleSyHzQHAJW wJM9veOocS84V6wIiiKuGBP6FtCbodMQH5C+ueHEK4Br9lxJMzJFvEaYbaIuqk5+peeZ QuQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710263009; x=1710867809; 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=5e/E6ddr2rv0O0qI6ESGYNVGq97JQ/YRs1mbYMxZhW0=; b=OrjWVB9Bu4SPimeMsvt3qj4OPCsMXAhS8x0fYnS3o15l2JcTuC1QfmGxLJidvUdc8/ Erl0iBCbRxNomSruhg9YfdqaRBoq6eTSz+qKQmrtrrhzNqiyZLVIvOSwcOvkF0UqFm0T 6TuN50UGJRh19QnlqwzfW+tic/N4WSgz9i04tQxqkxpaB0sCFAIWcPN/XyrdKCMSjyJY Z1GlFcBW4fqGgYAw272ZYE5H2OBRAvfd+0ukw46NB4X1tVRXuJIlg3PNkUmkjB3orW4x HFbsHrymyLmBQdUC+sNMOdULWqIf8Y+9Ep1Xfc/1v9QpC8b6qaGEuDNAXQJ+W7BrbGuQ FhsA== X-Forwarded-Encrypted: i=1; AJvYcCXukJ9LeUdG6MAKwldh41kRcHw+AU1/+kDVAiBHuAbdlIzxSJ3rqQrNQoSnp2jPkr4DzYJISIpcTdGYJXaJmU7iTHNZv8keXwplnFIs9wqNPG9piaTb7yIoorxyC3gaGquRJ8bJMrUdz0ZYUoyGz1XWgjxbKyiG6abqkTXMtS/fgFKOT61+8FdQD6XldNEg8ckaag0xky3qAKFDEGl58F/3tG6B5Jhbu4dVyNwAJG1rmQLxgPvLO0yhY5BNDMp4z0hl6HU+L1IWoRMrWHnVb/dIDrJNxduj+w== X-Gm-Message-State: AOJu0Yw+wNuYZXHZB05Qhkd3UXL2pVG/d3RozlOpkmh/QlJYax1tekRw 2MjQ2NpaMDyp9OoZFeKf9KfT0IFJhg1+6anJOvf/7FcUQNoNWQWaUU6uJMwd X-Google-Smtp-Source: AGHT+IHnpV6pQ4sbhTQFUz6ATEKXpUTcdarefNsnZ32RzB7TxwrdDKUDIv3vmdM+PJbrepqm0Atu1Q== X-Received: by 2002:a17:90a:ba93:b0:29c:844:a91 with SMTP id t19-20020a17090aba9300b0029c08440a91mr5600961pjr.48.1710263008670; Tue, 12 Mar 2024 10:03:28 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id bf20-20020a17090b0b1400b0029bc2b845c4sm5986405pjb.11.2024.03.12.10.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:03:28 -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@lists.linux.dev, Guenter Roeck Subject: [PATCH 07/14] x86: Add support for suppressing warning backtraces Date: Tue, 12 Mar 2024 10:03:02 -0700 Message-Id: <20240312170309.2546362-8-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312170309.2546362-1-linux@roeck-us.net> References: <20240312170309.2546362-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 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). Signed-off-by: Guenter Roeck --- arch/x86/include/asm/bug.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index a3ec87d198ac..d87bf8bab238 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -23,18 +23,28 @@ #ifdef CONFIG_DEBUG_BUGVERBOSE +#if IS_ENABLED(CONFIG_KUNIT) +# 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 /* IS_ENABLED(CONFIG_KUNIT) */ + #define _BUG_FLAGS(ins, flags, extra) \ do { \ asm_inline volatile("1:\t" ins "\n" \ ".pushsection __bug_table,\"aw\"\n" \ "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \ - "\t.word %c1" "\t# bug_entry::line\n" \ - "\t.word %c2" "\t# bug_entry::flags\n" \ - "\t.org 2b+%c3\n" \ + "\t" __BUG_FUNC_PTR "\t# bug_entry::function\n" \ + "\t.word %c2" "\t# bug_entry::line\n" \ + "\t.word %c3" "\t# bug_entry::flags\n" \ + "\t.org 2b+%c4\n" \ ".popsection\n" \ extra \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (__FILE__), "i" (__BUG_FUNC), "i" (__LINE__),\ "i" (flags), \ "i" (sizeof(struct bug_entry))); \ } while (0) @@ -80,7 +90,8 @@ do { \ do { \ __auto_type __flags = BUGFLAG_WARNING|(flags); \ instrumentation_begin(); \ - _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ + if (!IS_SUPPRESSED_WARNING(__func__)) \ + _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ instrumentation_end(); \ } while (0) -- 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 CCD9EC54E68 for ; Tue, 12 Mar 2024 19:31:34 +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=EH2MsRFIZ+TBjU6rRRyueUSwCnupuf3g9pGX9pXMVc4=; b=ODaUjPfSYrZ15r Hp3BSyJEd+rFwayZxOgickxtIKEv2kMJ8wLTIu1j8vjzKLo3AzdZJg9+MwP8QiaV0mDkV8XI/EV0c /p4J//+i+B5R6M4Y/IbPiiPU4a4HxQuBmX5DELsV3vWP5tajQz9fB4WrkPlvDmEVjU+Xop9+l8jkv Br9Reo1EwXVtJyjXv4uYi6uQuzZyHLdVPDPtJHelHOIMAZml3pTxOQophw1N2fDjBM/eoITyu2+0Y t7Dt6xvZRNBuCSEpEln69+ZkmQfs6f8KGsBfbjbrtzlsa5xA206bhALpoeVU20KMn2ILYEydDSM9z 25/AECWASRLzsOVEvZKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rk7qU-00000007IDG-176D; Tue, 12 Mar 2024 19:31:30 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rk5XG-00000006ihj-3n9R; Tue, 12 Mar 2024 17:03:35 +0000 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5cdbc4334edso2900494a12.3; Tue, 12 Mar 2024 10:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710263009; x=1710867809; 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=5e/E6ddr2rv0O0qI6ESGYNVGq97JQ/YRs1mbYMxZhW0=; b=PX2QEuckrC/MwVZaKse7o/G7QNWSLqRIJw8rGWfcPkxmit6uDdHOKOtgRL6JIoXgSe h1vJHOsV688o0wYU2oF4uhxsy/P0LY9QPnr+jkSHvSIAnCstAaliG9nUIfLUUYO9Le1c ARYDduNS1/oxVTfLG2+tde7eeoF/A+B30Vps+CNR99LCilcZzFFDULxuqS6MDO7LUpCt ykbixU4Ua0kxsDJYwwMoveikgyFA0H6gO/EXDFH2pzNwrAiWGBGoe0ubK9nFZ6SXYS8q AUc6sffSHos1kL++PNds68/domQHc1tmxPTXIp+Pot9jotToHpNwR74+OCS/MijSuxW8 bQgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710263009; x=1710867809; 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=5e/E6ddr2rv0O0qI6ESGYNVGq97JQ/YRs1mbYMxZhW0=; b=ckAiFQx8RT4GSr0IFZdQlREIIoDdNH5+jg0BIEXrPC7cOY0cLdhE+DL15/6dXJOHk4 PdeGZZyK/rURgbZg8AISrwFRGNt1PaOxaXHHEKDNbRGR3tZlHYywxoeX6onjA+SMI9B+ laCer/Y9ceJOGqQXO69qScE0p2wGLzmv/w4jQ1ZGiMbniaMqNYy7Rs14QfA0RAmZIR7Y THQ80Xv8YhPBlNM/DWPf3oLGyBrPYEBVkfToVy8eJHlcSCJd5WH7OWudUt7cZWxo22iQ ++hWlCX56oSBXYpJ+Ul/jDGkLiR6nXHlbV9Ha4enIO3VW1ajcr5rsUfbN2RlA3TC1XWI adiQ== X-Forwarded-Encrypted: i=1; AJvYcCXw99rVvy6eLaw3Mn4q05M7kU2UaYxIj0rB4yUR8H3suVnDTdmV7k17YWp7fk/uKs5HhMLdx7XZKRNCLfxaqIPZMa/rHT7Uv1WtuMZXyp0bsgxggRx8wePsN0yvmvWhA4G4DSlSZg0ZNlAPi9Tfzbps5XLY9c4= X-Gm-Message-State: AOJu0YzNrLCNL5B+0ZgcuMxrJyPDRdomoVGeYhl5sxSlqjJ5I4CGy+3a k5juexR3Ex/Ctwbf2/fABzL1y80NTwMAcp37LY10fWfViPTzYG8N X-Google-Smtp-Source: AGHT+IHnpV6pQ4sbhTQFUz6ATEKXpUTcdarefNsnZ32RzB7TxwrdDKUDIv3vmdM+PJbrepqm0Atu1Q== X-Received: by 2002:a17:90a:ba93:b0:29c:844:a91 with SMTP id t19-20020a17090aba9300b0029c08440a91mr5600961pjr.48.1710263008670; Tue, 12 Mar 2024 10:03:28 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id bf20-20020a17090b0b1400b0029bc2b845c4sm5986405pjb.11.2024.03.12.10.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:03:28 -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@lists.linux.dev, Guenter Roeck Subject: [PATCH 07/14] x86: Add support for suppressing warning backtraces Date: Tue, 12 Mar 2024 10:03:02 -0700 Message-Id: <20240312170309.2546362-8-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312170309.2546362-1-linux@roeck-us.net> References: <20240312170309.2546362-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-20240312_100331_255779_62037F8B X-CRM114-Status: GOOD ( 12.47 ) 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 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). Signed-off-by: Guenter Roeck --- arch/x86/include/asm/bug.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index a3ec87d198ac..d87bf8bab238 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -23,18 +23,28 @@ #ifdef CONFIG_DEBUG_BUGVERBOSE +#if IS_ENABLED(CONFIG_KUNIT) +# 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 /* IS_ENABLED(CONFIG_KUNIT) */ + #define _BUG_FLAGS(ins, flags, extra) \ do { \ asm_inline volatile("1:\t" ins "\n" \ ".pushsection __bug_table,\"aw\"\n" \ "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \ - "\t.word %c1" "\t# bug_entry::line\n" \ - "\t.word %c2" "\t# bug_entry::flags\n" \ - "\t.org 2b+%c3\n" \ + "\t" __BUG_FUNC_PTR "\t# bug_entry::function\n" \ + "\t.word %c2" "\t# bug_entry::line\n" \ + "\t.word %c3" "\t# bug_entry::flags\n" \ + "\t.org 2b+%c4\n" \ ".popsection\n" \ extra \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (__FILE__), "i" (__BUG_FUNC), "i" (__LINE__),\ "i" (flags), \ "i" (sizeof(struct bug_entry))); \ } while (0) @@ -80,7 +90,8 @@ do { \ do { \ __auto_type __flags = BUGFLAG_WARNING|(flags); \ instrumentation_begin(); \ - _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ + if (!IS_SUPPRESSED_WARNING(__func__)) \ + _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ instrumentation_end(); \ } while (0) -- 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 96B14C54E60 for ; Tue, 12 Mar 2024 17:09:05 +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=Ws/dp5Bh; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TvKqh2009z3vvF for ; Wed, 13 Mar 2024 04:09:04 +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=Ws/dp5Bh; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1034; helo=mail-pj1-x1034.google.com; envelope-from=groeck7@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) (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 4TvKjH4Kg8z3dVw for ; Wed, 13 Mar 2024 04:03:31 +1100 (AEDT) Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-29c585b259aso118685a91.3 for ; Tue, 12 Mar 2024 10:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710263009; x=1710867809; 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=5e/E6ddr2rv0O0qI6ESGYNVGq97JQ/YRs1mbYMxZhW0=; b=Ws/dp5BhiwbgOHSPLCe/AAZcZGwRB9Zm42+oP4ZWi7JZ5pM3ur7BjHB3SSVQ72jRes 94CnltDFwvWCJ1gF/7X7alZ0Vz24e89uScB96oOe9bGe0t9FcWZwAzgjYCEQ+CT03gj1 UFSokgn1PYWLaIzv/KHmdiX2LiN8UY3iQYLcPTty5I78p9cyOMSh8TL2TG1LB6LP7uSL gJ6KOXwMWmQLPBmD+JBeL+jRXuKQFEVKmNEFUt64jcHegPyz4KQaLdJ5XE7Obij2ENg2 UxEDGEOp61mEX6v+n/7Fi63dWvn14vhIVRUjSFmlHbTtt6yjpoEiA+2Z0Ug9MtVMPajp Sbhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710263009; x=1710867809; 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=5e/E6ddr2rv0O0qI6ESGYNVGq97JQ/YRs1mbYMxZhW0=; b=gZmLPUsETOjWMwwwrSA9MRyvL3WUGJ0NyvcCqWfcsCumIbUQ3YA87X8UYZn+mLkT3E EzvVEEfl8ZcVWFs65UhZeLK28NGGXom1Epl2xcj6HOXJXKoGNEihbLwL8EahS6orFjhO PrzDJz5S/acUNneibL0Ea4FGWIssujcqSAwlvngQX468RDdYQwW4O3Qw9tXYIMiaENmJ ABBvAP6Qn+3K+7xdle5qeUl7JhcHuMVnBGWUrYX0JoXz4ChyQfw/sVDE/p7QNpm99pfE 6ISBPzzB9onKnatEaAMRh7IzzNvRwUGqIyBUjwnwt5E4gU/w2NfZelb/9ofjpPRnPBU+ ZfDQ== X-Forwarded-Encrypted: i=1; AJvYcCULIZ3Haysqmvhq5kFA90Pold49L17yZtXYNCkaBJfAWCdoSraE8Srf//SFwT5gp+YWQrI9xqCTI47iOKOs7s/7fOEZJS/mueqK/7w87w== X-Gm-Message-State: AOJu0YzmpKKF8oqOBTmNFNIG/wMY5c1zFfcKcL+ZgGk0K0RYtSz8jMbY ypgzlfF2JmAvhDgPMgy8F+8q7jJH7HgHNAPzv+f4YOuWWN99NG9f X-Google-Smtp-Source: AGHT+IHnpV6pQ4sbhTQFUz6ATEKXpUTcdarefNsnZ32RzB7TxwrdDKUDIv3vmdM+PJbrepqm0Atu1Q== X-Received: by 2002:a17:90a:ba93:b0:29c:844:a91 with SMTP id t19-20020a17090aba9300b0029c08440a91mr5600961pjr.48.1710263008670; Tue, 12 Mar 2024 10:03:28 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id bf20-20020a17090b0b1400b0029bc2b845c4sm5986405pjb.11.2024.03.12.10.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:03:28 -0700 (PDT) From: Guenter Roeck To: linux-kselftest@vger.kernel.org Subject: [PATCH 07/14] x86: Add support for suppressing warning backtraces Date: Tue, 12 Mar 2024 10:03:02 -0700 Message-Id: <20240312170309.2546362-8-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312170309.2546362-1-linux@roeck-us.net> References: <20240312170309.2546362-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: loongarch@lists.linux.dev, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, Brendan Higgins , 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 , linux-sh@vger.kernel.org, Naresh Kamboju , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Dan Carpenter , Guenter Roeck , netdev@lists.linux.dev, Kees Cook , Arnd Bergmann , Maarten Lankhorst , Maxime Ripard , David Gow , Daniel Vetter , linux-arm-kernel@lists.infradead.org, kunit-dev@googlegroups.com, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Zimmerman n , 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 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). Signed-off-by: Guenter Roeck --- arch/x86/include/asm/bug.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index a3ec87d198ac..d87bf8bab238 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -23,18 +23,28 @@ #ifdef CONFIG_DEBUG_BUGVERBOSE +#if IS_ENABLED(CONFIG_KUNIT) +# 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 /* IS_ENABLED(CONFIG_KUNIT) */ + #define _BUG_FLAGS(ins, flags, extra) \ do { \ asm_inline volatile("1:\t" ins "\n" \ ".pushsection __bug_table,\"aw\"\n" \ "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \ - "\t.word %c1" "\t# bug_entry::line\n" \ - "\t.word %c2" "\t# bug_entry::flags\n" \ - "\t.org 2b+%c3\n" \ + "\t" __BUG_FUNC_PTR "\t# bug_entry::function\n" \ + "\t.word %c2" "\t# bug_entry::line\n" \ + "\t.word %c3" "\t# bug_entry::flags\n" \ + "\t.org 2b+%c4\n" \ ".popsection\n" \ extra \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (__FILE__), "i" (__BUG_FUNC), "i" (__LINE__),\ "i" (flags), \ "i" (sizeof(struct bug_entry))); \ } while (0) @@ -80,7 +90,8 @@ do { \ do { \ __auto_type __flags = BUGFLAG_WARNING|(flags); \ instrumentation_begin(); \ - _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ + if (!IS_SUPPRESSED_WARNING(__func__)) \ + _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ instrumentation_end(); \ } while (0) -- 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 80312C54E5D for ; Tue, 12 Mar 2024 19:31:43 +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=0NXcaIOiB2YZT32S4bQ6f9kowjOuNH+kfHqHdM+qLeA=; b=zdAAUeXqZvBE61 17bCEMCuvyG7l3mKphVU+ny8sswy+ioTwarShxKNNy1vYvvEWnMDWJsJDRaUQrkhfe0gztBxnrrBg Zmo7HvX0qhrfeqDfUQMJF/Y8eWmRTGzPaWLD8NBckYzBxRUaBknROAOqK/91cdbF2zvSKlLWOlY8o xEcuPz6Y42H/+DpzX//fbxEqDOH9bx6u2lhvFYc4Ejahx2ktYR/37QK7mf7VvDgUo1zn3nMiRnzfn nsC17C476Dfh6TdrIlHnSs3vvy+CKkBHDBcMT1tO+bHPv0hLoouUNoj0+DOCRSl/V5QrVfebIq5X5 nfQ7c5Y+n3hVYzSwUF8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rk7qT-00000007ICr-2ZAE; Tue, 12 Mar 2024 19:31:29 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rk5XG-00000006ihj-3n9R; Tue, 12 Mar 2024 17:03:35 +0000 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5cdbc4334edso2900494a12.3; Tue, 12 Mar 2024 10:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710263009; x=1710867809; 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=5e/E6ddr2rv0O0qI6ESGYNVGq97JQ/YRs1mbYMxZhW0=; b=PX2QEuckrC/MwVZaKse7o/G7QNWSLqRIJw8rGWfcPkxmit6uDdHOKOtgRL6JIoXgSe h1vJHOsV688o0wYU2oF4uhxsy/P0LY9QPnr+jkSHvSIAnCstAaliG9nUIfLUUYO9Le1c ARYDduNS1/oxVTfLG2+tde7eeoF/A+B30Vps+CNR99LCilcZzFFDULxuqS6MDO7LUpCt ykbixU4Ua0kxsDJYwwMoveikgyFA0H6gO/EXDFH2pzNwrAiWGBGoe0ubK9nFZ6SXYS8q AUc6sffSHos1kL++PNds68/domQHc1tmxPTXIp+Pot9jotToHpNwR74+OCS/MijSuxW8 bQgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710263009; x=1710867809; 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=5e/E6ddr2rv0O0qI6ESGYNVGq97JQ/YRs1mbYMxZhW0=; b=ckAiFQx8RT4GSr0IFZdQlREIIoDdNH5+jg0BIEXrPC7cOY0cLdhE+DL15/6dXJOHk4 PdeGZZyK/rURgbZg8AISrwFRGNt1PaOxaXHHEKDNbRGR3tZlHYywxoeX6onjA+SMI9B+ laCer/Y9ceJOGqQXO69qScE0p2wGLzmv/w4jQ1ZGiMbniaMqNYy7Rs14QfA0RAmZIR7Y THQ80Xv8YhPBlNM/DWPf3oLGyBrPYEBVkfToVy8eJHlcSCJd5WH7OWudUt7cZWxo22iQ ++hWlCX56oSBXYpJ+Ul/jDGkLiR6nXHlbV9Ha4enIO3VW1ajcr5rsUfbN2RlA3TC1XWI adiQ== X-Forwarded-Encrypted: i=1; AJvYcCXw99rVvy6eLaw3Mn4q05M7kU2UaYxIj0rB4yUR8H3suVnDTdmV7k17YWp7fk/uKs5HhMLdx7XZKRNCLfxaqIPZMa/rHT7Uv1WtuMZXyp0bsgxggRx8wePsN0yvmvWhA4G4DSlSZg0ZNlAPi9Tfzbps5XLY9c4= X-Gm-Message-State: AOJu0YzNrLCNL5B+0ZgcuMxrJyPDRdomoVGeYhl5sxSlqjJ5I4CGy+3a k5juexR3Ex/Ctwbf2/fABzL1y80NTwMAcp37LY10fWfViPTzYG8N X-Google-Smtp-Source: AGHT+IHnpV6pQ4sbhTQFUz6ATEKXpUTcdarefNsnZ32RzB7TxwrdDKUDIv3vmdM+PJbrepqm0Atu1Q== X-Received: by 2002:a17:90a:ba93:b0:29c:844:a91 with SMTP id t19-20020a17090aba9300b0029c08440a91mr5600961pjr.48.1710263008670; Tue, 12 Mar 2024 10:03:28 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id bf20-20020a17090b0b1400b0029bc2b845c4sm5986405pjb.11.2024.03.12.10.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 10:03:28 -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@lists.linux.dev, Guenter Roeck Subject: [PATCH 07/14] x86: Add support for suppressing warning backtraces Date: Tue, 12 Mar 2024 10:03:02 -0700 Message-Id: <20240312170309.2546362-8-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312170309.2546362-1-linux@roeck-us.net> References: <20240312170309.2546362-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-20240312_100331_255779_62037F8B X-CRM114-Status: GOOD ( 12.47 ) 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 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). Signed-off-by: Guenter Roeck --- arch/x86/include/asm/bug.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index a3ec87d198ac..d87bf8bab238 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -23,18 +23,28 @@ #ifdef CONFIG_DEBUG_BUGVERBOSE +#if IS_ENABLED(CONFIG_KUNIT) +# 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 /* IS_ENABLED(CONFIG_KUNIT) */ + #define _BUG_FLAGS(ins, flags, extra) \ do { \ asm_inline volatile("1:\t" ins "\n" \ ".pushsection __bug_table,\"aw\"\n" \ "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \ - "\t.word %c1" "\t# bug_entry::line\n" \ - "\t.word %c2" "\t# bug_entry::flags\n" \ - "\t.org 2b+%c3\n" \ + "\t" __BUG_FUNC_PTR "\t# bug_entry::function\n" \ + "\t.word %c2" "\t# bug_entry::line\n" \ + "\t.word %c3" "\t# bug_entry::flags\n" \ + "\t.org 2b+%c4\n" \ ".popsection\n" \ extra \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (__FILE__), "i" (__BUG_FUNC), "i" (__LINE__),\ "i" (flags), \ "i" (sizeof(struct bug_entry))); \ } while (0) @@ -80,7 +90,8 @@ do { \ do { \ __auto_type __flags = BUGFLAG_WARNING|(flags); \ instrumentation_begin(); \ - _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ + if (!IS_SUPPRESSED_WARNING(__func__)) \ + _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ instrumentation_end(); \ } while (0) -- 2.39.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel