From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>,
xen-devel@lists.xenproject.org,
Michal Orzel <michal.orzel@amd.com>,
Bertrand Marquis <bertrand.marquis@arm.com>
Subject: Re: [PATCH for-4.19 2/9] xen/cpu: do not get the CPU map in stop_machine_run()
Date: Wed, 29 May 2024 17:20:28 +0200 [thread overview]
Message-ID: <ZldHvAW_2nqAuWcq@macbook> (raw)
In-Reply-To: <7954b3c2-e101-4db0-b317-a6585a6a8689@suse.com>
On Wed, May 29, 2024 at 03:04:13PM +0200, Jan Beulich wrote:
> On 29.05.2024 11:01, Roger Pau Monne wrote:
> > The current callers of stop_machine_run() outside of init code already have the
> > CPU maps locked, and hence there's no reason for stop_machine_run() to attempt
> > to lock again.
>
> While purely from a description perspective this is okay, ...
>
> > --- a/xen/common/stop_machine.c
> > +++ b/xen/common/stop_machine.c
> > @@ -82,9 +82,15 @@ int stop_machine_run(int (*fn)(void *data), void *data, unsigned int cpu)
> > BUG_ON(!local_irq_is_enabled());
> > BUG_ON(!is_idle_vcpu(current));
> >
> > - /* cpu_online_map must not change. */
> > - if ( !get_cpu_maps() )
> > + /*
> > + * cpu_online_map must not change. The only two callers of
> > + * stop_machine_run() outside of init code already have the CPU map locked.
> > + */
>
> ... the "two" here is not unlikely to quickly go stale; who knows what PPC
> and RISC-V will have as their code becomes more complete?
>
> I'm also unconvinced that requiring ...
>
> > + if ( system_state >= SYS_STATE_active && !cpu_map_locked() )
>
> ... this for all future (post-init) uses of stop_machine_run() is a good
> idea. It is quite a bit more natural, to me at least, for the function to
> effect this itself, as is the case prior to your change.
This is mostly a pre-req for the next change that switches
get_cpu_maps() to return false if the current CPU is holding the CPU
maps lock in write mode.
IF we don't want to go this route we need a way to signal
send_IPI_mask() when a CPU hot{,un}plug operation is taking place,
because get_cpu_maps() enough is not suitable.
Overall I don't like the corner case where get_cpu_maps() returns true
if a CPU hot{,un}plug operation is taking place in the current CPU
context. The guarantee of get_cpu_maps() is that no CPU hot{,un}plug
operations can be in progress if it returns true.
Thanks, Roger.
next prev parent reply other threads:[~2024-05-29 15:20 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 9:01 [PATCH for-4.19 0/9] x86/irq: fixes for CPU hot{,un}plug Roger Pau Monne
2024-05-29 9:01 ` [PATCH for-4.19 1/9] x86/irq: remove offline CPUs from old CPU mask when adjusting move_cleanup_count Roger Pau Monne
2024-05-29 12:40 ` Jan Beulich
2024-05-29 15:15 ` Roger Pau Monné
2024-05-29 15:27 ` Jan Beulich
2024-05-29 15:34 ` Roger Pau Monné
2024-05-29 9:01 ` [PATCH for-4.19 2/9] xen/cpu: do not get the CPU map in stop_machine_run() Roger Pau Monne
2024-05-29 13:04 ` Jan Beulich
2024-05-29 15:20 ` Roger Pau Monné [this message]
2024-05-29 15:31 ` Jan Beulich
2024-05-29 15:48 ` Roger Pau Monné
2024-05-29 9:01 ` [PATCH for-4.19 3/9] xen/cpu: ensure get_cpu_maps() returns false if CPU operations are underway Roger Pau Monne
2024-05-29 13:35 ` Jan Beulich
2024-05-29 15:03 ` Roger Pau Monné
2024-05-29 15:49 ` Jan Beulich
2024-05-29 16:14 ` Roger Pau Monné
2024-05-31 7:02 ` Jan Beulich
2024-05-31 7:31 ` Roger Pau Monné
2024-05-31 8:33 ` Jan Beulich
2024-05-31 9:15 ` Roger Pau Monné
2024-05-29 9:01 ` [PATCH for-4.19 4/9] x86/irq: describe how the interrupt CPU movement works Roger Pau Monne
2024-05-29 13:57 ` Jan Beulich
2024-05-29 15:28 ` Roger Pau Monné
2024-05-31 7:06 ` Jan Beulich
2024-05-31 7:39 ` Roger Pau Monné
2024-05-29 9:01 ` [PATCH for-4.19 5/9] x86/irq: limit interrupt movement done by fixup_irqs() Roger Pau Monne
2024-05-29 9:01 ` [PATCH for-4.19 6/9] x86/irq: restrict CPU movement in set_desc_affinity() Roger Pau Monne
2024-05-29 9:01 ` [PATCH for-4.19 7/9] x86/irq: deal with old_cpu_mask for interrupts in movement in fixup_irqs() Roger Pau Monne
2024-05-29 9:01 ` [PATCH for-4.19 8/9] x86/irq: handle moving interrupts in _assign_irq_vector() Roger Pau Monne
2024-05-29 9:01 ` [PATCH for-4.19 9/9] x86/irq: forward pending interrupts to new destination in fixup_irqs() Roger Pau Monne
2024-05-29 9:33 ` Andrew Cooper
2024-05-29 9:37 ` [PATCH for-4.19 0/9] x86/irq: fixes for CPU hot{,un}plug Oleksii K.
2024-06-11 13:25 ` Jan Beulich
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=ZldHvAW_2nqAuWcq@macbook \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.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.