Re: [PATCH 2/2] x86/MCE: Add command line option to extend MCE Records pool

From: Paul E. McKenney
Date: Mon Feb 12 2024 - 17:47:08 EST


On Mon, Feb 12, 2024 at 10:27:41PM +0100, Borislav Petkov wrote:
> On Mon, Feb 12, 2024 at 12:44:06PM -0800, Paul E. McKenney wrote:
> > If it is the #MC adding new memory, agreed.
> >
> > If the #MC is simply traversing the list, and the interrupted context
> > was in the midst of adding a new element, this should be no worse than
> > some other CPU traversing the list while this CPU is in the midst of
> > adding a new element.
>
> Right, Tony answered which context is doing what.
>
> What I'm still scratching my head over is, why grab a spinlock around
>
> list_add_rcu(&chunk->next_chunk, &pool->chunks);
>
> ?
>
> That's the part that looks really weird.
>
> And that's the interrupted context, yap.

The usual reason is to exclude other CPUs also doing list_add_rcu()
on the same list. Or is there other synchronization that is preventing
concurrent updates?

Thanx, Paul