diff --git a/patches.suse/locking-rwsem-Prevent-non-first-waiter-from-spinning.patch b/patches.suse/locking-rwsem-Prevent-non-first-waiter-from-spinning.patch index 2b40739..3ad1fc4 100644 --- a/patches.suse/locking-rwsem-Prevent-non-first-waiter-from-spinning.patch +++ b/patches.suse/locking-rwsem-Prevent-non-first-waiter-from-spinning.patch @@ -1,9 +1,11 @@ +From b613c7f31476c44316bfac1af7cac714b7d6bef9 Mon Sep 17 00:00:00 2001 From: Waiman Long -Date: Thu, 17 Nov 2022 21:20:11 -0500 +Date: Wed, 25 Jan 2023 19:36:25 -0500 Subject: [PATCH] locking/rwsem: Prevent non-first waiter from spinning in down_write() slowpath -Patch-mainline: Not yet, testing -References: bsc#1204996 +Git-commit: b613c7f31476c44316bfac1af7cac714b7d6bef9 +Patch-mainline: v6.3-rc1 +References: bsc#1204996 A non-first waiter can potentially spin in the for loop of rwsem_down_write_slowpath() without sleeping but fail to acquire the @@ -31,7 +33,7 @@ lock even if the rwsem is free if the following sequence happens: Acquire wait_lock rwsem_try_write_lock(): if (first->handoff_set && (waiter != first)) - return false; + return false; Release wait_lock A non-first waiter cannot really acquire the rwsem even if it mistakenly @@ -42,19 +44,22 @@ Fix this problem by making sure that a non-first waiter cannot spin in the slowpath loop without sleeping. Fixes: d257cc8cb8d5 ("locking/rwsem: Make handoff bit handling more consistent") -Reviewed-and-tested-by: Mukesh Ojha Signed-off-by: Waiman Long +Signed-off-by: Ingo Molnar +Tested-by: Mukesh Ojha +Reviewed-by: Mukesh Ojha Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20230126003628.365092-2-longman@redhat.com Signed-off-by: Jiri Wiesner --- kernel/locking/rwsem.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c -index 6726c983b7941..9024d957d4c8e 100644 +index 44873594de03..be2df9ea7c30 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c -@@ -623,18 +623,16 @@ static inline bool rwsem_try_write_lock(struct rw_semaphore *sem, +@@ -624,18 +624,16 @@ static inline bool rwsem_try_write_lock(struct rw_semaphore *sem, */ if (first->handoff_set && (waiter != first)) return false; @@ -78,7 +83,7 @@ index 6726c983b7941..9024d957d4c8e 100644 if (has_handoff || (!rt_task(waiter->task) && !time_after(jiffies, waiter->timeout))) return false; -@@ -650,11 +648,12 @@ static inline bool rwsem_try_write_lock(struct rw_semaphore *sem, +@@ -651,11 +649,12 @@ static inline bool rwsem_try_write_lock(struct rw_semaphore *sem, } while (!atomic_long_try_cmpxchg_acquire(&sem->count, &count, new)); /* diff --git a/series.conf b/series.conf index 8bac715..d729421 100644 --- a/series.conf +++ b/series.conf @@ -36888,6 +36888,7 @@ patches.suse/net-sched-tcindex-update-imperfect-hash-filters-resp.patch patches.suse/bnxt_en-Fix-mqprio-and-XDP-ring-checking-logic.patch patches.suse/fbdev-Fix-invalid-page-access-after-closing-deferred.patch + patches.suse/locking-rwsem-Prevent-non-first-waiter-from-spinning.patch patches.suse/ibmvnic-Toggle-between-queue-types-in-affinity-mappi.patch patches.suse/rds-rds_rm_zerocopy_callback-correct-order-for-list_add_tail.patch patches.suse/ipmi-ssif-resend_msg-cannot-fail.patch @@ -36898,7 +36899,6 @@ patches.suse/bnxt_en-Avoid-order-5-memory-allocation-for-TPA-data.patch # out-of-tree patches - patches.suse/locking-rwsem-Prevent-non-first-waiter-from-spinning.patch patches.suse/locking-rwsem-Disable-preemption-at-all-down_read-an.patch patches.suse/locking-rwsem-Disable-preemption-at-all-down_write-a.patch