From 6f4024c162ccefcf0eb04ec8bac8d9e8611037d6 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: May 17 2023 19:16:04 +0000 Subject: locking/rwsem: Add __always_inline annotation to __down_read_common() and inlined callers (bsc#1012628). --- diff --git a/patches.kernel.org/6.3.3-225-locking-rwsem-Add-__always_inline-annotation-to.patch b/patches.kernel.org/6.3.3-225-locking-rwsem-Add-__always_inline-annotation-to.patch new file mode 100644 index 0000000..bbf77b7 --- /dev/null +++ b/patches.kernel.org/6.3.3-225-locking-rwsem-Add-__always_inline-annotation-to.patch @@ -0,0 +1,71 @@ +From: John Stultz +Date: Wed, 3 May 2023 02:33:51 +0000 +Subject: [PATCH] locking/rwsem: Add __always_inline annotation to + __down_read_common() and inlined callers +References: bsc#1012628 +Patch-mainline: 6.3.3 +Git-commit: 92cc5d00a431e96e5a49c0b97e5ad4fa7536bd4b + +commit 92cc5d00a431e96e5a49c0b97e5ad4fa7536bd4b upstream. + +Apparently despite it being marked inline, the compiler +may not inline __down_read_common() which makes it difficult +to identify the cause of lock contention, as the blocked +function in traceevents will always be listed as +__down_read_common(). + +So this patch adds __always_inline annotation to the common +function (as well as the inlined helper callers) to force it to +be inlined so the blocking function will be listed (via Wchan) +in traceevents. + +Fixes: c995e638ccbb ("locking/rwsem: Fold __down_{read,write}*()") +Reported-by: Tim Murray +Signed-off-by: John Stultz +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Waiman Long +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/20230503023351.2832796-1-jstultz@google.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Jiri Slaby +--- + kernel/locking/rwsem.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c +index acb5a503..9eabd585 100644 +--- a/kernel/locking/rwsem.c ++++ b/kernel/locking/rwsem.c +@@ -1240,7 +1240,7 @@ static struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem) + /* + * lock for reading + */ +-static inline int __down_read_common(struct rw_semaphore *sem, int state) ++static __always_inline int __down_read_common(struct rw_semaphore *sem, int state) + { + int ret = 0; + long count; +@@ -1258,17 +1258,17 @@ static inline int __down_read_common(struct rw_semaphore *sem, int state) + return ret; + } + +-static inline void __down_read(struct rw_semaphore *sem) ++static __always_inline void __down_read(struct rw_semaphore *sem) + { + __down_read_common(sem, TASK_UNINTERRUPTIBLE); + } + +-static inline int __down_read_interruptible(struct rw_semaphore *sem) ++static __always_inline int __down_read_interruptible(struct rw_semaphore *sem) + { + return __down_read_common(sem, TASK_INTERRUPTIBLE); + } + +-static inline int __down_read_killable(struct rw_semaphore *sem) ++static __always_inline int __down_read_killable(struct rw_semaphore *sem) + { + return __down_read_common(sem, TASK_KILLABLE); + } +-- +2.35.3 + diff --git a/series.conf b/series.conf index 49790f6..8662022 100644 --- a/series.conf +++ b/series.conf @@ -958,6 +958,7 @@ patches.kernel.org/6.3.3-222-drm-amd-display-Lowering-min-Z8-residency-time.patch patches.kernel.org/6.3.3-223-parisc-Fix-encoding-of-swp_entry-due-to-added-S.patch patches.kernel.org/6.3.3-224-perf-x86-Fix-missing-sample-size-update-on-AMD-.patch + patches.kernel.org/6.3.3-225-locking-rwsem-Add-__always_inline-annotation-to.patch ######################################################## # Build fixes that apply to the vanilla kernel too.