Re: [PATCH V2 10/11] x86/rcu: Add rcu_preempt_count

From: Lai Jiangshan
Date: Tue Apr 23 2024 - 22:53:53 EST


On Wed, Apr 24, 2024 at 2:09 AM Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> wrote:
>
> On Sun, Apr 7, 2024 at 5:06 AM Lai Jiangshan <jiangshanlai@xxxxxxxxx> wrote:
> >
> > From: Lai Jiangshan <jiangshan.ljs@xxxxxxxxxxxx>
> >
> > Implement PCPU_RCU_PREEMPT_COUNT for x86.
> > Mainly copied from asm/preempt.h
> >
> > Make rcu_read_[un]lock() inlined for rcu-preempt.
>
> Changelog is wrong. You inlined rcu_read_[un]lock in previous patch,
> not this one?

The previous patch just adds the non-arch framework code. The incline only
happens when CONFIG_PCPU_RCU_PREEMPT_COUNT=y. This patch implements
PCPU_RCU_PREEMPT_COUNT for x86, so rcu_read_[un]lock() was not made inlined
for x86 for rcu-preempt until this patch.

Thanks
Lai

>
> - Joel
>
> > Make rcu_read_lock() only one instruction.
> > Make rcu_read_unlock() only two instructions in the fast path.
> >
> > Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxx>
> > Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> > Cc: Frederic Weisbecker <frederic@xxxxxxxxxx>
> > Signed-off-by: Lai Jiangshan <jiangshan.ljs@xxxxxxxxxxxx>
> > ---
> > arch/x86/Kconfig | 1 +
> > arch/x86/include/asm/current.h | 3 +
> > arch/x86/include/asm/rcu_preempt.h | 107 +++++++++++++++++++++++++++++
> > arch/x86/kernel/cpu/common.c | 4 ++
> > 4 files changed, 115 insertions(+)
> > create mode 100644 arch/x86/include/asm/rcu_preempt.h
> >
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index 4fff6ed46e90..e805cac3763d 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -256,6 +256,7 @@ config X86
> > select HAVE_OBJTOOL if X86_64
> > select HAVE_OPTPROBES
> > select HAVE_PAGE_SIZE_4KB
> > + select HAVE_PCPU_RCU_PREEMPT_COUNT
> > select HAVE_PCSPKR_PLATFORM
> > select HAVE_PERF_EVENTS
> > select HAVE_PERF_EVENTS_NMI