Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1110506imm; Wed, 1 Aug 2018 10:20:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdAkRl6DOeGLJyd9R7NuvphL8ns59xU42IzvMlNyrBFS9KtPPOWhtI5vEaHGMNC4Ws9+OXS X-Received: by 2002:a63:cb04:: with SMTP id p4-v6mr24727919pgg.197.1533144055798; Wed, 01 Aug 2018 10:20:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144055; cv=none; d=google.com; s=arc-20160816; b=UR+4kLGkCYX2Y4B7Wiy7FqR8m9jvYv6nBXXQFPkyR+tb6qU11he4/EFa2ULsTfQob2 lEep/cJ4m0lxa5jhmAo13cuyyNTVgCEYEQ9oiGXOc+rW6EHnww6RGDpsN4p7Rb/c0nV1 ZRvMgR0kJBJomNc+qB6Bf8Qoi3tAeNhaoHIVQLyv6ocxYTgYq+E75bDCcknS0Qx6zSq/ oRQuS4uQC+OGPDl/mj+1QZ53tC9FEtyC1Wu0g9BoHew0xWIoHEpT9do39FCj9aMXKhuI yBtfriWhliks32ZsbM3vFIHCjo0oOqVlON5zZFN8y0ZAlEy5qHX6TlLFPVUZcKFpt5OI 3j7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=8ORkE0+0Fzu06cjMr7P5KCbKT8xFKvdcGe7LwYGbv5Q=; b=dzd2Blx5QnITxfBz3hRJl97ZFNCuTgQ0S5tA8ddIx+zoM2f/2Vl0Fxp1AXBV2d2unN pLheH1niL627/i2ua4JOQ+kR8K9MuYySyO2J8dezloy8AMr0kqH3gFrODunZkc33NVt1 RTJa/NnmsMfnKdsSGKn52gQjmVV41bW0fScLmh8v2QCekafFM+fwsH3CjI86U6OYtWXF Hjr5hUdCX1MrZZA1rERGITxHuvfgt/E35xiJUNatWgxfa1Toqoz/pRMWykPGgQ1CLotq LB2TNTlI+i8Sa6y552cHm0muYdohH+S/Ed81W8qtA3Xb4XK/aPraPRj/8Ryc0ULX/noB C+HA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 144-v6si14342354pfw.95.2018.08.01.10.20.41; Wed, 01 Aug 2018 10:20:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404070AbeHATFO (ORCPT + 99 others); Wed, 1 Aug 2018 15:05:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47348 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404582AbeHATFN (ORCPT ); Wed, 1 Aug 2018 15:05:13 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F074ACC3; Wed, 1 Aug 2018 17:18:32 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Catalin Marinas , Sasha Levin Subject: [PATCH 4.14 134/246] arm64: cmpwait: Clear event register before arming exclusive monitor Date: Wed, 1 Aug 2018 18:50:44 +0200 Message-Id: <20180801165018.153296988@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Will Deacon [ Upstream commit 1cfc63b5ae60fe7e01773f38132f98d8b13a99a0 ] When waiting for a cacheline to change state in cmpwait, we may immediately wake-up the first time around the outer loop if the event register was already set (for example, because of the event stream). Avoid these spurious wakeups by explicitly clearing the event register before loading the cacheline and setting the exclusive monitor. Signed-off-by: Will Deacon Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/cmpxchg.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/arm64/include/asm/cmpxchg.h +++ b/arch/arm64/include/asm/cmpxchg.h @@ -229,7 +229,9 @@ static inline void __cmpwait_case_##name unsigned long tmp; \ \ asm volatile( \ - " ldxr" #sz "\t%" #w "[tmp], %[v]\n" \ + " sevl\n" \ + " wfe\n" \ + " ldxr" #sz "\t%" #w "[tmp], %[v]\n" \ " eor %" #w "[tmp], %" #w "[tmp], %" #w "[val]\n" \ " cbnz %" #w "[tmp], 1f\n" \ " wfe\n" \