[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b7c3882f-9691-47fc-9e50-267fef9cfc06@suse.com>
Date: Thu, 3 Apr 2025 18:34:37 +0300
From: Nikolay Borisov <nik.borisov@...e.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: linux-kernel@...r.kernel.org, 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: Re: [PATCH 37/49] x86/alternatives: Move text_poke_array completion
from smp_text_poke_batch_finish() and smp_text_poke_batch_flush() to
smp_text_poke_batch_process()
On 3.04.25 г. 18:29 ч., Ingo Molnar wrote:
>
> * Nikolay Borisov <nik.borisov@...e.com> wrote:
>
>> I meant doing this:
>>
>> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
>> index 5b1a6252a4b9..b6a781b9de26 100644
>> --- a/arch/x86/kernel/alternative.c
>> +++ b/arch/x86/kernel/alternative.c
>> @@ -2587,12 +2587,16 @@ noinstr int smp_text_poke_int3_trap_handler(struct
>> pt_regs *regs)
>> * replacing opcode
>> * - SMP sync all CPUs
>> */
>> -static void smp_text_poke_batch_process(void)
>> +void smp_text_poke_batch_finish(void)
>> {
>> unsigned char int3 = INT3_INSN_OPCODE;
>> unsigned int i;
>> int do_sync;
>>
>> +
>> + if (!text_poke_array.nr_entries)
>> + return;
>
>> - smp_text_poke_batch_process();
>> + smp_text_poke_batch_finish();
>
> I suppose we could do this - it adds one more check to
> smp_text_poke_batch_add() though.
poke_batch_finish you meant?
>
>> AFAICS this doesn't change the semantics. I.e smp_text_poke_batch_add
>> will call poke_batch_finish iff the address to be added violates the
>> sorted order of text_poke_array. The net effect is we have 1 less
>> function name to care about.
>
> Yeah, it doesn't change semantics, but it's a very small
> deoptimization.
> > Mind sending a patch? It does simplify the facility some more and that
> single branch will wash away against costs like the CR3 flushes done
Given that poke_batch_finish does a cond_resched and sync_each_cpu which
is an IPI can it even be considered a performance critical path ?
> ...
>
> Thanks,
>
> Ingo
Powered by blists - more mailing lists