From nobody Tue Dec 2 02:42:56 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 A9A133019C3 for ; Tue, 18 Nov 2025 07:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763451248; cv=none; b=cWKNf1ZtTKDqgPiQTHVs3ACgdeqfvP44j5nkrRBr5ATHgyJBxYKNiSOqEDbU3MmxITW5CQ8fghCSS1qgHuk6lgiUHxY14rq2Ifm+zTqNbAaaJFGzjfAlSwlQDVKzt1ZXefAY9VoOcs9lRynJfJQ+6bmB4QK9XQ94UpP6aMOvAPQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763451248; c=relaxed/simple; bh=9CSTYrQpcHeXQQVw5AemyWK1ijkZ/8CooKnxf1PEnuI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a5C79IqO7hVa8zLPjItVKxFJ6hhKcj4j1/xht/18yvhyhrWxNOdj8svRm4i6u8ihG5vw+aivz9YpbJQKSNfIy5yfptpkbgg8puhUT1zRLsm61+nTqRjDyChH/u7MJ/tT4YfesSWASWIgl7viycpNjYMC1Vr0Fo4OLK6JCOpLBDY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=xkQIR3bj; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=9kHjLsPU; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xkQIR3bj"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="9kHjLsPU" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763451245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ld9fSLpAHyt1kBCSx74gIBVqa5qVyDCPZxQV8wdSUL0=; b=xkQIR3bjC7qNKZkoueHM7VP4Swn3y+NgY9NxZLFkEkrID2o8KSje6XRPaCBTTg2h7N3y5C KjwOoi/JTzJ1Pjawpuj/xFTPSRC52YabsdvvbX7pWns2XwCPho1ePRoqDy9SSaszMtQ/4n H2FcbuebCg5EYognxb4nyhnj0K4TnSylIVk0g8EP3B19peNtJrIJC6iVOBueLe7PK1AODf /nB9kXYeemeMI+NDmMT483SZuttuCkrkvWpDsFMIoaxKMJw6lsbMnXlqxDVNy3TvZjUew3 tda/gMNikr/SO26l4qtkwuYzd8inMQl2Q8+P0Ce8l7Sc3UMM3AodDSUS2ZLBpg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763451245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ld9fSLpAHyt1kBCSx74gIBVqa5qVyDCPZxQV8wdSUL0=; b=9kHjLsPU7NvohZz0ohm6P5NLINbXYCI25HFKNlCPgeYXsdZeIXyaRLstR2GJfc7lXo+str jZ8157Oh8eIAVYDg== Date: Tue, 18 Nov 2025 08:34:01 +0100 Subject: [PATCH 1/2] jump_label: use ATOMIC_INIT() for initialization of .enabled Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251118-jump_label-cleanup-v1-1-440a424d7282@linutronix.de> References: <20251118-jump_label-cleanup-v1-0-440a424d7282@linutronix.de> In-Reply-To: <20251118-jump_label-cleanup-v1-0-440a424d7282@linutronix.de> To: Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763451242; l=2445; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=9CSTYrQpcHeXQQVw5AemyWK1ijkZ/8CooKnxf1PEnuI=; b=BzNJfbEl+GO7lH9/jTABQPSC7ibHsw6CX5Vv49q4mYt5aFN9Th4x4WiI3frqvxXaZuoUQrEFo /7WpaZn9OJvA3hl05zDBQgFOBGI4T9+jPBOn4ZBDbVraleYQ94UrkJf X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Currently ATOMIC_INIT() is not used because in the past that macro was provided by linux/atomic.h which is not usable from linux/jump_label.h. However since commit 7ca8cf5347f7 ("locking/atomic: Move ATOMIC_INIT into linux/types.h") the macro only requires linux/types.h. Remove the now unnecessary workaround and the associated assertions. Signed-off-by: Thomas Wei=C3=9Fschuh --- include/linux/jump_label.h | 11 ++--------- kernel/jump_label.c | 9 --------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index fdb79dd1ebd8c4e79bc03068393fed27ca8a6e05..e494b360d36da49ac4ce1cb3a32= d50c34e2e3e42 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -238,18 +238,11 @@ extern void static_key_enable_cpuslocked(struct stati= c_key *key); extern void static_key_disable_cpuslocked(struct static_key *key); extern enum jump_label_type jump_label_init_type(struct jump_entry *entry); =20 -/* - * We should be using ATOMIC_INIT() for initializing .enabled, but - * the inclusion of atomic.h is problematic for inclusion of jump_label.h - * in 'low-level' headers. Thus, we are initializing .enabled with a - * raw value, but have added a BUILD_BUG_ON() to catch any issues in - * jump_label_init() see: kernel/jump_label.c. - */ #define STATIC_KEY_INIT_TRUE \ - { .enabled =3D { 1 }, \ + { .enabled =3D ATOMIC_INIT(1), \ { .type =3D JUMP_TYPE_TRUE } } #define STATIC_KEY_INIT_FALSE \ - { .enabled =3D { 0 }, \ + { .enabled =3D ATOMIC_INIT(0), \ { .type =3D JUMP_TYPE_FALSE } } =20 #else /* !CONFIG_JUMP_LABEL */ diff --git a/kernel/jump_label.c b/kernel/jump_label.c index 7cb19e6014266adb2d38d49ad0806766895c58b0..e851e4b37d0efcfc97eac5a81d1= 987ed32922b91 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c @@ -529,15 +529,6 @@ void __init jump_label_init(void) struct static_key *key =3D NULL; struct jump_entry *iter; =20 - /* - * Since we are initializing the static_key.enabled field with - * with the 'raw' int values (to avoid pulling in atomic.h) in - * jump_label.h, let's make sure that is safe. There are only two - * cases to check since we initialize to 0 or 1. - */ - BUILD_BUG_ON((int)ATOMIC_INIT(0) !=3D 0); - BUILD_BUG_ON((int)ATOMIC_INIT(1) !=3D 1); - if (static_key_initialized) return; =20 --=20 2.51.0 From nobody Tue Dec 2 02:42:56 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 21FB3304BD6 for ; Tue, 18 Nov 2025 07:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763451248; cv=none; b=sHQN6Vp8RDf5tTW5kpjTL+yjYNdQg0msDReUeJ2b913gAoEC39wxA6bgUktvOMUZ0GAz9mDMLFy1DpqNx3GT6X2ABgwMj2VB/LiyB7oNrDBHTUBpk0ictYJvn1m+7spbN4dgopVqvYRVFuKnp/VBP1la0/WvVXeiaSJvYzOR6yE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763451248; c=relaxed/simple; bh=RrY0awXkyHZxD/KovCSibv7UMWM/S+6zq58Mm5Qbx5E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PN5OPlfLTGxdIONTMFgHWmkr17eaezaAjK20Z2QJnPf1h7FnP9Q+YFo3o1kVuiMoCF98n1xYD5dOEFyEYEh9LqWUpeT598I9e4BUNeR/aswR6/Z1QiTf8YWCOpFVUbVmfS6J8P8rlp1mzRz1KrmU/1OvTMWyOy1DyltjDao+wF8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=OSeGYbte; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=CwzdWHw1; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="OSeGYbte"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="CwzdWHw1" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1763451245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NKd6vGP8CLke0WT+gSl7xEdROmP+nf4ZhA3q0h/TiKo=; b=OSeGYbteeXqEaLV9cCT25QT9uCvKsWZwV89Ll8gkJN72hQ51EyfpHUzDpXsxDfCE3zj0AC 2tUAxfMU2Sj8qtOP94KK6gxTYcnuYxn2P0kDPds1zNjlSr1cQHoredNkRzXkPjQzd92KUM w2jNvvep3MJpSaZDEF68ZGntnfxjo3DWQPzoeRtr8/O8fUdUyFltZSENcL8/PdkEFu5J1J 2wFQ2Mcz44B15WsB0JgqW6Yyg9Sf9C1BgztLzjqNocs50t/SeJZLeqXcR1iMteIdzUIjpe rX8Dv4IL9raGZ8WQsr2/I10EyFwwxL5Ca92BsC0g/fqUyD1fWMQKBiXz4Wpxog== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1763451245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NKd6vGP8CLke0WT+gSl7xEdROmP+nf4ZhA3q0h/TiKo=; b=CwzdWHw1MA7b0slah+oduXRnOzDrCAG+4LfkK3/hugHfEcTCn7FRvEdJMYmssgY5SG3stU OtMWJCmgM7GzqmCw== Date: Tue, 18 Nov 2025 08:34:02 +0100 Subject: [PATCH 2/2] jump_label: remove workaround for old compilers in initializations Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251118-jump_label-cleanup-v1-2-440a424d7282@linutronix.de> References: <20251118-jump_label-cleanup-v1-0-440a424d7282@linutronix.de> In-Reply-To: <20251118-jump_label-cleanup-v1-0-440a424d7282@linutronix.de> To: Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1763451242; l=1669; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=RrY0awXkyHZxD/KovCSibv7UMWM/S+6zq58Mm5Qbx5E=; b=Xfz6znHyUB2IWAjPr3S1l0tKVrT4FildrNZQr3TjvWru+LsC7sScqgYfM2tdRfvg+Q4U49VtN NtBKtDXb9plDoBDyWsXBCF/yiDIjPWr95Rlx5PbLu6Wrp0kHnJsIPMm X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The extra braces for the initialization of the anonymous union members were added in commit cd8d860dcce9 ("jump_label: Fix anonymous union initialization") to compensate for limitations in gcc < 4.6. Versions of gcc this old are not supported anymore, so drop the workaround. Signed-off-by: Thomas Wei=C3=9Fschuh --- include/linux/jump_label.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index e494b360d36da49ac4ce1cb3a32d50c34e2e3e42..b9c7b0ebf7b9dcd4b4b0a96215e= 0fe710ed18e74 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -87,13 +87,6 @@ struct static_key { atomic_t enabled; #ifdef CONFIG_JUMP_LABEL /* - * Note: - * To make anonymous unions work with old compilers, the static - * initialization of them requires brackets. This creates a dependency - * on the order of the struct with the initializers. If any fields - * are added, STATIC_KEY_INIT_TRUE and STATIC_KEY_INIT_FALSE may need - * to be modified. - * * bit 0 =3D> 1 if key is initially true * 0 if initially false * bit 1 =3D> 1 if points to struct static_key_mod @@ -240,10 +233,10 @@ extern enum jump_label_type jump_label_init_type(stru= ct jump_entry *entry); =20 #define STATIC_KEY_INIT_TRUE \ { .enabled =3D ATOMIC_INIT(1), \ - { .type =3D JUMP_TYPE_TRUE } } + .type =3D JUMP_TYPE_TRUE } #define STATIC_KEY_INIT_FALSE \ { .enabled =3D ATOMIC_INIT(0), \ - { .type =3D JUMP_TYPE_FALSE } } + .type =3D JUMP_TYPE_FALSE } =20 #else /* !CONFIG_JUMP_LABEL */ =20 --=20 2.51.0