Re: [PATCH] percpu: flush tlb after pcpu_depopulate_chunk()

From: Dennis Zhou
Date: Sat Jul 03 2021 - 01:25:15 EST


On Fri, Jul 02, 2021 at 10:14:44PM -0700, Guenter Roeck wrote:
> On Sat, Jul 03, 2021 at 04:04:49AM +0000, Dennis Zhou wrote:
> > Prior to "percpu: implement partial chunk depopulation",
> > pcpu_depopulate_chunk() was called only on the destruction path. This
> > meant the virtual address range was on its way back to vmalloc which
> > will handle flushing the tlbs for us.
> >
> > However, now that we call pcpu_depopulate_chunk() during the active
> > lifecycle of a chunk, we need to flush the tlb as well otherwise we can
> > end up accessing the wrong page through an invalid tlb mapping.
> >
> > This was reported in [1].
> >
> > [1] https://lore.kernel.org/lkml/20210702191140.GA3166599@xxxxxxxxxxxx/
> >
> > Fixes: f183324133ea ("percpu: implement partial chunk depopulation")
> > Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> > Signed-off-by: Dennis Zhou <dennis@xxxxxxxxxx>
>
> Tested-by: Guenter Roeck <linux@xxxxxxxxxxxx>
>
> Thanks!
> Guenter
>

I updated the tag and have applied this to for-5.14-fixes so it can get
some for-next exposure before I send a fix to Linus.

Thanks for setting up the super easy repro! It made debugging this
significantly easier.

Thanks,
Dennis