lkml.org 
[lkml]   [2019]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@linutronix.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

\
 
 \ /
  Last update: 2019-07-03 22:35    [W:0.050 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site