[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7bba99d8-b171-4ac1-a33c-4c086f3684fd@csgroup.eu>
Date: Wed, 30 Jul 2025 08:46:28 +0200
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: "Nysal Jan K.A." <nysal@...ux.ibm.com>,
Madhavan Srinivasan <maddy@...ux.ibm.com>
Cc: Michael Ellerman <mpe@...erman.id.au>, Nicholas Piggin
<npiggin@...il.com>, linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] powerpc/qspinlock: Add spinlock contention tracepoint
Le 25/07/2025 à 10:14, Nysal Jan K.A. a écrit :
> Add a lock contention tracepoint in the queued spinlock slowpath.
> Also add the __lockfunc annotation so that in_lock_functions()
> works as expected.
>
> Signed-off-by: Nysal Jan K.A. <nysal@...ux.ibm.com>
> ---
> arch/powerpc/lib/qspinlock.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/lib/qspinlock.c b/arch/powerpc/lib/qspinlock.c
> index bcc7e4dff8c3..622e7f45c2ce 100644
> --- a/arch/powerpc/lib/qspinlock.c
> +++ b/arch/powerpc/lib/qspinlock.c
> @@ -9,6 +9,7 @@
> #include <linux/sched/clock.h>
> #include <asm/qspinlock.h>
> #include <asm/paravirt.h>
> +#include <trace/events/lock.h>
>
> #define MAX_NODES 4
>
> @@ -708,8 +709,9 @@ static __always_inline void queued_spin_lock_mcs_queue(struct qspinlock *lock, b
> qnodesp->count--;
> }
>
> -void queued_spin_lock_slowpath(struct qspinlock *lock)
> +void __lockfunc queued_spin_lock_slowpath(struct qspinlock *lock)
> {
> + trace_contention_begin(lock, LCB_F_SPIN);
> /*
> * This looks funny, but it induces the compiler to inline both
> * sides of the branch rather than share code as when the condition
> @@ -718,16 +720,17 @@ void queued_spin_lock_slowpath(struct qspinlock *lock)
> if (IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS) && is_shared_processor()) {
> if (try_to_steal_lock(lock, true)) {
> spec_barrier();
> - return;
> + } else {
> + queued_spin_lock_mcs_queue(lock, true);
If I read correctly, now all this is single line so you have to drop the
braces , see
https://docs.kernel.org/process/coding-style.html#placing-braces-and-spaces
> }
> - queued_spin_lock_mcs_queue(lock, true);
> } else {
> if (try_to_steal_lock(lock, false)) {
> spec_barrier();
> - return;
> + } else {
> + queued_spin_lock_mcs_queue(lock, false);
> }
Same here.
> - queued_spin_lock_mcs_queue(lock, false);
> }
> + trace_contention_end(lock, 0);
> }
> EXPORT_SYMBOL(queued_spin_lock_slowpath);
>
Powered by blists - more mailing lists