From nobody Tue Apr 7 13:09:55 2026 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 6DED6280318 for ; Fri, 13 Mar 2026 08:22:32 +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=1773390153; cv=none; b=CBztRZFpkxkBJk4SB3SGUZK3NJijAXXfu4OZyiYp/6BuAuhwVe9/BMwhcMBwOz20z9StkEvobVq5RjMQgbtAF5/QaXrHyMVjjjeTX0IsRjWOXwgXy2JE6htI+k3CsjnjaZ4hMg+fSWjeGHHNcL1APPmAw3494yaMRzR5ACV000w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773390153; c=relaxed/simple; bh=J/B5yw5ImdF3PhRWzMGk9dwmwxsESzvXG8SY1z9C1/c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r+Pke9/rMIsfEsFTM/cPZn2zuLc21N1ISiG6435rVg+yFWhVYrOxyj6OesHp35O0eG93dO2HNG26v49v5TM2UQgsWEgw6vH+MKBS/siAROZPUoGm8c9UA6YdqGK5327rpQl/9wXpywDnWqaF++t5LNgqmfVPGRAl4PPVtC69ADU= 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=IRmSrylN; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=sifTy+DX; 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="IRmSrylN"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="sifTy+DX" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773390150; 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=24DCMqkTdJiNDNU6zvKF7sRgrLM/l/RSdL2fNIO2YeQ=; b=IRmSrylNvUbX49rV3dtM82/9gbWGcLxIJk+cOBYhyKL6eqxP2AY0qff0tq1MEFSlg/Mm4k xcV4PzC4937Wsw3PDYgTE0JSTZpjFg8r5Isqyto7HMARpWhfPK+36DIpO3o3oiBqXd4R4M f6P/JQ5pkdtvZO87iCZhfmZilYHe90d9YeEM265mNatDJEvFQs6b4s7MbyaTM9NH1re0i0 b2mtKSi/dB069CbtVDkrwwkZM5s/9wynBTw4nkw58JG598Lv/LLqbseeyHAJlsCcqFYptl cUOAQcbSgG46CKekS5QYeHERQAEeV6R+uVqZFBrlj1bNvR2hlTHL9auYzbzChQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773390150; 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=24DCMqkTdJiNDNU6zvKF7sRgrLM/l/RSdL2fNIO2YeQ=; b=sifTy+DX4gTUiVreR84tF8djxJu7Kok5+2BHq28ybWxiHCPC7OKYlLMHpCsU3wGUCrd5ur vbEKps41CWrBZKCA== Date: Fri, 13 Mar 2026 09:22:18 +0100 Subject: [PATCH v2 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: <20260313-jump_label-cleanup-v2-1-35d3c0bde549@linutronix.de> References: <20260313-jump_label-cleanup-v2-0-35d3c0bde549@linutronix.de> In-Reply-To: <20260313-jump_label-cleanup-v2-0-35d3c0bde549@linutronix.de> To: Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Ard Biesheuvel , Alice Ryhl Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1773390149; l=2333; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=J/B5yw5ImdF3PhRWzMGk9dwmwxsESzvXG8SY1z9C1/c=; b=Klq8OwhQ2SdVLdUEpJKFvsfod8Cvt29NxOaTlSk7l92eD+RRPMSYNM11NFtfRpmi+hUR8Ikry iYtlxRMTlOFDBLArkcRDcFP7G9r1dykXBrdyr4O4EglGSh6vZrJTygX 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 fdb79dd1ebd8..e494b360d36d 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 7cb19e601426..e851e4b37d0e 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.53.0 From nobody Tue Apr 7 13:09:55 2026 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 DC33034A3B1 for ; Fri, 13 Mar 2026 08:22:32 +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=1773390154; cv=none; b=NQtqpe5crwPpD7LKhdxzkUCcdFdmfC6y3sRjwRg2RFUUv/O2C0nYF4BVSZcMTVhe4DR15pZjcH8EJQ4kkgiqGxINTG5/M3bOaaVYe0ETxM5njTGm4wzYSjwKlwVY8SllvvehqszbeJEQDoUhkNSnpGIaSlHd5G5GacfXCDeVk+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773390154; c=relaxed/simple; bh=7k+QcM8YATW5Mmir7AOSIIAGhj5xHVFL+4LMgK8O1LU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jlxCHB6UKwbvPEccimxRVCVRTcqDuipWpGYmQYxJpeFX6uprQ1WI1ptyJ9Xq5ZJ1qvD0pAFAoj6umN1VxlJrscvuTQAOGe/J5UGRy0ofD13Rg4t0zrSikmoERkmzNZGjFBspGt0J1zIKxLkoa5qIBSGwd+8MoLnBOntqaY1VlMo= 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=y/glSEOt; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=QU/AlFAj; 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="y/glSEOt"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QU/AlFAj" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773390151; 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=Lh5xWDHAQ6h+kSv/ML/A8RESbyj5VrVIdvE6BRrAePg=; b=y/glSEOtZjmCZ7NaYYemXmiLK6ApS9ijwAZczdfxsQuRCBLEZc7F2vvse725sc7Jn1B0Np gpMM9UkOVr6GGQs4NaF8ydk8q/I2baeGJ/idzqNHMuswM6naIU6RmeX+s4KVO2UkjdQZNU HvWchfrGdwHu/eGKg91/iDsw20j3d/ykMDZeVCljurqAgU985zaocDTQJ3YFRhV8sqJgf6 LWnrT5j66KBn5mZYV/Gl4AX25lfuOwBfmtCeraGqtc0RSUs82BwsbZHA8/9DvLQ9VE04E1 gxn8TqBWZV1uU4dinAIO6pSmXaSeQIhdfc1VmQThjGhDczSB1BZGvUyUqJ286w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773390151; 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=Lh5xWDHAQ6h+kSv/ML/A8RESbyj5VrVIdvE6BRrAePg=; b=QU/AlFAjSL4AEBFoPno6uB+lT0emVhHLLzUSPFp9sIMtQ1FXvbTfqkFGT08zDpfRVqBE25 4ghq/zxqjXnflmDA== Date: Fri, 13 Mar 2026 09:22:19 +0100 Subject: [PATCH v2 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: <20260313-jump_label-cleanup-v2-2-35d3c0bde549@linutronix.de> References: <20260313-jump_label-cleanup-v2-0-35d3c0bde549@linutronix.de> In-Reply-To: <20260313-jump_label-cleanup-v2-0-35d3c0bde549@linutronix.de> To: Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Ard Biesheuvel , Alice Ryhl Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1773390149; l=1613; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=7k+QcM8YATW5Mmir7AOSIIAGhj5xHVFL+4LMgK8O1LU=; b=1hU0fKWid02JxnAV12Mtb4qeWN+BokHL8s7OahnPKNcm3WJgeMPibHwPt7T55lCmCvahthY7E HO10M3Sme0BCQ8tEexhil3Wy9GwPUqAZWNma2W59UugtpZY3KnLOhW3 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 e494b360d36d..b9c7b0ebf7b9 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.53.0