[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1907032213250.1802@nanos.tec.linutronix.de>
Date: Wed, 3 Jul 2019 22:34:33 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Nadav Amit <namit@...are.com>
cc: LKML <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>,
Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>,
Stephane Eranian <eranian@...gle.com>,
Feng Tang <feng.tang@...el.com>
Subject: Re: [patch 16/18] x86/apic: Convert 32bit to IPI shorthand static
key
Nadav,
On Wed, 3 Jul 2019, Nadav Amit wrote:
> > On Jul 3, 2019, at 3:54 AM, Thomas Gleixner <tglx@...utronix.de> wrote:
> > void default_send_IPI_all(int vector)
> > {
> > - if (apic_ipi_shorthand_off || vector == NMI_VECTOR) {
> > + if (static_branch_likely(&apic_use_ipi_shorthand)) {
> > apic->send_IPI_mask(cpu_online_mask, vector);
> > } else {
> > __default_send_IPI_shortcut(APIC_DEST_ALLINC, vector);
>
> It may be better to check the static-key in native_send_call_func_ipi() (and
> other callers if there are any), and remove all the other checks in
> default_send_IPI_all(), x2apic_send_IPI_mask_allbutself(), etc.
That makes sense. Should have thought about that myself, but hunting that
APIC emulation issue was affecting my brain obviously :)
> void native_send_call_func_ipi(const struct cpumask *mask)
> {
> - cpumask_var_t allbutself;
> -
> - if (!alloc_cpumask_var(&allbutself, GFP_ATOMIC)) {
> - apic->send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
> - return;
> + int cpu, this_cpu = smp_processor_id();
> + bool allbutself = true;
> + bool self = false;
> +
> + for_each_cpu_and_not(cpu, cpu_online_mask, mask) {
> +
> + if (cpu != this_cpu) {
> + allbutself = false;
> + break;
> + }
> + self = true;
That accumulates to a large iteration in the worst case.
> }
>
> - cpumask_copy(allbutself, cpu_online_mask);
> - __cpumask_clear_cpu(smp_processor_id(), allbutself);
> -
> - if (cpumask_equal(mask, allbutself) &&
> + if (allbutself && !self &&
> cpumask_equal(cpu_online_mask, cpu_callout_mask))
Hmm. I overlooked that one. Need to take a deeper look.
> apic->send_IPI_allbutself(CALL_FUNCTION_VECTOR);
> else
> apic->send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
Let me think about it for a while.
Thanks,
tglx
Powered by blists - more mailing lists