From patchwork Tue Aug 26 10:28:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Punit Agrawal X-Patchwork-Id: 4780171 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C93BC9F383 for ; Tue, 26 Aug 2014 10:32:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C129C20142 for ; Tue, 26 Aug 2014 10:32:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ABFF420131 for ; Tue, 26 Aug 2014 10:32:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XME0m-0007tc-09; Tue, 26 Aug 2014 10:30:00 +0000 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21] helo=cam-smtp0.cambridge.arm.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XME0h-0007f7-Bz for linux-arm-kernel@lists.infradead.org; Tue, 26 Aug 2014 10:29:56 +0000 Received: from e102309-lin (e102309-lin.cambridge.arm.com [10.1.195.33]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with SMTP id s7QATSU9008296; Tue, 26 Aug 2014 11:29:28 +0100 Received: by e102309-lin (sSMTP sendmail emulation); Tue, 26 Aug 2014 11:29:28 +0100 From: Punit Agrawal To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/6] arm: Fix in-correct barrier usage in SWP{B} emulation Date: Tue, 26 Aug 2014 11:28:45 +0100 Message-Id: <1409048930-21598-2-git-send-email-punit.agrawal@arm.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1409048930-21598-1-git-send-email-punit.agrawal@arm.com> References: <1409048930-21598-1-git-send-email-punit.agrawal@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140826_032955_764336_DE94CA91 X-CRM114-Status: GOOD ( 10.10 ) X-Spam-Score: -2.3 (--) Cc: catalin.marinas@arm.com, Punit Agrawal , will.deacon@arm.com, Russell King X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to the ARM ARMv7, explicit barriers are necessary when using synchronisation primitives such as SWP{B}. The use of these instructions does not automatically imply a barrier and any ordering requirements by the software must be explicitly expressed with the use of suitable barriers. Based on this, remove the barriers from SWP{B} emulation. Cc: Russell King Signed-off-by: Punit Agrawal Acked-by: Will Deacon --- arch/arm/kernel/swp_emulate.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c index b1b8988..74117b5 100644 --- a/arch/arm/kernel/swp_emulate.c +++ b/arch/arm/kernel/swp_emulate.c @@ -141,14 +141,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data, while (1) { unsigned long temp; - /* - * Barrier required between accessing protected resource and - * releasing a lock for it. Legacy code might not have done - * this, and we cannot determine that this is not the case - * being emulated, so insert always. - */ - smp_mb(); - if (type == TYPE_SWPB) __user_swpb_asm(*data, address, res, temp); else @@ -161,13 +153,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data, } if (res == 0) { - /* - * Barrier also required between acquiring a lock for a - * protected resource and accessing the resource. Inserted for - * same reason as above. - */ - smp_mb(); - if (type == TYPE_SWPB) swpbcounter++; else