Re: [PATCH 02/33] PCI: Protect against concurrent change of housekeeping cpumask
From: Frederic Weisbecker
Date: Tue Sep 23 2025 - 05:07:55 EST
Le Mon, Sep 22, 2025 at 05:51:39PM -0400, Waiman Long a écrit :
> On 9/18/25 10:00 AM, Frederic Weisbecker wrote:
> > No the point is that I need to keep the target selection
> > (housekeeping_cpumask() read) and the work queue within the same
> > RCU critical section so that things are synchronized that way:
> >
> > CPU 0 CPU 1
> > ----- -----
> > rcu_read_lock() housekeeping_update()
> > cpu = cpumask_any(housekeeping_cpumask(...)) housekeeping_cpumask &= ~val
> > queue_work_on(cpu, pci_probe_wq, work) synchronize_rcu()
> > rcu_read_unlock() flush_workqueue(pci_probe_wq)
> > flush_work(work)
> > And I can't include the whole work_on_cpu() within rcu_read_lock() because
> > flush_work() may sleep.
>
> Right, you are trying to avoid flush_work() within rcu_read_lock() critical
> section. It makes it easier to review if you mention that in the commit log.
Good point!
>
> >
> > Also now that you mention it, I need to create that pci_probe_wq and flush it :-)
>
> OK, another wq :-)
Yeah I know :-s
>
> Cheers,
> Longman
>
--
Frederic Weisbecker
SUSE Labs