Re: [PATCH v6 01/11] asm-generic/pgtable: Adds generic functions to track lockless pgtable walks

From: Leonardo Bras
Date: Thu Feb 06 2020 - 21:22:01 EST


Hello Christophe, thanks for the feedback!

On Thu, 2020-02-06 at 06:54 +0100, Christophe Leroy wrote:
> > A memory barrier was also added just to make sure there is no speculative
> > read outside the interrupt disabled area. Other than that, it is not
> > supposed to have any change of behavior from current code.
>
> Is that speculative barrier necessary for all architectures ? Does it
> impact performance ? Shouldn't this be another patch ?

It makes sense, better keep the code as much as possible as it was. If
any arch finds this barrier needed, it can implement it's own version
of this function (or another patch to add this to generic, if proved to
be needed in every arch).

> > +#ifndef __HAVE_ARCH_LOCKLESS_PGTBL_WALK_CONTROL
> > +/*
> > + * begin_lockless_pgtbl_walk: Must be inserted before a function call that does
> > + * lockless pagetable walks, such as __find_linux_pte()
> > + */
> > +static inline
> > +unsigned long begin_lockless_pgtbl_walk(void)
>
> What about keeping the same syntax as local_irq_save(), something like:
>
> #define begin_lockless_pgtbl_walk(flags) \
> do {
> local_irq_save(flags);
> smp_mb();
> } while (0)
>

Makes sense. But wouldn't inlining have the same code output?

Best regards,
Leonardo Bras

Attachment: signature.asc
Description: This is a digitally signed message part