From patchwork Tue Sep 12 15:39:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 112322 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp87562edi; Tue, 12 Sep 2017 08:40:07 -0700 (PDT) X-Google-Smtp-Source: ADKCNb4z/hMT8bjmvChEVQpA1vEHVWJQTJCbwGdKnqGc0PW9q5XvPMRB2uHWttfArdsE51WFXA6f X-Received: by 10.84.233.70 with SMTP id k6mr18323140plt.38.1505230807202; Tue, 12 Sep 2017 08:40:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505230807; cv=none; d=google.com; s=arc-20160816; b=DurIjhy84BxchLqEIePJM0qTMXZwwYskZX//jqgxu7wuaV8mdLgDYrhrcmtW7Ikwdx 7XU/RucAlmxOQBPVTt0uE8XPlRjlEtlwj+spWA9jB+P2MkTV/jtW5d3fF/6s0ihIoByj Ct179I4XRYSQZRX5fqdV9/XiP3oHNClhqTF9QUZwPMqA2h73sWWb0H15d4Y4VdAYNKA+ 14CrL+xiaivfuL+1G7kPXUThe1VZkkmu0D+7KfTcqBESXqye2Azvfx8Se2TCk0vsyXFi 4WuhfP3C91iO/lDBnjVWiAZvyQSWVJF+imdUhj8UN5DiRoXg0+TpGHbxrK7insKqotwz Hz+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=zrzTsM34EXZs9AU+2Q+WBFXFCrzFGt/cOaWzeqBzNUI=; b=gJ6OxS/eYuXv0V7+/yIiPMx2+slz1k3GXCTQM8sCIvpcBbBJOLl/UVl7KL1A3IHT8n ot/rHgwGiuu/PTwKYsZSZOOtntWQnH9BCpDdTuEbcwpna+9sumxtXw0bZncM0LZPcdCU koCc0gAWucym9m2SX+HVJglJP4+7E0jnd3SOKWVxsnOE9Chp7YvUYKJRb+gDFwwb6eM5 C7wl0rnVVJkSXv83uTuVXpkkG5/BBJyxEO0v9dWHvEF0cOEB4hhvKdvF4PnRYyMRXmYK +ltgFQejcEaBoZPqEM/KvPRuBO51kB2fuiQiCs8fYn5HbtRqidrg2Tlw6UKqQP64Oo11 NA9Q== 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 e1si1359412pln.792.2017.09.12.08.40.06; Tue, 12 Sep 2017 08:40:07 -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 S1751751AbdILPkD (ORCPT + 26 others); Tue, 12 Sep 2017 11:40:03 -0400 Received: from mga02.intel.com ([134.134.136.20]:55809 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751638AbdILPjy (ORCPT ); Tue, 12 Sep 2017 11:39:54 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Sep 2017 08:39:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,383,1500966000"; d="scan'208";a="1194271525" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Sep 2017 08:39:48 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 6430C473; Tue, 12 Sep 2017 18:39:47 +0300 (EEST) From: "Kirill A. Shutemov" To: Andrew Morton , Vlastimil Babka , Vineet Gupta , Russell King , Will Deacon , Catalin Marinas , Ralf Baechle , "David S. Miller" , "Aneesh Kumar K . V" , Martin Schwidefsky , Heiko Carstens , Andrea Arcangeli Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A . Shutemov" Subject: [PATCHv3 04/11] arm64: Provide pmdp_establish() helper Date: Tue, 12 Sep 2017 18:39:34 +0300 Message-Id: <20170912153941.47012-5-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170912153941.47012-1-kirill.shutemov@linux.intel.com> References: <20170912153941.47012-1-kirill.shutemov@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Catalin Marinas We need an atomic way to setup pmd page table entry, avoiding races with CPU setting dirty/accessed bits. This is required to implement pmdp_invalidate() that doesn't lose these bits. Signed-off-by: Catalin Marinas Signed-off-by: Kirill A. Shutemov --- arch/arm64/include/asm/pgtable.h | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.14.1 diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index bc4e92337d16..09bb86533d32 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -663,6 +663,13 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm, { ptep_set_wrprotect(mm, address, (pte_t *)pmdp); } + +#define pmdp_establish pmdp_establish +static inline pmd_t pmdp_establish(struct vm_area_struct *vma, + unsigned long address, pmd_t *pmdp, pmd_t pmd) +{ + return __pmd(xchg_relaxed(&pmd_val(*pmdp), pmd_val(pmd))); +} #endif extern pgd_t swapper_pg_dir[PTRS_PER_PGD];