Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2703631lqz; Wed, 3 Apr 2024 06:24:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWXD23JJsdslON71qu7Qk5mkXDgyLdRQJ8x5F3MuHY71lmvrl6jniBtqKlXQDL8aBcP4OwE8PWnWNeSIhXkFq5MYc406NTLEoylpg2miA== X-Google-Smtp-Source: AGHT+IF680FYT0a4C1s5bx5csgDJFxpCKvHWFzxlC+DJhXnFmb/MZH+hM4DCCE99y/E5NzXIZvBH X-Received: by 2002:a0c:cd8d:0:b0:699:125:8547 with SMTP id v13-20020a0ccd8d000000b0069901258547mr10121597qvm.63.1712150681255; Wed, 03 Apr 2024 06:24:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712150681; cv=pass; d=google.com; s=arc-20160816; b=PYtcajHO8acC4Rem728gvDHeoeKoEwncC3qRMLjubROp4fMWl+8JpHxQP6xPep+k1b Gis1laAi41Wh5Rx6kCzqP0PhvU3IFmXWQTfy2DEuC1tRUTVzfNIQ1d8KPcE/bEF3XYoW kxkZDBM8qhe/HSId6Sc+ta1kXFOBBZAe5Hbhle9djB9aQmWa1+061nwY6U52eFOkrgm6 KX76ExsSY1V3oSrYNLnlsxltgshgcDyNcpHwpaveC/VLtBrnOu0YZEIiiRSFcxUhMtmJ x5fA6WTW3H/nEYpAnNyXNPPakDD7Y209gMzZN39Vl/6ErUf2jgW7fdoUg3Wt2Jd0LewC 1HgA== 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=Wn5Y6haDMX+KFeDZiuG3bLreTNkdvF0hb2IVOihuo/Q=; fh=Y0TzSTE3jTz7emilk24KbBh8U2yxt2stzPzkvJu0CqA=; b=ffRGvYAwQYyvX3VvzIqxj9P31iZwpk/VwxfgRgeNQ9CgHuMfa1FXl3SNe9MJ1sFoqt NA48k/n567pejKM8KJeVkVNyCbwGMyYtksOJZ2xwMdcSJ4o39A9hsx1pYotmFyEfpLS0 Yht8sAtZ2ZOp5STux8ev58PpXX50BsVL1qaoBGATkhpsPjXIT+aBSv1mIr0xGFfuYr8X +nBE6+8uQphwzBWH5KM2bfJr5sVLDkC4jNF61qxl5rUCZDfbdNQdsERDujMLgnEqIsEq zkWhObTwPjPgZwerXo8ZBSNfSvRXvVZXTGh0as47lgn4jozau2CaZusfZGLiMatau2mi NEiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LMfafsMs; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-129817-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129817-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e1-20020ad442a1000000b006992a73d497si868933qvr.192.2024.04.03.06.24.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 06:24:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129817-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LMfafsMs; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-129817-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129817-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E745E1C2094E for ; Wed, 3 Apr 2024 13:24:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C859514F9D2; Wed, 3 Apr 2024 13:20:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LMfafsMs" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 3310914E2DA; Wed, 3 Apr 2024 13:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712150410; cv=none; b=QFLqO2hJQUpl+LwXu2UUjB7vmb63QHXmDLuwEazRtrvHhzS5UlK6ZDHzqnO82sBoUv848Fy5MTIjX9GG+2D+dyN3Ow8o9ll9falBLrwvJDWJosChXujMvgJ72SyQYmg2OYmTpXjofY7GRs1/dPQLrL1EROn815x7vZoJAl651+0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712150410; c=relaxed/simple; bh=fEOGTP44ht/ZhSieHBOxh1TKRJM2QPU3A8FjedSkZo4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cAs8z/4I1YJe8czr0u3qB5xokbINSu9uNTOkIxuWnUuWNpAZVEDT2/f3F/2irR0cpXwV+8K6isbO1kTk9m6nEJhAm1OrQgRRC7KtU/jMMFGy6GMWbBN4rTLI8GcVr3P+DtkOpEoFfNostj/UG+DpckL0dBTBLh1wnwiSEn5Ugyc= 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=LMfafsMs; arc=none smtp.client-ip=209.85.214.169 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-pl1-f169.google.com with SMTP id d9443c01a7336-1e27c303573so13523555ad.3; Wed, 03 Apr 2024 06:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712150407; x=1712755207; 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=Wn5Y6haDMX+KFeDZiuG3bLreTNkdvF0hb2IVOihuo/Q=; b=LMfafsMsnVCLJvAyLc/fI3aGiQpHUzPkwdjpXDSRK7GwuJEP2pChmNhUwLZIgdgiqq t35PWXnlEeCdPi/VuDeOWkuhtCeDqKwA96QB4wLtqb4Igqs7jlFs8aJTkZU45PQVTWA8 YA+KioJca5uZoP8ZXtbkS8iV0x4cc9vurQkXAol3dURtE0H3Z+7uarf5MnE7yb6aNKHJ mZNFuVX5dv74BL6eL4VDgTXJIP7b3bZLPbl1OxsngNJqRuqBqy6V8SqGKVITMc0im8oJ OG5XSTUJvQN1f71PEsAIiUYutsr6WFqx6ElCWqw+7vXRa8CVk0YIs/xF5eUKCNNO9xtg WY6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712150407; x=1712755207; 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=Wn5Y6haDMX+KFeDZiuG3bLreTNkdvF0hb2IVOihuo/Q=; b=WNjuHhgRDUG+Qy02C4q4AKg3PfgBT67BBoROAaW85+yJL6pBNDzqPAevHnlKbUwBuL Rzh6iADH5WMdVDdqfjVJ3BTT6mLfyDh6vf5Yy9pUQX0X2gn4Gnt+3TDAFMmWwDsUiRsm n0K5ZGzzRcg3g/ZA7pFY/AJxlYAbDYQYtR/mOJAZqeWte71vRzGGBvVrs7Sby8Z4HYhv 0W3FEOPdgw4irHiFRpkvNkcynbnc1t2ClbWUcXaW6/vQIDQ+2tIBTOLLfNzobewRfZT6 gkfznRTr38ptxG4Hxte3Uql40CepZ/nKpYHM/NngcEq3fAaREv3HL6V0MGLRxw46HjRQ zIJQ== X-Forwarded-Encrypted: i=1; AJvYcCWDSjDTqC33iH8rfS5sgmZppAqUKyzdGMI03wGBl11g2DXQyYUkXlACnm0JTJ7uvh1BiddRUvpryx7Lt6HXuXsh3LmnohwJSXNJ9rzvh25+DuJzNSIs/TA4VvNICF0BPbJP+VOzKP8wiY3qJmz2pMqT7xkFxkRegmIyJSp+aD1nTy8yPUV2QfwvqpAMNLWSYJS1b7fitx+4xsId2vONHdVxSFF5gIT+ROSqkUspXRgTMibZTIwu/Y+oIaPtoL1dgithT31ssk55vSXf1SkYtmvbzsKuMQ3GrZNRFV8KnKiF4kfOBU3vYfuPCIGiicJ2lg== X-Gm-Message-State: AOJu0Yww/iQKLc7NNFNMVdA6G4l+fOXDc7xpi7QwbWj/JsdV9ZtpvSl7 6qsZjKukWujUXCW8YMxqM8oSd/+50FLeBksQM4vi8P2K6fuAv2ZNv0RWrMgh X-Received: by 2002:a17:902:e74f:b0:1e0:d630:f054 with SMTP id p15-20020a170902e74f00b001e0d630f054mr18958233plf.7.1712150407580; Wed, 03 Apr 2024 06:20:07 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id k12-20020a170902c40c00b001e0b3a87dbbsm1705074plk.177.2024.04.03.06.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 06:20:07 -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 , Michael Ellerman Subject: [PATCH v3 15/15] powerpc: Add support for suppressing warning backtraces Date: Wed, 3 Apr 2024 06:19:36 -0700 Message-Id: <20240403131936.787234-16-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: Michael Ellerman 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/powerpc/include/asm/bug.h | 37 +++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h index 1db485aacbd9..5b06745d20aa 100644 --- a/arch/powerpc/include/asm/bug.h +++ b/arch/powerpc/include/asm/bug.h @@ -14,6 +14,9 @@ .section __bug_table,"aw" 5001: .4byte \addr - . .4byte 5002f - . +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE + .4byte 0 +#endif .short \line, \flags .org 5001b+BUG_ENTRY_SIZE .previous @@ -32,30 +35,46 @@ #endif /* verbose */ #else /* !__ASSEMBLY__ */ -/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and - sizeof(struct bug_entry), respectively */ +/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3,%4 to be FILE, __func__, LINE, flags + and sizeof(struct bug_entry), respectively */ #ifdef CONFIG_DEBUG_BUGVERBOSE + +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE +# define HAVE_BUG_FUNCTION +# define __BUG_FUNC_PTR " .4byte %1 - .\n" +#else +# define __BUG_FUNC_PTR +#endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ + #define _EMIT_BUG_ENTRY \ ".section __bug_table,\"aw\"\n" \ "2: .4byte 1b - .\n" \ " .4byte %0 - .\n" \ - " .short %1, %2\n" \ - ".org 2b+%3\n" \ + __BUG_FUNC_PTR \ + " .short %2, %3\n" \ + ".org 2b+%4\n" \ ".previous\n" #else #define _EMIT_BUG_ENTRY \ ".section __bug_table,\"aw\"\n" \ "2: .4byte 1b - .\n" \ - " .short %2\n" \ - ".org 2b+%3\n" \ + " .short %3\n" \ + ".org 2b+%4\n" \ ".previous\n" #endif +#ifdef HAVE_BUG_FUNCTION +# define __BUG_FUNC __func__ +#else +# define __BUG_FUNC NULL +#endif + #define BUG_ENTRY(insn, flags, ...) \ __asm__ __volatile__( \ "1: " insn "\n" \ _EMIT_BUG_ENTRY \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (__FILE__), "i" (__BUG_FUNC), \ + "i" (__LINE__), \ "i" (flags), \ "i" (sizeof(struct bug_entry)), \ ##__VA_ARGS__) @@ -80,7 +99,7 @@ if (x) \ BUG(); \ } else { \ - BUG_ENTRY(PPC_TLNEI " %4, 0", 0, "r" ((__force long)(x))); \ + BUG_ENTRY(PPC_TLNEI " %5, 0", 0, "r" ((__force long)(x))); \ } \ } while (0) @@ -90,7 +109,7 @@ if (__ret_warn_on) \ __WARN(); \ } else { \ - BUG_ENTRY(PPC_TLNEI " %4, 0", \ + BUG_ENTRY(PPC_TLNEI " %5, 0", \ BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), \ "r" (__ret_warn_on)); \ } \ -- 2.39.2