Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/qspinlock: Add spinlock contention tracepoint

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@linux.ibm.com>
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250731061856.1858898-1-nysal@linux.ibm.com

authored by

Nysal Jan K.A. and committed by
Madhavan Srinivasan
4f61d54d 74db6cc3

+10 -9
+10 -9
arch/powerpc/lib/qspinlock.c
··· 9 9 #include <linux/sched/clock.h> 10 10 #include <asm/qspinlock.h> 11 11 #include <asm/paravirt.h> 12 + #include <trace/events/lock.h> 12 13 13 14 #define MAX_NODES 4 14 15 ··· 709 708 qnodesp->count--; 710 709 } 711 710 712 - void queued_spin_lock_slowpath(struct qspinlock *lock) 711 + void __lockfunc queued_spin_lock_slowpath(struct qspinlock *lock) 713 712 { 713 + trace_contention_begin(lock, LCB_F_SPIN); 714 714 /* 715 715 * This looks funny, but it induces the compiler to inline both 716 716 * sides of the branch rather than share code as when the condition 717 717 * is passed as the paravirt argument to the functions. 718 718 */ 719 719 if (IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS) && is_shared_processor()) { 720 - if (try_to_steal_lock(lock, true)) { 720 + if (try_to_steal_lock(lock, true)) 721 721 spec_barrier(); 722 - return; 723 - } 724 - queued_spin_lock_mcs_queue(lock, true); 722 + else 723 + queued_spin_lock_mcs_queue(lock, true); 725 724 } else { 726 - if (try_to_steal_lock(lock, false)) { 725 + if (try_to_steal_lock(lock, false)) 727 726 spec_barrier(); 728 - return; 729 - } 730 - queued_spin_lock_mcs_queue(lock, false); 727 + else 728 + queued_spin_lock_mcs_queue(lock, false); 731 729 } 730 + trace_contention_end(lock, 0); 732 731 } 733 732 EXPORT_SYMBOL(queued_spin_lock_slowpath); 734 733