From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E4B3029AB19; Thu, 15 May 2025 12:46:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313212; cv=none; b=DRzDi3M+JE3hoMHR6cGrwnycQtqGQsUKsUZyhD0yMn8kZshrpdnVUlS9yKZRg4EXmAz41ZXnsbDZ6oz8BBimo8rdukMxn2L7PH0xG+FSY1iLkj291rdOyYSZHrx4hcjzXveU74UEcWbe/rbwWfYbqA4zfBsHAatYr08eCIjs1H8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313212; c=relaxed/simple; bh=H074XjrmWtzSuFHce5jj8Mm94I4RRwp0SASD9hzDHoo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=npY1GQ5u6xw6MPVdcRD4dV2wOauGYMMNepcu4HCk8uo/zhK4AxfFr+OWDugACWE5Dy9LBs/xN+dlKwtjHY8F4f9QYDEFeChQV5QcXcqUtWIOkCVhiL0mjGDOprbcNangFfN8odfIwopnOwVOI9FNSvJ20qJQszId/nzIzKpCs88= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Fp0lHU6m; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Fp0lHU6m" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07BA8C4CEEB; Thu, 15 May 2025 12:46:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313211; bh=H074XjrmWtzSuFHce5jj8Mm94I4RRwp0SASD9hzDHoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fp0lHU6mslI28nKFzBjVJ7bmcge2DWW00i22Ygg0Bj2ydbT/x6ND337sOLWEyCpQS dNHIMS5fLQb0hQX4/iFfUzbwvbU3DvuxJFa3VWCmf3hl+euMYJarWVRgFXra9heSQp hDjq/T0HMM+bgTJ7vmrrgPqgNA3jxWhH7riNH0qbe/eX41/VSZCiBM6HSPSBQYo+ET 9kwuzUsVw8z6xsftMFkYTkeTEzeW7RxWHyfE+VPnhS8NQh6Yje3fauzEMr26CzpOAd 0am/wDMZOf0U5iwLiaSUUffBMD5FfWffmgvWtf+L+qa0iTItiL7DMua4XpPypjykz3 BT6MdCZ8oIBBw== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org Subject: [PATCH 01/15] bugs/core: Extend __WARN_FLAGS() with the 'cond_str' parameter Date: Thu, 15 May 2025 14:46:30 +0200 Message-ID: <20250515124644.2958810-2-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Push the new parameter down into every architecture that defines __WARN_FLA= GS(): arm64 loongarch parisc powerpc riscv s390 sh x86 Don't pass anything substantial down yet, just propagate the new parameter with empty strings, without generating it or using it. ( The string is never NULL, so it can be concatenated at the preprocessor level. ) Signed-off-by: Ingo Molnar Cc: --- arch/arm64/include/asm/bug.h | 2 +- arch/loongarch/include/asm/bug.h | 2 +- arch/parisc/include/asm/bug.h | 4 ++-- arch/powerpc/include/asm/bug.h | 2 +- arch/riscv/include/asm/bug.h | 2 +- arch/s390/include/asm/bug.h | 2 +- arch/sh/include/asm/bug.h | 2 +- arch/x86/include/asm/bug.h | 2 +- include/asm-generic/bug.h | 7 ++++--- 9 files changed, 13 insertions(+), 12 deletions(-) diff --git a/arch/arm64/include/asm/bug.h b/arch/arm64/include/asm/bug.h index 28be048db3f6..bceeaec21fb9 100644 --- a/arch/arm64/include/asm/bug.h +++ b/arch/arm64/include/asm/bug.h @@ -19,7 +19,7 @@ unreachable(); \ } while (0) =20 -#define __WARN_FLAGS(flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags)) +#define __WARN_FLAGS(cond_str, flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags)) =20 #define HAVE_ARCH_BUG =20 diff --git a/arch/loongarch/include/asm/bug.h b/arch/loongarch/include/asm/= bug.h index f6f254f2c5db..51c2cb98d728 100644 --- a/arch/loongarch/include/asm/bug.h +++ b/arch/loongarch/include/asm/bug.h @@ -42,7 +42,7 @@ asm_inline volatile (__stringify(ASM_BUG_FLAGS(flags)) \ extra); =20 -#define __WARN_FLAGS(flags) \ +#define __WARN_FLAGS(cond_str, flags) \ do { \ instrumentation_begin(); \ __BUG_FLAGS(BUGFLAG_WARNING|(flags), ANNOTATE_REACHABLE(10001b));\ diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h index 833555f74ffa..1a87cf80ec3c 100644 --- a/arch/parisc/include/asm/bug.h +++ b/arch/parisc/include/asm/bug.h @@ -50,7 +50,7 @@ #endif =20 #ifdef CONFIG_DEBUG_BUGVERBOSE -#define __WARN_FLAGS(flags) \ +#define __WARN_FLAGS(cond_str, flags) \ do { \ asm volatile("\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \ @@ -66,7 +66,7 @@ "i" (sizeof(struct bug_entry)) ); \ } while(0) #else -#define __WARN_FLAGS(flags) \ +#define __WARN_FLAGS(cond_str, flags) \ do { \ asm volatile("\n" \ "1:\t" PARISC_BUG_BREAK_ASM "\n" \ diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h index 1db485aacbd9..34d39ec79720 100644 --- a/arch/powerpc/include/asm/bug.h +++ b/arch/powerpc/include/asm/bug.h @@ -72,7 +72,7 @@ } while (0) #define HAVE_ARCH_BUG =20 -#define __WARN_FLAGS(flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (f= lags)) +#define __WARN_FLAGS(cond_str, flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WA= RNING | (flags)) =20 #ifdef CONFIG_PPC64 #define BUG_ON(x) do { \ diff --git a/arch/riscv/include/asm/bug.h b/arch/riscv/include/asm/bug.h index 1aaea81fb141..b22ee4d2c882 100644 --- a/arch/riscv/include/asm/bug.h +++ b/arch/riscv/include/asm/bug.h @@ -76,7 +76,7 @@ do { \ unreachable(); \ } while (0) =20 -#define __WARN_FLAGS(flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags)) +#define __WARN_FLAGS(cond_str, flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags)) =20 #define HAVE_ARCH_BUG =20 diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h index c500d45fb465..ef3e495ec1e3 100644 --- a/arch/s390/include/asm/bug.h +++ b/arch/s390/include/asm/bug.h @@ -46,7 +46,7 @@ unreachable(); \ } while (0) =20 -#define __WARN_FLAGS(flags) do { \ +#define __WARN_FLAGS(cond_str, flags) do { \ __EMIT_BUG(BUGFLAG_WARNING|(flags)); \ } while (0) =20 diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h index 05a485c4fabc..834c621ab249 100644 --- a/arch/sh/include/asm/bug.h +++ b/arch/sh/include/asm/bug.h @@ -52,7 +52,7 @@ do { \ unreachable(); \ } while (0) =20 -#define __WARN_FLAGS(flags) \ +#define __WARN_FLAGS(cond_str, flags) \ do { \ __asm__ __volatile__ ( \ "1:\t.short %O0\n" \ diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index f0e9acf72547..413b86b876d9 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -92,7 +92,7 @@ do { \ * were to trigger, we'd rather wreck the machine in an attempt to get the * message out than not know about it. */ -#define __WARN_FLAGS(flags) \ +#define __WARN_FLAGS(cond_str, flags) \ do { \ __auto_type __flags =3D BUGFLAG_WARNING|(flags); \ instrumentation_begin(); \ diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 387720933973..af76e4a04b16 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -100,17 +100,18 @@ extern __printf(1, 2) void __warn_printk(const char *= fmt, ...); instrumentation_end(); \ } while (0) #else -#define __WARN() __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN)) +#define __WARN() __WARN_FLAGS("", BUGFLAG_TAINT(TAINT_WARN)) #define __WARN_printf(taint, arg...) do { \ instrumentation_begin(); \ __warn_printk(arg); \ - __WARN_FLAGS(BUGFLAG_NO_CUT_HERE | BUGFLAG_TAINT(taint));\ + __WARN_FLAGS("", BUGFLAG_NO_CUT_HERE | BUGFLAG_TAINT(taint));\ instrumentation_end(); \ } while (0) #define WARN_ON_ONCE(condition) ({ \ int __ret_warn_on =3D !!(condition); \ if (unlikely(__ret_warn_on)) \ - __WARN_FLAGS(BUGFLAG_ONCE | \ + __WARN_FLAGS("", \ + BUGFLAG_ONCE | \ BUGFLAG_TAINT(TAINT_WARN)); \ unlikely(__ret_warn_on); \ }) --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 483A729ACC1; Thu, 15 May 2025 12:46:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313213; cv=none; b=ijq3c1p388zt9ysjvO3Jxh6+gYTMUv2f2uZI9k9MlwA38azNeIqjw2PWAhEk6/qWQraLVtW7slwgTrUFX8LyTZbos+iQKgP2Vc0HJgmE6R7rxCRtM7l6Ed+LUIQ5K3TO37rnrO5R0dv/WvC2E0rzuu+CjnDfNuZ/szFZ+GNXx6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313213; c=relaxed/simple; bh=tLoDff4noC9eDpa+e8BeKdNFYnRcpSD+Synn8gBfa78=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BTFuhVKuCVrJWCFv1ERUi8LDx3WTzHIi2a+qP0qLo7VCWaaPIU6oLDhOofMZGZ6EfpPLS0u9tn3rSBwu/32c+IElbBLvCh4mELiCFNnHlHsKAD7hRvun6yHwGSy9a0V84cepHa19n4kHJzkShYqMGVgMiNA1pTkztHiV8p+CPqk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FungqfUV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FungqfUV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD887C4CEE7; Thu, 15 May 2025 12:46:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313213; bh=tLoDff4noC9eDpa+e8BeKdNFYnRcpSD+Synn8gBfa78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FungqfUVfH4ShUaXOORoWuXvh3JoDb7WjXXRJCA2ZX+Ka/s/rGzDIJphR75ZVt005 ggOFmmVJlvHr/ZP5Kssl5ExrqaxHrLwuz694kara/+5cOz7im0hr8/OMW5mWJnYQCm 4EsVfMliT9fg/DKF2p71rmZXONJS9jfKheVWimmIxDLauMgsMZpHeXThw9NsE56oV5 iT01M2MhU1/fT9ls6pun5X07GfEg9+e63x9IvNUrOZle2b2YsmbZm2xZKUcWfd1HMq lPYVEEDPAAqNnEUEGS2NwzuA8l/e6qKOFzW8pKo/3RDL7YO/zRoNuZ9agHLFYAkteR 2FqVhThCy3B5w== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org Subject: [PATCH 02/15] bugs/core: Pass down the condition string of WARN_ON_ONCE(cond) warnings to __WARN_FLAGS() Date: Thu, 15 May 2025 14:46:31 +0200 Message-ID: <20250515124644.2958810-3-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Doing this will allow architecture code to store and print out this information as part of the WARN_ON and BUG_ON facilities. The format of the string is '[condition]', for example: WARN_ON_ONCE(idx < 0 && ptr); Will get the '[idx < 0 && ptr]' string literal passed down as 'cond_str' in __WARN_FLAGS(). Signed-off-by: Ingo Molnar Cc: --- include/asm-generic/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index af76e4a04b16..c8e7126bc26e 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -110,7 +110,7 @@ extern __printf(1, 2) void __warn_printk(const char *fm= t, ...); #define WARN_ON_ONCE(condition) ({ \ int __ret_warn_on =3D !!(condition); \ if (unlikely(__ret_warn_on)) \ - __WARN_FLAGS("", \ + __WARN_FLAGS("["#condition"] ", \ BUGFLAG_ONCE | \ BUGFLAG_TAINT(TAINT_WARN)); \ unlikely(__ret_warn_on); \ --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1481329C338; Thu, 15 May 2025 12:46:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313215; cv=none; b=Ew2hieuN8VQtocXmXgShkRsOwNJPmBJDEuOD0vf1J3eQiR2UWHcCqKBo5Zx6yrljqdetmwbWJACbCVn/E5xn0WD5POtTDwMUm8DiZrbr/eFAvVCf4dJPdIdNGtuUpzIAvvQfvvmHDjV2cpyWu8jlTHLPz4uCthsrimjnt27NDu4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313215; c=relaxed/simple; bh=Jr76BiKNHlHCaU2fuOPaiTRLzkjpx/dkIdf7yZEGdpg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uWFULUMJRDPvs2G/j4SbA8L9FDviF14V+eKOy4PewlUXZ/mFtcvYt6aU6UAbWmo4n6ou8247Eeh6sHnGNeOg+E5AhXV7KThuOeLWTCY2yQVKdGpIXM+a9inqReCCI8JAUe4xH66T5yoo6CAP+snp8QOSY/ni+JczbgAdImNVTbI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sPHbaL0s; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sPHbaL0s" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B770C4CEE7; Thu, 15 May 2025 12:46:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313215; bh=Jr76BiKNHlHCaU2fuOPaiTRLzkjpx/dkIdf7yZEGdpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sPHbaL0seGaXVxQdJtxEhaUphpxdPGwBQe8COvf2EWIOTZPbtgsTnBcDfJ9j18xnc xvAnwiPVsjXoOalkx6mR9A6lKy2JgCql2ZLR4dw10D9z64HmuuntKzoWrhpK9FsPZI iI5Njvez774PHRJfkSxwd0mhb9y53rnGheF92SrqzJgtI+cKYYiMUPijxEPePfh+i+ Hm4dwt9R+fT8JFSvhUe4qkktnOlNOxxiwhg230JdQL6iALcfY9iINPiKXzXcYLbSPb VJdo6qjjfZc1ybI+L1pkFo5nWVEftoPjvS9KlEYv4lRPFrqXwfyzvWAKBOXm3Pe4zW qKMSviGAIcrhA== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org Subject: [PATCH 03/15] bugs/core: Introduce the CONFIG_DEBUG_BUGVERBOSE_DETAILED Kconfig switch Date: Thu, 15 May 2025 14:46:32 +0200 Message-ID: <20250515124644.2958810-4-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Allow configurability of the inclusion of more detailed WARN_ON() strings, to be implemented in subsequent commits. Since the full cost will be around 100K more memory on an x86 defconfig, disable it by default. Provide the WARN_CONDITION_STR() macro to allow the conditional passing of extra strings to lower level BUG/WARN handlers. Signed-off-by: Ingo Molnar Cc: --- include/asm-generic/bug.h | 6 ++++++ lib/Kconfig.debug | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index c8e7126bc26e..bc7a22e2bf49 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -92,6 +92,12 @@ void warn_slowpath_fmt(const char *file, const int line,= unsigned taint, const char *fmt, ...); extern __printf(1, 2) void __warn_printk(const char *fmt, ...); =20 +#ifdef CONFIG_DEBUG_BUGVERBOSE_DETAILED +# define WARN_CONDITION_STR(cond_str) cond_str +#else +# define WARN_CONDITION_STR(cond_str) "" +#endif + #ifndef __WARN_FLAGS #define __WARN() __WARN_printf(TAINT_WARN, NULL) #define __WARN_printf(taint, arg...) do { \ diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index f9051ab610d5..59fb70b307e4 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -206,6 +206,16 @@ config DEBUG_BUGVERBOSE of the BUG call as well as the EIP and oops trace. This aids debugging but costs about 70-100K of memory. =20 +config DEBUG_BUGVERBOSE_DETAILED + bool "Verbose WARN_ON_ONCE() reporting (adds 100K)" if DEBUG_BUGVERBOSE + help + Say Y here to make WARN_ON_ONCE() output the condition string of the + warning, in addition to the file name and line number. + This helps debugging, but costs about 100K of memory. + + Say N if unsure. + + endmenu # "printk and dmesg options" =20 config DEBUG_KERNEL --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D78BE29C352; Thu, 15 May 2025 12:46:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313216; cv=none; b=HH7lmtKdQhU3zny1yrVT9CpEQglBi+fQF2Fd4BQTl66y3KAqLkDvprBRHn2sP8EYUXXijJxchfL6LXI4Ymiu94R+apKuSEhjYERLFTyHK2L+gS5cB7xhDMMQJmbJYJKFqlQL8JR6MiKKrU6+/4eA+vAAb6kl3NK0IcrvvGM8P+o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313216; c=relaxed/simple; bh=v63/wEjVZ21rpDvd+eA4iuuSMVSV/g81NATswursLNI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=av8Rl27PSWviuqhIeAS6UYEwhijGkiQn1Zo0b32mPCcETfvuQDwywlbayqfCJBzmGGepd19BbFKgHh3n2gK8hadVgHrMGEFk/u8DrS0Lj+TPZ9AEiLbMefKxTHt+3pR3rUj7zCmx4mYMvzLFeO1oFeA5LYZY3369eXc7FY/Yokc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lOTi7X2V; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lOTi7X2V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69F19C4CEE7; Thu, 15 May 2025 12:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313216; bh=v63/wEjVZ21rpDvd+eA4iuuSMVSV/g81NATswursLNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lOTi7X2VED/CKwvYP+p0bKz0+glQ/4CsoBRPTxl8buNvdB1TXF2mJPaVyQp506AQQ Lyw5m730UVmcYSlXqEMWELNbF6r/m3gjvBFOjel04cbpoLhnvR2Gq5sCBOXf2QlSVx WgxBY5s7LtY+xP1F/RArEXk/picujXML/6YaGJKLVJZaEC/ZQGnwFNoLpEdQ5hX5Lc F5VGVhRkiW2MulS747aMX0WgZyZjkFAc7IS0vD96O2NemZFkvIqX+HqNrGtt/Brb/e yXNnLEqTOFiSc0CbENjKVEmCTh/ENjJHu8AEh1Plu+9/VJpXkOdaPOnx9xhxpUog5s Hggyy4s9jxAUQ== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org Subject: [PATCH 04/15] bugs/x86: Extend _BUG_FLAGS() with the 'cond_str' parameter Date: Thu, 15 May 2025 14:46:33 +0200 Message-ID: <20250515124644.2958810-5-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Just pass down the parameter, don't do anything with it yet. Signed-off-by: Ingo Molnar Cc: --- arch/x86/include/asm/bug.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index 413b86b876d9..aff1c6b7a7f3 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -39,7 +39,7 @@ =20 #ifdef CONFIG_DEBUG_BUGVERBOSE =20 -#define _BUG_FLAGS(ins, flags, extra) \ +#define _BUG_FLAGS(cond_str, ins, flags, extra) \ do { \ asm_inline volatile("1:\t" ins "\n" \ ".pushsection __bug_table,\"aw\"\n" \ @@ -57,7 +57,7 @@ do { \ =20 #else /* !CONFIG_DEBUG_BUGVERBOSE */ =20 -#define _BUG_FLAGS(ins, flags, extra) \ +#define _BUG_FLAGS(cond_str, ins, flags, extra) \ do { \ asm_inline volatile("1:\t" ins "\n" \ ".pushsection __bug_table,\"aw\"\n" \ @@ -74,7 +74,7 @@ do { \ =20 #else =20 -#define _BUG_FLAGS(ins, flags, extra) asm volatile(ins) +#define _BUG_FLAGS(cond_str, ins, flags, extra) asm volatile(ins) =20 #endif /* CONFIG_GENERIC_BUG */ =20 @@ -82,7 +82,7 @@ do { \ #define BUG() \ do { \ instrumentation_begin(); \ - _BUG_FLAGS(ASM_UD2, 0, ""); \ + _BUG_FLAGS("", ASM_UD2, 0, ""); \ __builtin_unreachable(); \ } while (0) =20 @@ -96,7 +96,7 @@ do { \ do { \ __auto_type __flags =3D BUGFLAG_WARNING|(flags); \ instrumentation_begin(); \ - _BUG_FLAGS(ASM_UD2, __flags, ANNOTATE_REACHABLE(1b)); \ + _BUG_FLAGS(cond_str, ASM_UD2, __flags, ANNOTATE_REACHABLE(1b)); \ instrumentation_end(); \ } while (0) =20 --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0DC0629CB38; Thu, 15 May 2025 12:46:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313219; cv=none; b=XhanvwIIE0d6Xs+/3wiLO3NlyA1cQ6dpiBUU2v2k42UPH95nFVSPOq9/r9yx/lTulEuGDsKgpjhkpAzxwPon+IeFNkRDcdQ8tXOtls7IyUaRB0jQmLf+F9lZrsFhTPPL5YseONREdvvF68V8Oek/voYhfRdAwjw8j6iqZLFf85o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313219; c=relaxed/simple; bh=hA1c0OyENsr1ysGC987MlXCevo9xNowDqcLFfqACaOo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P/Ka4he3fZ3+oSaRCec97c3vt1ea6eyqODydX1Q6SCyPTPBOnjJbo4bIGe/z23N4P+hIRQWPfWvn+Fp8N+xBHGW4roY5ylLs7wHby/1nKVhnGUmvv3nV0TDTvT0V4TF4hb4q4QPwy94kNB7/VFgX5VlusyuBP6YDSgle0MOViAI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b9mQumRm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b9mQumRm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39B0BC4CEEF; Thu, 15 May 2025 12:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313218; bh=hA1c0OyENsr1ysGC987MlXCevo9xNowDqcLFfqACaOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b9mQumRm1F0RMkdDZpcOxAUJ/zoHcaVMMHKBdnkUUnjcaRE7AfE25yeigRdb0cSNz G7pkIDmuGeemx+Bv+r8i8jj7FmRVspQXbXqC9wdtARJc299MQF8mxkloLmEUfKYiih JNfQt3TkEG/SRgo6Pi1kXIOUlDH5dv5l9dnByXbm8E3QEgPLrorMZLE+nwR+ZfptTz KvipShkx1kIQym54LhXQR5UwqtLEc7XA2o4TlcST6rD7WiUTHBWm0uJNceXKn0R6a+ 8lrhA+tPJRFAS2ygm5YqADJVmirww0ISiZkUA0k+ODF8sduKSnJ2wSxwc1U3k/GS9h QTWY0V2RdpeaA== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org Subject: [PATCH 05/15] bugs/x86: Augment warnings output by concatenating 'cond_str' with the regular __FILE__ string in _BUG_FLAGS() Date: Thu, 15 May 2025 14:46:34 +0200 Message-ID: <20250515124644.2958810-6-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" This allows the reuse of the UD2 based 'struct bug_entry' low-overhead _BUG_FLAGS() implementation and string-printing backend, without having to add a new field. An example: If we have the following WARN_ON_ONCE() in kernel/sched/core.c: WARN_ON_ONCE(idx < 0 && ptr); Then previously _BUG_FLAGS() would store this string in bug_entry::file: "kernel/sched/core.c" After this patch, it would store and print: "[idx < 0 && ptr] kernel/sched/core.c" Which is an extended string that will be printed in warnings. Suggested-by: Linus Torvalds Signed-off-by: Ingo Molnar Cc: --- arch/x86/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index aff1c6b7a7f3..8593976b32cb 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -50,7 +50,7 @@ do { \ "\t.org 2b+%c3\n" \ ".popsection\n" \ extra \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__), \ "i" (flags), \ "i" (sizeof(struct bug_entry))); \ } while (0) --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A0CCC29CB56; Thu, 15 May 2025 12:47:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313221; cv=none; b=Pcf+7onA78aQhN2c1uTz0kNB1CzN+0HQd21YmOZcxRcSQbYxAinCgGRo5Dp/bi4XSSn3pII2OJW2WjdeyMQKj88v6ECDXJ3F0vF3wks9OM+gyfMEnFrYEaz/YsjOHJJBpW9Ibelvf3L+/HN1Tv6YagUmFVuNnW/IlLHxxF9ZsrI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313221; c=relaxed/simple; bh=lbZJml6REyBa5Wqf6whljObeSVlpAH/8U8yaPU9LXBQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QbvzVm7kDbHq8048lFBFV1HNjpATdfeWLmkaQLbnM6Yp4WCBEH+XxIvLrfNxZWzQZl5cvrmNPBzUnRMPZaOJClZRkj3dfdGms01GOOouKs9gblRQm4Q24i0IrkyWSo8pkYZXbZTQXssoWKJo6ouEqu5vP5yAF+W2v84hiobCNYA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lvGjfJ3+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lvGjfJ3+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 090E0C4CEE7; Thu, 15 May 2025 12:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313221; bh=lbZJml6REyBa5Wqf6whljObeSVlpAH/8U8yaPU9LXBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lvGjfJ3+EMr+uThtbSsCLWplsyajkQuighLyuqIHxjI/QTGyU5o7NouA+rn+vY1zw 0L0KEvo0UrWNGFIuG45GV2iNuIxDfKoSMSP1cE4VPu+eSQkh4VMiaCTEvBORAAyVLb vd2mi3FCKISGyZHf43JJO/bWvm8JS9pxrQk1AyK1m0N7QoOHcDgjeikARN0j1UvM0V FZG/2msPM1vzG8ods1SSdxYDFr6vgbdY79IdMvaJo//+BL3+Bzhr7CWj+XJuNT2a18 yJkykgWgUD+uhBf9ThEu209dO3XCx1VP49sgM7mUhdDiTfNqswLXC7Jloq3TViA84p J0cPuGFlvvzTA== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org, Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 06/15] bugs/powerpc: Pass in 'cond_str' to BUG_ENTRY() Date: Thu, 15 May 2025 14:46:35 +0200 Message-ID: <20250515124644.2958810-7-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Pass in the condition string from __WARN_FLAGS(), WARN_ON() and BUG_ON(), but don't use it yet. Signed-off-by: Ingo Molnar Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Naveen N Rao Cc: linuxppc-dev@lists.ozlabs.org Cc: --- arch/powerpc/include/asm/bug.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h index 34d39ec79720..b5537ba176b5 100644 --- a/arch/powerpc/include/asm/bug.h +++ b/arch/powerpc/include/asm/bug.h @@ -51,7 +51,7 @@ ".previous\n" #endif =20 -#define BUG_ENTRY(insn, flags, ...) \ +#define BUG_ENTRY(cond_str, insn, flags, ...) \ __asm__ __volatile__( \ "1: " insn "\n" \ _EMIT_BUG_ENTRY \ @@ -67,12 +67,12 @@ */ =20 #define BUG() do { \ - BUG_ENTRY("twi 31, 0, 0", 0); \ + BUG_ENTRY("", "twi 31, 0, 0", 0); \ unreachable(); \ } while (0) #define HAVE_ARCH_BUG =20 -#define __WARN_FLAGS(cond_str, flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WA= RNING | (flags)) +#define __WARN_FLAGS(cond_str, flags) BUG_ENTRY(cond_str, "twi 31, 0, 0", = BUGFLAG_WARNING | (flags)) =20 #ifdef CONFIG_PPC64 #define BUG_ON(x) do { \ @@ -80,7 +80,7 @@ if (x) \ BUG(); \ } else { \ - BUG_ENTRY(PPC_TLNEI " %4, 0", 0, "r" ((__force long)(x))); \ + BUG_ENTRY(#x, PPC_TLNEI " %4, 0", 0, "r" ((__force long)(x))); \ } \ } while (0) =20 @@ -90,7 +90,7 @@ if (__ret_warn_on) \ __WARN(); \ } else { \ - BUG_ENTRY(PPC_TLNEI " %4, 0", \ + BUG_ENTRY(#x, PPC_TLNEI " %4, 0", \ BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), \ "r" (__ret_warn_on)); \ } \ --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0E54D29ACE1; Thu, 15 May 2025 12:47:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313225; cv=none; b=uQiDlsByGfdAn7HZ+wC8tpUqTyCeJwn57FduMLuISPLDaI9aPHgJE2FyD/j9UB5bSTVE7sjIOBc/1XOCZRlRckAsSeLg3BocSLJx7i8ObqeLqvSNUW7hJCV4Ycewo+r+Cd3x5qdSU0ak0kdUS097D2O6epxP/e85/rNBitaXNPs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313225; c=relaxed/simple; bh=jWZIqV+3LcIXkF+SWUyEanhdz9apJ2bmCTUUM4BXA1g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QSGI5i0ArpZJ0dq6i+/dnEfdBXav2QaoJCMbEWRlWo6lCWsK+gOYx5eZsYVW13WBOFy1d70BFoOrJSt7PMgNBHp5WqEItEph1gT+AzlcB5kPyhGhCONxf2lxDecOeHm0kpkvbw6wp2MPU8Ws9iNg44aCPhtVNGoFlFDMFMSkG64= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OEvGwZys; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OEvGwZys" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04102C4CEE7; Thu, 15 May 2025 12:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313224; bh=jWZIqV+3LcIXkF+SWUyEanhdz9apJ2bmCTUUM4BXA1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OEvGwZysIN02LjYSXXXmVSN0DlT0Z8rJM19XbpEJp6apfofkDoVz5X80muuqnLNRq eUyy4ry0rWNu1CxdBK6SuXzyw5NSGmtKp1/p4CdRQTrT9i7tbns6SQuY+MAAqdl3eq Ft30xm6mqwS4EcNzfJtqvnQjBsO1zbNmqN/QZB2WXaggBocc6fTVMTYNIdvAZQWBvf qC6hVVttumbJIFqHjqfr4nrHIeY4e2azXa9wa8n0Ytc2+zjnXKP9DACF2pyCmc1YeV 8uVquPRL9X+oXJE/k9QF02T3U6DqTQx+Z+x0NSECg6KMKai1RFJqnhUL1BTiXEGtAZ Y06sCccK3g9XA== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org, Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 07/15] bugs/powerpc: Concatenate 'cond_str' with '__FILE__' in BUG_ENTRY(), to extend WARN_ON/BUG_ON output Date: Thu, 15 May 2025 14:46:36 +0200 Message-ID: <20250515124644.2958810-8-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Extend WARN_ON and BUG_ON style output from: WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:8511 sched_init+0x20/0x410 to: WARNING: CPU: 0 PID: 0 at [idx < 0 && ptr] kernel/sched/core.c:8511 sched= _init+0x20/0x410 Note that the output will be further reorganized later in this series. Signed-off-by: Ingo Molnar Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Naveen N Rao Cc: linuxppc-dev@lists.ozlabs.org Cc: --- arch/powerpc/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h index b5537ba176b5..171b6b2ba100 100644 --- a/arch/powerpc/include/asm/bug.h +++ b/arch/powerpc/include/asm/bug.h @@ -55,7 +55,7 @@ __asm__ __volatile__( \ "1: " insn "\n" \ _EMIT_BUG_ENTRY \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__), \ "i" (flags), \ "i" (sizeof(struct bug_entry)), \ ##__VA_ARGS__) --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0552129DB86; Thu, 15 May 2025 12:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313227; cv=none; b=AY9M9iQ9/8Nd8xiyHrFWgDkWElW4K77++b/2/55UqpkgWJv7xRytfrXpOJfja09MxuuNfrk41rqSpIII5eOaSZX2ar3LS/9J+KUgJnvYR6xm9T5CdvGY42hbGpqNNNd5mnyxMkKuTbFIdc+F1JG4mCcxWUqZiehdJpsFtAJi2Ic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313227; c=relaxed/simple; bh=AwKLO6MlaTLedN7k+hdE1I2gJG0P/wVaqml4h5jIdvM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ly+Wy/19Wo4hcm4FDjn+uZBjEg/zKrlGoMOzKYrkfiCBzkL1ciXq1Cv34u6JkLLAsECiDCfIHdDRozmmkPBM5Uaf+ru/NToXKTGt18pdsajZGFfMf/KNiO1KS5TFex0WGkMmZtDvknGAOs2Eb3FAuoCbD4lMPBqwUMZ+uyF2f24= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s3GN9FSW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s3GN9FSW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFDB8C4CEEB; Thu, 15 May 2025 12:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313226; bh=AwKLO6MlaTLedN7k+hdE1I2gJG0P/wVaqml4h5jIdvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s3GN9FSWT5BU+aUhkcJEq3h0a46WFComiGq7+G9OywxjtQzPC0jbVOal0OAaMe4xP 9uoa3lo5isjl/5VP5g0xm47HBYYFMlF52TvWn2oC/jUZvyGmwGrorsqx7d3Dr1o339 0L0imSC0xIJAWBOg9Nm+/Px3WpD1mtFsPaGCQF4QvMv2+mmJMrpTUZ/OrDPkky16BV 7wUGJvi5FwfbiL4XPNBbqPwtBRy2PwRHSUB45f8diPmO/QhON+QYh+rjhoz8S/hU38 uY75fPQM8FdVpm9R8Jz7DI/zb14Ks1kmRrPOYXTrEQzOREX0DecZIiW++d0jl33WId oXVPIN3A+dCow== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org, Huacai Chen , WANG Xuerui , Josh Poimboeuf Subject: [PATCH 08/15] bugs/LoongArch: Pass in 'cond_str' to __BUG_ENTRY() Date: Thu, 15 May 2025 14:46:37 +0200 Message-ID: <20250515124644.2958810-9-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Pass in the condition string from __WARN_FLAGS(), but don't use it yet. Signed-off-by: Ingo Molnar Cc: Huacai Chen Cc: WANG Xuerui Cc: Peter Zijlstra Cc: Josh Poimboeuf Cc: --- arch/loongarch/include/asm/bug.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/loongarch/include/asm/bug.h b/arch/loongarch/include/asm/= bug.h index 51c2cb98d728..3c377984457d 100644 --- a/arch/loongarch/include/asm/bug.h +++ b/arch/loongarch/include/asm/bug.h @@ -20,39 +20,38 @@ #endif =20 #ifndef CONFIG_GENERIC_BUG -#define __BUG_ENTRY(flags) +#define __BUG_ENTRY(cond_str, flags) #else -#define __BUG_ENTRY(flags) \ +#define __BUG_ENTRY(cond_str, flags) \ .pushsection __bug_table, "aw"; \ .align 2; \ 10000: .long 10001f - .; \ _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \ - .short flags; \ + .short flags; \ .popsection; \ 10001: #endif =20 -#define ASM_BUG_FLAGS(flags) \ - __BUG_ENTRY(flags) \ +#define ASM_BUG_FLAGS(cond_str, flags) \ + __BUG_ENTRY(cond_str, flags) \ break BRK_BUG; =20 -#define ASM_BUG() ASM_BUG_FLAGS(0) +#define ASM_BUG() ASM_BUG_FLAGS("", 0) =20 -#define __BUG_FLAGS(flags, extra) \ - asm_inline volatile (__stringify(ASM_BUG_FLAGS(flags)) \ - extra); +#define __BUG_FLAGS(cond_str, flags, extra) \ + asm_inline volatile (__stringify(ASM_BUG_FLAGS(cond_str, flags)) extra); =20 #define __WARN_FLAGS(cond_str, flags) \ do { \ instrumentation_begin(); \ - __BUG_FLAGS(BUGFLAG_WARNING|(flags), ANNOTATE_REACHABLE(10001b));\ + __BUG_FLAGS(cond_str, BUGFLAG_WARNING|(flags), ANNOTATE_REACHABLE(10001b)= );\ instrumentation_end(); \ } while (0) =20 #define BUG() \ do { \ instrumentation_begin(); \ - __BUG_FLAGS(0, ""); \ + __BUG_FLAGS("", 0, ""); \ unreachable(); \ } while (0) =20 --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C865B29DB86; Thu, 15 May 2025 12:47:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313230; cv=none; b=kk9Bhnf9LgGN8gJ23cCqbuGcYOPIqtoleGOipd8ggPQgk1iIC/brG9B2F75uZdbOJfjQovVkl97KeFdmO8BZUPsaJuyPDHqVNPhOi5qNylJZlxINWaVCW6MITM61dLB/It4jpo/ZUThqPJBk1W/K/xnJB8uypk2erEfdQm5cZuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313230; c=relaxed/simple; bh=LeJR/zvlqj5Asj/nQfg1x5VrUEA2v3eAMcSq5/MpbRw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NjQ7R+4FTGSUnJ5gw1Bn/yW0mqVPBErZy6vI8o1hth1ZM5EG/+t/CvMOidRtOtIGN5zvjJtQw7CBc21gT9dfHpiobt3FfVUmxnI37TQrOWoSfx7MCUVBXjD4xUzacPqYEKq8dsdZ/3ncwgTRYyQrW3Lue6817e3lz3E5FgK9GLg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gdcZpvpm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gdcZpvpm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B54AC4CEE7; Thu, 15 May 2025 12:47:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313229; bh=LeJR/zvlqj5Asj/nQfg1x5VrUEA2v3eAMcSq5/MpbRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gdcZpvpmOGhPzvmOFOQWvJ63XmLv2pUBNt3ajACDolPLQWBEkwtHpx1hxEPFWBo4P htIbJ2GjdbMWquhYSeDK6bLqf5sJqFyuCdCTPch1xbGxJcE86eesZd8ptvoKiC2MuB G70YFdeRns32sbyezhV+P6GxmtINs6cgvscTBJYNR8A/lUxZ4Sf3dOha+xcKAxRbyT TgI43IriwRJatGqS1O9giwXunijyF38O2BG9h0G1fT3MGT5wm6JkG4ddo6impOc2Tp PKWXAXVRBkaY/rcAUoErSBxwVrmHl7pkqfpC9H7MSTdKTG2ZeopiVP5ulO+0KOfmkK L4kGbHK2RlPsw== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org, Huacai Chen , WANG Xuerui , Josh Poimboeuf Subject: [PATCH 09/15] bugs/LoongArch: Concatenate 'cond_str' with '__FILE__' in __BUG_ENTRY(), to extend WARN_ON/BUG_ON output Date: Thu, 15 May 2025 14:46:38 +0200 Message-ID: <20250515124644.2958810-10-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Extend WARN_ON and BUG_ON style output from: WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:8511 sched_init+0x20/0x410 to: WARNING: CPU: 0 PID: 0 at [idx < 0 && ptr] kernel/sched/core.c:8511 sched= _init+0x20/0x410 Note that the output will be further reorganized later in this series. Signed-off-by: Ingo Molnar Cc: Huacai Chen Cc: WANG Xuerui Cc: Peter Zijlstra Cc: Josh Poimboeuf Cc: --- arch/loongarch/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/loongarch/include/asm/bug.h b/arch/loongarch/include/asm/= bug.h index 3c377984457d..cad807b100ad 100644 --- a/arch/loongarch/include/asm/bug.h +++ b/arch/loongarch/include/asm/bug.h @@ -26,7 +26,7 @@ .pushsection __bug_table, "aw"; \ .align 2; \ 10000: .long 10001f - .; \ - _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \ + _BUGVERBOSE_LOCATION(WARN_CONDITION_STR(cond_str) __FILE__, __LINE__) \ .short flags; \ .popsection; \ 10001: --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 65B6529E05C; Thu, 15 May 2025 12:47:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313232; cv=none; b=Gu9lohIbjnkz64S9WFGWzxnEwPm3KJ1aQuk5YJ6waeV9KJIV8tqRVv2VxrzQ2ICOAZfulBgMa/InZlqcQ3GeiZYWglx/SM90bVpahfJtjva1P8hOuPNqvS3HNkYH2XtXnHRlrUmaq/ankNWiQeH6C2xNmoUlMTAav9WBga6zaf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313232; c=relaxed/simple; bh=D0EBAcu5h+E8B+tSkeOpT9HaAEV4VC97bQRYTcVTptc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZKMz9D+nbgKixKTyYrQtSuVHmeIFdTKxpzEMk4vRESRpf46NXBDH+PH3p7LqP05/hWC+YhOc0r8gjKWC+ChFDKc8U6fsO+dRhJA6mpFMZzLZsvMHH0LgkhPeicNFOtg4ktFXAiOjOlsIl1klYSIFoY2Z2UaM8WLf/MLHDjJ0htk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rlfS+X5g; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rlfS+X5g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBFECC4CEEF; Thu, 15 May 2025 12:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313232; bh=D0EBAcu5h+E8B+tSkeOpT9HaAEV4VC97bQRYTcVTptc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rlfS+X5gFWhHhd1X1XTm2EOkA5pS93fd1FTpXpCBkg+SeNumUIYdVn/cpOfzaeSnn GQA91Xsy0GMeGm/JML5N9prRQC+/G4l4qjYL594QjNToryitMtiNZf6XMoWROyby18 4DrkillrNGWgpwwh4soauzXwiJcJBh87Jqwe6tJ6VYfu+L9gVTaJpdaoHFxTa9FEmd lOjNerM0XD5HMMfbbsbBAR0qR5Dggo9z2xBXw5jv2vScx6BmXn6Sd0qXCbHfWfSNqk BX5OoJOupmkMNLP8bslLyNjKhMycSCz8ksp6vfA4+YRwVyqYHQos4/dJj4BJjJaqob R3Afx5boKunXA== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , linux-s390@vger.kernel.org Subject: [PATCH 10/15] bugs/s390: Pass in 'cond_str' to __EMIT_BUG() Date: Thu, 15 May 2025 14:46:39 +0200 Message-ID: <20250515124644.2958810-11-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Pass in the condition string from __WARN_FLAGS(), but do not concatenate it with __FILE__, because the __bug_table is apparently indexed by 16 bits and increasing string size overflows it on defconfig builds. Signed-off-by: Ingo Molnar Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Alexander Gordeev Cc: Christian Borntraeger Cc: Sven Schnelle Cc: linux-s390@vger.kernel.org Cc: --- arch/s390/include/asm/bug.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h index ef3e495ec1e3..30f8785a01f5 100644 --- a/arch/s390/include/asm/bug.h +++ b/arch/s390/include/asm/bug.h @@ -8,7 +8,7 @@ =20 #ifdef CONFIG_DEBUG_BUGVERBOSE =20 -#define __EMIT_BUG(x) do { \ +#define __EMIT_BUG(cond_str, x) do { \ asm_inline volatile( \ "0: mc 0,0\n" \ ".section .rodata.str,\"aMS\",@progbits,1\n" \ @@ -27,7 +27,7 @@ =20 #else /* CONFIG_DEBUG_BUGVERBOSE */ =20 -#define __EMIT_BUG(x) do { \ +#define __EMIT_BUG(cond_str, x) do { \ asm_inline volatile( \ "0: mc 0,0\n" \ ".section __bug_table,\"aw\"\n" \ @@ -42,12 +42,12 @@ #endif /* CONFIG_DEBUG_BUGVERBOSE */ =20 #define BUG() do { \ - __EMIT_BUG(0); \ + __EMIT_BUG("", 0); \ unreachable(); \ } while (0) =20 #define __WARN_FLAGS(cond_str, flags) do { \ - __EMIT_BUG(BUGFLAG_WARNING|(flags)); \ + __EMIT_BUG(cond_str, BUGFLAG_WARNING|(flags)); \ } while (0) =20 #define WARN_ON(x) ({ \ --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 334F22BCF43; Thu, 15 May 2025 12:47:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313235; cv=none; b=fQZRbaV6mg2j86AWzV2Jdb83AxYN7N6bVragP8uVO0VNyI9vUcZzhTTs3QSdoNaR/4XzOgJPHjzOXwtwmXO7FH6MDTo4ros3hV6u+fmYTPIBdXWJy4sOa129E8c+rR+tdiMpqTyBAN9TGnYGgamsT7DSIuT7wfM5haqbTZp+cys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313235; c=relaxed/simple; bh=molGG3aPYi74hz9WVuXlbE1iJFE0MWmpVUKVIij8Ws4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LYEs94xTlsFloRprm2lhMJ6NuJSfulRURkUzYSc6fumbjjNwEb/flbupXRMcBsYsWWUSSqmDqE8C4bjlWEKQW21MU19vAos7aq992S+qhLPdbDKmuNXcgFEvLjfKinvFdxARh/2opt95X/SCiaZQ9V9CuNkL1eO3m9JYsExtNeQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HexE5Eej; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HexE5Eej" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBECAC4CEEB; Thu, 15 May 2025 12:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313235; bh=molGG3aPYi74hz9WVuXlbE1iJFE0MWmpVUKVIij8Ws4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HexE5EejAosqid8JNqxH9pMJdNWnmOwh5C25ih8nPZirXfRTH5rFM+vh2twGdKLdL aDgn+QSpoPhRyZ3LaqK6Tj8HsarJT4LqlVL+Oq0WjZliiZT9BPsAsEfILBYKepZcIL 09XZndnuz/sB8iaazKI/kGQ2avI6mjZY1hxWaXYTLYc4XNrbXJEL6mqcVF52vZFjKR sPFrqFqYyd1+Mjzr7KXVUb3hnX3tbDoLW4wreJaqvsFQh1W/WlbX4/Zqy9h+ZXLwDB 5mIOJ7SDVdKWEKzUF4jPk+Wk1aTbuPU/VW5co2u75mTDNhwAP0mKnHYp3V/rdlUrbs nbbM4NX7VNCeA== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , linux-riscv@lists.infradead.org Subject: [PATCH 11/15] bugs/riscv: Pass in 'cond_str' to __BUG_FLAGS() Date: Thu, 15 May 2025 14:46:40 +0200 Message-ID: <20250515124644.2958810-12-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Pass in the condition string from __WARN_FLAGS() to __BUG_FLAGS(), but don't use it yet. Signed-off-by: Ingo Molnar Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Albert Ou Cc: Alexandre Ghiti Cc: linux-riscv@lists.infradead.org Cc: --- arch/riscv/include/asm/bug.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/riscv/include/asm/bug.h b/arch/riscv/include/asm/bug.h index b22ee4d2c882..feaf456d465b 100644 --- a/arch/riscv/include/asm/bug.h +++ b/arch/riscv/include/asm/bug.h @@ -50,7 +50,7 @@ typedef u32 bug_insn_t; #endif =20 #ifdef CONFIG_GENERIC_BUG -#define __BUG_FLAGS(flags) \ +#define __BUG_FLAGS(cond_str, flags) \ do { \ __asm__ __volatile__ ( \ "1:\n\t" \ @@ -66,17 +66,17 @@ do { \ "i" (sizeof(struct bug_entry))); \ } while (0) #else /* CONFIG_GENERIC_BUG */ -#define __BUG_FLAGS(flags) do { \ +#define __BUG_FLAGS(cond_str, flags) do { \ __asm__ __volatile__ ("ebreak\n"); \ } while (0) #endif /* CONFIG_GENERIC_BUG */ =20 #define BUG() do { \ - __BUG_FLAGS(0); \ + __BUG_FLAGS("", 0); \ unreachable(); \ } while (0) =20 -#define __WARN_FLAGS(cond_str, flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags)) +#define __WARN_FLAGS(cond_str, flags) __BUG_FLAGS(cond_str, BUGFLAG_WARNIN= G|(flags)) =20 #define HAVE_ARCH_BUG =20 --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 02CF72BCF67; Thu, 15 May 2025 12:47:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313238; cv=none; b=OqyR6QRMHMl7gT1aPa9oXgqLPUfzG9u1/PAIWYP8z0TPaa1RRV+/JuXwdjFYi66IVQc2wNYW5boryZBYikE43E4siQkPPyXFn71VV/f2DvNElYn5M34JinoKGnkh1Z7CK2ugkWmCRRPH3n7/hMYwN+P3eaRvMB6XjYNoWFcZORI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313238; c=relaxed/simple; bh=9LwOHpGDLFZKgszWtNvO5DQHvwl986zoPmxZXPECuAg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PFHMFr/pKunYR7diqi3xctKEWarrxupoJ1OZ7Xq6STnutVgI+DoS38AHIhZv1Svj/KyhexVqDBbio8OUXVtIJesjALQzqzT8EwR4BXDnOYRaQrjatGiINSRZdd7EWNXgpDNulKJkktk5fbjo5EJnabayDY2Ylx6yWsfHSYiTuiM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H3Oo7c4a; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H3Oo7c4a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DF63C4CEEB; Thu, 15 May 2025 12:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313237; bh=9LwOHpGDLFZKgszWtNvO5DQHvwl986zoPmxZXPECuAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3Oo7c4aQqjCA0KblghIzrcJ/6KL1ZnahcRyERc/zXDuFT2ljlqfEEv/ldVmgTY9E r0HEhNxXv2ElHClBjIhqubLRhaDl7I6Vne0bHOe/0f7cLAMKycdBs971+Ksujwczia DiqHS5fnebXHIZmD6Moq+Pq7QJnuD1/XWecHt+ztdaNW/FIdLp5UBPiIs+sZUcy6Dd BHezXDc+vNyWMYIfULQ6rZ6rswutj7DDWc7Wq0NyDwG6SVmlqsIZ2JacvuCYlM74v9 PuH/LmG8BzA5IKvcdaSTtvPatnlsWY8Wxg6h6XXso8YetINcAY8U8Xl70vleN61gf8 vwXAw0KFqzPeQ== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , linux-riscv@lists.infradead.org Subject: [PATCH 12/15] bugs/riscv: Concatenate 'cond_str' with '__FILE__' in __BUG_FLAGS(), to extend WARN_ON/BUG_ON output Date: Thu, 15 May 2025 14:46:41 +0200 Message-ID: <20250515124644.2958810-13-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Extend WARN_ON and BUG_ON style output from: WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:8511 sched_init+0x20/0x410 to: WARNING: CPU: 0 PID: 0 at [idx < 0 && ptr] kernel/sched/core.c:8511 sched= _init+0x20/0x410 Note that the output will be further reorganized later in this series. Signed-off-by: Ingo Molnar Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Albert Ou Cc: Alexandre Ghiti Cc: linux-riscv@lists.infradead.org Cc: Tested-by: Alexandre Ghiti # riscv --- arch/riscv/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/bug.h b/arch/riscv/include/asm/bug.h index feaf456d465b..da9b8e83934d 100644 --- a/arch/riscv/include/asm/bug.h +++ b/arch/riscv/include/asm/bug.h @@ -61,7 +61,7 @@ do { \ ".org 2b + %3\n\t" \ ".popsection" \ : \ - : "i" (__FILE__), "i" (__LINE__), \ + : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__), \ "i" (flags), \ "i" (sizeof(struct bug_entry))); \ } while (0) --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 65F702BD01D; Thu, 15 May 2025 12:47:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313240; cv=none; b=JEhVMcv6adUZ0KdW7xJPGRmjVXILMOXS9p322i7WdtFsOFTRQoCAEkSiVIHA2SQk65DHonkjYZjufxUDDHP0sXkcBg/ZXEFzH7NuaCGEhjAK74PmXsjCSitIrq1GTcBwsw7KiknLb7rpxATiMnQPHfg00FcM6O8Cu1H6NC6g0gw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313240; c=relaxed/simple; bh=gns3qHyFehNLw8d4OgScz4caW7RxNFoQ8sFgnpdZIDI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cUumaLvwO1YCvrdlfhFy/8z4vvEMDKRqaJaP3LksN6K8+rL8xsVwEkHBG4mlyoPV654nwpgqUWROrhJ4/Z1a6U+7e/F3KbbCm8pPySorpdXPa/yNmFJyNUhhf0UHqRwYVCFAbLCGVjBDP6An3MfHj8R+mpkBEe4IkjBm2LV7KUg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CrubKjyL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CrubKjyL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E574C4CEE7; Thu, 15 May 2025 12:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313240; bh=gns3qHyFehNLw8d4OgScz4caW7RxNFoQ8sFgnpdZIDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CrubKjyL0gOO+AZYdBbsxXybrsOaI2be4LQ3fw1FEDimSavGetTGBB8iqft0t8w3b 6i35D+ZVYc2EpG3l2zGYaMuvr21hkCwlScnRWKzvdD2TF2o0WF/Ew/WH9oupXH5s4K tB2NfAuQcXoAC4AIQHmBI9RS54p1v6O77+4z/xUzT5eG1P3xmR5rOlIaMbSoDvGdsz yNC/hX/hU0dSl0HgZ4apkixLiGS7FrQMJN7wHv6K4D95LUI57BvMI8UOh6uf0vT75r Jp5WgXY8wdbIbJNquLE9kkMwBqSofibL0LofoWyVeuI6wAkfgIoHVuOozf57pt5nac r08ybrgeWqIfQ== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org, "James E.J. Bottomley" , Helge Deller , linux-parisc@vger.kernel.org Subject: [PATCH 13/15] bugs/parisc: Concatenate 'cond_str' with '__FILE__' in __WARN_FLAGS(), to extend WARN_ON/BUG_ON output Date: Thu, 15 May 2025 14:46:42 +0200 Message-ID: <20250515124644.2958810-14-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Extend WARN_ON and BUG_ON style output from: WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:8511 sched_init+0x20/0x410 to: WARNING: CPU: 0 PID: 0 at [idx < 0 && ptr] kernel/sched/core.c:8511 sched= _init+0x20/0x410 Note that the output will be further reorganized later in this series. Signed-off-by: Ingo Molnar Cc: "James E.J. Bottomley" Cc: Helge Deller Cc: linux-parisc@vger.kernel.org Cc: Acked-by: Helge Deller --- arch/parisc/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h index 1a87cf80ec3c..5aa1623e4f2f 100644 --- a/arch/parisc/include/asm/bug.h +++ b/arch/parisc/include/asm/bug.h @@ -61,7 +61,7 @@ "\t.short %1, %2\n" \ "\t.blockz %3-2*4-2*2\n" \ "\t.popsection" \ - : : "i" (__FILE__), "i" (__LINE__), \ + : : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__), \ "i" (BUGFLAG_WARNING|(flags)), \ "i" (sizeof(struct bug_entry)) ); \ } while(0) --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 70DCE2BD01D; Thu, 15 May 2025 12:47:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313243; cv=none; b=tAE6LutD84PjmqwzXg/q4xS78PR+paT65UCllqJJ3Wt53BmVURBnFjpzZrQbTDYK8Q8IEXbbWKVaMhoJoEZVPgB1Byuj5zL3Pohr5wwKiMFt2xj481KUxKYFx2Y2HxqhvMewxqKh1dPOCdX+msuFrFSxP4qMFMQhD1qhF8LhifA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313243; c=relaxed/simple; bh=9dOa5FJa50VZuoyhOr1m0v8KpFixv0MsGbwBXNojatQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rg87II14PWSQ8QW+kokzDshUPwJBt6nRBdKpt20jJp5rHpyqRXpvg63hdChvZkeb+QSRcj0rYMwXoXqazm6Znc+0ZVh9T0KmKp7RiO+ZVlI14GkPVIR3U6JTBUEB+61+jnWrywx1Y91O6/jVNFpPaMaL5RcQJha03VX/BvV4s0g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tCUREwYl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tCUREwYl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE009C4CEF0; Thu, 15 May 2025 12:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313242; bh=9dOa5FJa50VZuoyhOr1m0v8KpFixv0MsGbwBXNojatQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tCUREwYlMVwmOW5TQVoGUh9ScohKkWrvCDCIuVjD3N7GfmSPNssOw16tnHLq2/644 XxxmQGmGWF64DRkcOPvP7tgMiEWneTOEcb117fK/fUiG3eSpHRHAJ3YqeXp7KOpuSV pq+Z8GKP9uWT+40iGtZs2yKoHsAZLd8cfibc24Hnx6GwQqYhN7KAz10yNc8l9KCj79 giDmhEp1Ah5ntADJaUR3+CAFMk3iUJPMS8FMUxi+VxhKrCt2ad2ypr9cvWtiQke9cU mKGo4VOKmR9l0rlBoT0jGS99PVs6ai4qZ4UVsKqCYcDveyMOaJsjKlLt8exqHRn+Cl dvKdYjJQmWtRA== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org, Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org Subject: [PATCH 14/15] bugs/sh: Concatenate 'cond_str' with '__FILE__' in __WARN_FLAGS(), to extend WARN_ON/BUG_ON output Date: Thu, 15 May 2025 14:46:43 +0200 Message-ID: <20250515124644.2958810-15-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" Extend WARN_ON and BUG_ON style output from: WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:8511 sched_init+0x20/0x410 to: WARNING: CPU: 0 PID: 0 at [idx < 0 && ptr] kernel/sched/core.c:8511 sched= _init+0x20/0x410 Note that the output will be further reorganized later in this series. Signed-off-by: Ingo Molnar Cc: Yoshinori Sato Cc: Rich Felker Cc: John Paul Adrian Glaubitz Cc: linux-sh@vger.kernel.org Cc: Reviewed-by: John Paul Adrian Glaubitz --- arch/sh/include/asm/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h index 834c621ab249..891276687355 100644 --- a/arch/sh/include/asm/bug.h +++ b/arch/sh/include/asm/bug.h @@ -59,7 +59,7 @@ do { \ _EMIT_BUG_ENTRY \ : \ : "n" (TRAPA_BUG_OPCODE), \ - "i" (__FILE__), \ + "i" (WARN_CONDITION_STR(cond_str) __FILE__), \ "i" (__LINE__), \ "i" (BUGFLAG_WARNING|(flags)), \ "i" (sizeof(struct bug_entry))); \ --=20 2.45.2 From nobody Fri Dec 19 22:01:03 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 331252BD599; Thu, 15 May 2025 12:47:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313245; cv=none; b=Q3Mc3zgd/4Wav07QEh1l+KX2GQLo4RiuIju5plHFDw477/WHS7fLC1fX/wBCERRSw8AVQ7muUqNAGtEwJmoIrzL3OhqVQA6bPPnwREpRdh+CoRc+8G7AQCpu/L35zr0+n5LdbmtVgl5RlT+opDajmciq7XEb7mb4wqaEk3UJSQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747313245; c=relaxed/simple; bh=kORrG9EAFiE5Ir3BGCvLe+XHB6B3NqvA0AZg108fjMo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EFy7S4A/cODXeGVjvPz3Rh5FDTLWzjjJcg+W1d+CH0MaFuuvb5Hvuxe34RpHn8YlXJLqqIAHIyYseW8alU7uFnHanLcQTpXeRLbaLQSPpfXTEo4l38QF7jFzO3lcWECIaUkFgzfhmVJ5wmWxg2LOYvV1LoZ/W3mqMusZxz/4bFM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i1aljM3L; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i1aljM3L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D43AC4CEE7; Thu, 15 May 2025 12:47:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747313244; bh=kORrG9EAFiE5Ir3BGCvLe+XHB6B3NqvA0AZg108fjMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i1aljM3L5gSWJbRhNyJ8p9AThS0NMm/qxhkqJ/ZxUCcKCfg6eO22J7CTot3XRudEy CUfvGdP6u/qFWGreLcUuL6n3h1lFqCu6Z3CBjuVbwENSFh0oJB63ydGrYaCZA2AfE5 qx1r+djZE/tSLeI+PB3Z83AieIZISAbs1ndTww+m7FPWyPykNfAWky8vUIC1J5yNY/ nRAtH3VS6o4evHuUp+SFdAV64hgbcxRiQyTgmvXz72ohkiANy7x/jffF/Rr2saSJ+H 1CHDmul038q5K5ekRooWISB8HZNjpXtqiBz8cF+xdaZ03ies3VKkGdj4MaBC889COG F/g4QbuvBXJXA== From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Linus Torvalds , Peter Zijlstra , linux-arch@vger.kernel.org Subject: [PATCH 15/15] bugs/core: Reorganize fields in the first line of WARNING output, add ->comm[] output Date: Thu, 15 May 2025 14:46:44 +0200 Message-ID: <20250515124644.2958810-16-mingo@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250515124644.2958810-1-mingo@kernel.org> References: <20250515124644.2958810-1-mingo@kernel.org> 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" With the introduction of the condition string as part of the 'file' string output of kernel warnings, the first line has become a bit harder to read: WARNING: CPU: 0 PID: 0 at [ptr =3D=3D 0 && 1] kernel/sched/core.c:8511 s= ched_init+0x20/0x410 Re-order the fields by importance (higher to lower), make the 'at' meaningf= ul again, and add '->comm[]' output which is often more valuable than a PID. Also, remove the 'PID' prefix - in combination with comm it's clear what it= is. These changes make the output only slightly longer: WARNING: [ptr =3D=3D 0 && 1] kernel/sched/core.c:8511 at sched_init+0x20= /0x410 CPU#0: swapper/0 While adding more information and making it better organized. Signed-off-by: Ingo Molnar Cc: --- kernel/panic.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/kernel/panic.c b/kernel/panic.c index a3889f38153d..f03fffca7bcb 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -725,13 +725,15 @@ void __warn(const char *file, int line, void *caller,= unsigned taint, =20 disable_trace_on_warning(); =20 - if (file) - pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n", - raw_smp_processor_id(), current->pid, file, line, - caller); - else - pr_warn("WARNING: CPU: %d PID: %d at %pS\n", - raw_smp_processor_id(), current->pid, caller); + if (file) { + pr_warn("WARNING: %s:%d at %pS, CPU#%d: %s/%d\n", + file, line, caller, + raw_smp_processor_id(), current->comm, current->pid); + } else { + pr_warn("WARNING: at %pS, CPU#%d: %s/%d\n", + caller, + raw_smp_processor_id(), current->comm, current->pid); + } =20 #pragma GCC diagnostic push #ifndef __clang__ --=20 2.45.2