From nobody Mon Feb 9 15:59:26 2026 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 E1F6018C939 for ; Thu, 26 Dec 2024 23:12:59 +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=1735254780; cv=none; b=oJjtKzbKbW3mFrApVZWq4Y7sMlW542LOtt1jcPuf9o/p/8LduXqUCAsY4oB9yS0tzg5+pADaJTxj1i6JjuPDGgL4jULhFedMG21DPPZ70ecOgGTKlpGKprSYT+5acBi8lHnlVrwKS8yDzT5w+nENhUnZo+hbc5DYfEI1RWgqVn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735254780; c=relaxed/simple; bh=Ngo3bSi2IvV+h1UPDEFo/TSQuzlwtW17xSVAgWPLfrQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZQ5BcJp4961dvDWaosIkG248707P6hUWp+M663f91ih/GUj9QEv5own0S3A2aDz9UTe7j99Z03aaNJBgTzerGn414XzeP+xLu9POtuT+OUQWGeYCqTicJRoU0Yk3Z1sOr5FhkLg1W3b+knuyYRJH9EJQYJTWqDEpUBBdfJS9BTQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hm6R8+ZZ; 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="hm6R8+ZZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54128C4CED1; Thu, 26 Dec 2024 23:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735254779; bh=Ngo3bSi2IvV+h1UPDEFo/TSQuzlwtW17xSVAgWPLfrQ=; h=From:To:Cc:Subject:Date:From; b=hm6R8+ZZASgN5935Z++jNWiHMYqdI8Elp7Oh4yMq29nsz7Q+3wUzAUVvEbqv4sAk8 LAfNARuynaqRlgS4mbuqFvNhNgE91KBiSD5rmUX2A+K/uI5fHtnJl99y/laeDf+KAc P3QkmsV4EMTz435eAaDnDHmt13uaMG8dat2zHz28WZljkrbKcWE7YB0wgjj7k/cE5k VPAmysYNy+jN5drrf35Fzuog2RxqXRWpto8ZXxJ/Ej0QdBpFxB4HXwEp46XzQ1N+5t Bo6y+09BFAX0dN8kXMdDwkyq0wjLvzuwbrN4K92grPGvihfUvqTSXEe1nWm1qtLOtz KWq2zTrgHWfIA== From: Eric Biggers To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" Subject: [PATCH] x86/fpu: make WARN_ON_FPU get fully optimized out Date: Thu, 26 Dec 2024 15:11:59 -0800 Message-ID: <20241226231159.10848-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.47.1 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" From: Eric Biggers Currently WARN_ON_FPU evaluates its argument even if CONFIG_X86_DEBUG_FPU is disabled, which adds unnecessary instructions to several functions. Fix this by making the argument evaluation in the no-debug case conditional on if (0), similar to what no_printk() does. Fixes: 83242c515881 ("x86/fpu: Make WARN_ON_FPU() more robust in the !CONFI= G_X86_DEBUG_FPU case") Signed-off-by: Eric Biggers --- arch/x86/kernel/fpu/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/fpu/internal.h b/arch/x86/kernel/fpu/internal.h index dbdb31f55fc7..deb0a31b75e4 100644 --- a/arch/x86/kernel/fpu/internal.h +++ b/arch/x86/kernel/fpu/internal.h @@ -16,11 +16,11 @@ static __always_inline __pure bool use_fxsr(void) } =20 #ifdef CONFIG_X86_DEBUG_FPU # define WARN_ON_FPU(x) WARN_ON_ONCE(x) #else -# define WARN_ON_FPU(x) ({ (void)(x); 0; }) +# define WARN_ON_FPU(x) ({ if (0) (void)(x); 0; }) #endif =20 /* Used in init.c */ extern void fpstate_init_user(struct fpstate *fpstate); extern void fpstate_reset(struct fpu *fpu); base-commit: d6ef8b40d075c425f548002d2f35ae3f06e9cf96 --=20 2.47.1