From nobody Tue Apr 7 14:41:19 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