Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1421130 > unrolled thread

[PATCH 3.16 028/114] s390/spinlock: avoid yield to non existent cpu

Started byBen Hutchings <ben@decadent.org.uk>
First post2016-06-13 20:50 +0200
Last post2016-06-13 20:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.16 028/114] s390/spinlock: avoid yield to non existent cpu Ben Hutchings <ben@decadent.org.uk> - 2016-06-13 20:50 +0200

#1421130 — [PATCH 3.16 028/114] s390/spinlock: avoid yield to non existent cpu

FromBen Hutchings <ben@decadent.org.uk>
Date2016-06-13 20:50 +0200
Subject[PATCH 3.16 028/114] s390/spinlock: avoid yield to non existent cpu
Message-ID<rJF5V-1G3-55@gated-at.bofh.it>
3.16.36-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Heiko Carstens <heiko.carstens@de.ibm.com>

commit 8497695243f70fd19ed6cf28b63584f1b608b5f9 upstream.

arch_spin_lock_wait_flags() checks if a spinlock is not held before
trying a compare and swap instruction. If the lock is unlocked it
tries the compare and swap instruction, however if a different cpu
grabbed the lock in the meantime the instruction will fail as
expected.

Subsequently the arch_spin_lock_wait_flags() incorrectly tries to
figure out if the cpu that holds the lock is running. However it is
using the wrong cpu number for this (-1) and then will also yield the
current cpu to the wrong cpu.

Fix this by adding a missing continue statement.

Fixes: 470ada6b1a1d ("s390/spinlock: refactor arch_spin_lock_wait[_flags]")
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/s390/lib/spinlock.c | 1 +
 1 file changed, 1 insertion(+)

--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -75,6 +75,7 @@ void arch_spin_lock_wait_flags(arch_spin
 			if (_raw_compare_and_swap(&lp->lock, 0, cpu))
 				return;
 			local_irq_restore(flags);
+			continue;
 		}
 		/* Check if the lock owner is running. */
 		if (!smp_vcpu_scheduled(~owner)) {

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web