All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: xen-devel@lists.xenproject.org,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Anthony PERARD <anthony.perard@vates.tech>,
	Michal Orzel <michal.orzel@amd.com>,
	Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH v1 2/3] xen/smp: Rewrite on_selected_cpus() to be lockless
Date: Thu, 9 Apr 2026 10:09:18 +0200	[thread overview]
Message-ID: <addergb4PBVIAhQg@macbook.local> (raw)
In-Reply-To: <20260401163521.3603665-3-ross.lagerwall@citrix.com>

On Wed, Apr 01, 2026 at 05:35:20PM +0100, Ross Lagerwall wrote:
> on_selected_cpus() holds a global lock even if the function is to be
> called on non-overlapping CPUs. This is a scalability bottleneck so to
> avoid that:
> 
> 1. Remove the global lock.
> 2. Make call_data_struct per-CPU.
> 3. Track which CPUs are currently running on_selected_cpus() using a
>    global CPU mask. This tells CPUs running the interrupt which per-CPU
>    call_data_structs to look at.
> 
> Since the call data is now per-CPU, skip waiting for CPUs to "check in"
> for async calls. Instead, delay it until the next time
> on_selected_cpus() is called by which point there should be nothing to
> wait for.

One concern I have about this approach is loosing the fairness that
the usage of the spin lock provided.  Without the spinlock, and with
the usage of for_each_cpu ( i, &tasks ) to process any pending tasks,
it means the tasks from lower CPUs will always get preference over
the tasks from higher CPUs, regardless of when they have been
queued.

Ideally we need some kind of mechanism that can do a FIFO style
processing of the pending tasks, otherwise we are introducing a
performance penalty to high CPU IDs compared to low ones, and that's
likely to get worse as systems get bigger.

Thanks, Roger.


  parent reply	other threads:[~2026-04-09  8:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01 16:35 [PATCH v1 0/3] Lockless SMP function call and TLB flushing Ross Lagerwall
2026-04-01 16:35 ` [PATCH v1 1/3] x86/hap: Wait for remote CPUs during TLB flush Ross Lagerwall
2026-04-08 15:21   ` Jan Beulich
2026-04-08 15:48     ` Ross Lagerwall
2026-04-09  6:55       ` Jan Beulich
2026-04-01 16:35 ` [PATCH v1 2/3] xen/smp: Rewrite on_selected_cpus() to be lockless Ross Lagerwall
2026-04-08 16:11   ` Jan Beulich
2026-04-09  8:09   ` Roger Pau Monné [this message]
2026-04-09 11:46   ` Jan Beulich
2026-04-01 16:35 ` [PATCH v1 3/3] x86/smp: Rewrite TLB flush using on_selected_cpus() Ross Lagerwall
2026-04-20 14:04   ` Jan Beulich
2026-04-02  6:09 ` [PATCH v1 0/3] Lockless SMP function call and TLB flushing Jan Beulich
2026-04-02  8:40   ` Ross Lagerwall
2026-04-02  8:49     ` Jan Beulich
2026-04-02 10:57       ` Ross Lagerwall
2026-04-02 11:57         ` Andrew Cooper
2026-04-09  8:13           ` Roger Pau Monné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=addergb4PBVIAhQg@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=ross.lagerwall@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.