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

Dennis Zhou
2021-07-03T16:57:36Z

On Sat, Jul 03, 2021 at 05:25:02AM +0000, Dennis Zhou wrote:
> 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@roeck-us.net/
> > >
> > > Fixes: f183324133ea ("percpu: implement partial chunk depopulation")
> > > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > > Signed-off-by: Dennis Zhou <dennis@kernel.org>
> >
> > Tested-by: Guenter Roeck <linux@roeck-us.net>
> >
> > 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.
>

I'm pulling this because I think I'll need to do some aggregation to
make this less expensive. I'll send some variant soon hopefully.

Thanks,
Dennis