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


Groups > linux.kernel > #1696581

[PATCH 3.18 37/60] MIPS: Fix mips_atomic_set() retry condition

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 3.18 37/60] MIPS: Fix mips_atomic_set() retry condition
Date Tue, 25 Jul 2017 23:40:02 +0200
Message-ID <u7fIC-8eE-33@gated-at.bofh.it> (permalink)
References <u7dx7-6OD-3@gated-at.bofh.it>
X-Mailer git-send-email 2.13.3
User-Agent quilt/0.65
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 39
Organization linux.* mail to news gateway
X-Original-Cc Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, James Hogan <james.hogan@imgtec.com>, linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>
X-Original-Date Tue, 25 Jul 2017 12:16:28 -0700
X-Original-Message-ID <20170725191619.332858193@linuxfoundation.org>
X-Original-References <20170725191614.043749784@linuxfoundation.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1696581

Show key headers only | View raw


3.18-stable review patch.  If anyone has any objections, please let me know.

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

From: James Hogan <james.hogan@imgtec.com>

commit 2ec420b26f7b6ff332393f0bb5a7d245f7ad87f0 upstream.

The inline asm retry check in the MIPS_ATOMIC_SET operation of the
sysmips system call has been backwards since commit f1e39a4a616c ("MIPS:
Rewrite sysmips(MIPS_ATOMIC_SET, ...) in C with inline assembler")
merged in v2.6.32, resulting in the non R10000_LLSC_WAR case retrying
until the operation was inatomic, before returning the new value that
was probably just written multiple times instead of the old value.

Invert the branch condition to fix that particular issue.

Fixes: f1e39a4a616c ("MIPS: Rewrite sysmips(MIPS_ATOMIC_SET, ...) in C with inline assembler")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16148/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/kernel/syscall.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -140,7 +140,7 @@ static inline int mips_atomic_set(unsign
 		"1:	ll	%[old], (%[addr])			\n"
 		"	move	%[tmp], %[new]				\n"
 		"2:	sc	%[tmp], (%[addr])			\n"
-		"	bnez	%[tmp], 4f				\n"
+		"	beqz	%[tmp], 4f				\n"
 		"3:							\n"
 		"	.subsection 2					\n"
 		"4:	b	1b					\n"

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3.18 37/60] MIPS: Fix mips_atomic_set() retry condition Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-25 23:40 +0200

csiph-web