[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250327205355.378659-31-mingo@kernel.org>
Date: Thu, 27 Mar 2025 21:53:43 +0100
From: Ingo Molnar <mingo@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: Juergen Gross <jgross@...e.com>,
"H . Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>
Subject: [PATCH 30/41] x86/alternatives: Simplify try_get_tp_array()
There's no need to return a pointer on success - it's always
the same pointer.
Return a bool instead.
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
arch/x86/kernel/alternative.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 0b11f53d6e6d..244119066672 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -2475,15 +2475,14 @@ static struct text_poke_int3_array {
static DEFINE_PER_CPU(atomic_t, int3_refs);
-static __always_inline
-struct text_poke_int3_array *try_get_tp_array(void)
+static bool try_get_tp_array(void)
{
atomic_t *refs = this_cpu_ptr(&int3_refs);
if (!raw_atomic_inc_not_zero(refs))
- return NULL;
+ return false;
- return &tp_array;
+ return true;
}
static __always_inline void put_tp_array(void)
@@ -2530,9 +2529,9 @@ noinstr int text_poke_int3_handler(struct pt_regs *regs)
*/
smp_rmb();
- desc = try_get_tp_array();
- if (!desc)
+ if (!try_get_tp_array())
return 0;
+ desc = &tp_array;
WARN_ON_ONCE(desc->vec != tp_array.vec);
--
2.45.2
Powered by blists - more mailing lists