Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1833793imm; Mon, 3 Sep 2018 10:37:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZQhjG9UItnARoXkT74cDjBT3p/zrLtQ81DYrCkBxlhY/+SucjwQtP8hCrNayl6rePuxI00 X-Received: by 2002:a62:7983:: with SMTP id u125-v6mr30316139pfc.177.1535996231586; Mon, 03 Sep 2018 10:37:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535996231; cv=none; d=google.com; s=arc-20160816; b=XuQag8vT1F7bIOLDBeZ0diV4KjsaomNeYD1mBDWd5LSY5RpvZMlwE8/qbQXqtNXNSb 2x/LycAXocNRPVCKAZgdo9Jo50naqPZZfvK1YQx9Gcg33CgL8d6bxvhji5046lCoqRdk wvHWTQT/O9EtzqEv7m86CyeYCr0tcQLrF+4zcMT0HVasCKQ6jDJwYt04wK2GzZyfavqh v5wPJXWMoc78RLeAsVZkZOWa+liSPtJRanJ1V5ydMgdjH45eJyraNaA/xSitaMPyKYcE DFaq/6QGLtcc0ehnnXAcwuCl0U7dOpdJenZenIOntRXgbwbO/llEFurNnw/ZmUf/A9Q6 Rrrw== 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=xKT5ywyXyggeR+G/ES9+airakylwtBYVRpWL5L0m3oU=; b=WVmw/mtUBPvcTSr60Mor44ECGngE+zxFqCURMYzKtWssHguf00DhuyJtVM4DjuVcy7 +w1u8FtDBQuD3P3eNvmdA6ew7aXybv/XcFJXQHE7rR15UCcsdOAODsMEevj0JjLMtDBI Lo8MmCrd/D8WO4kteEwl12zxgMpn7T4zkgtte9YEo/F7Y3dvwhu47dGVfViOkXy+cuKE p5BbViXkmw8/rA6JOPt5Z6EUXPw+Ev0KCym2blrqmCxrX9hd+y3PMxRj3sHeQt70biNB wiXezMFzzRiwyJ2FsrGf3I2X2Ale325TJDhxy4m3aVlyDr3jeVvELOohQE+lZZ9BetBo +1Cw== 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 p84-v6si19262559pfj.101.2018.09.03.10.36.56; Mon, 03 Sep 2018 10:37:11 -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 S1731578AbeICV5B (ORCPT + 99 others); Mon, 3 Sep 2018 17:57:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48052 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbeICV5A (ORCPT ); Mon, 3 Sep 2018 17:57:00 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9F969D1B; Mon, 3 Sep 2018 17:35:50 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suzuki Poulose , Christoffer Dall , Punit Agrawal , Marc Zyngier Subject: [PATCH 4.18 036/123] KVM: arm/arm64: Skip updating PTE entry if no change Date: Mon, 3 Sep 2018 18:56:20 +0200 Message-Id: <20180903165721.012024791@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165719.499675257@linuxfoundation.org> References: <20180903165719.499675257@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Punit Agrawal commit 976d34e2dab10ece5ea8fe7090b7692913f89084 upstream. When there is contention on faulting in a particular page table entry at stage 2, the break-before-make requirement of the architecture can lead to additional refaulting due to TLB invalidation. Avoid this by skipping a page table update if the new value of the PTE matches the previous value. Cc: stable@vger.kernel.org Fixes: d5d8184d35c9 ("KVM: ARM: Memory virtualization setup") Reviewed-by: Suzuki Poulose Acked-by: Christoffer Dall Signed-off-by: Punit Agrawal Signed-off-by: Marc Zyngier Signed-off-by: Greg Kroah-Hartman --- virt/kvm/arm/mmu.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/virt/kvm/arm/mmu.c +++ b/virt/kvm/arm/mmu.c @@ -1118,6 +1118,10 @@ static int stage2_set_pte(struct kvm *kv /* Create 2nd stage page table mapping - Level 3 */ old_pte = *pte; if (pte_present(old_pte)) { + /* Skip page table update if there is no change */ + if (pte_val(old_pte) == pte_val(*new_pte)) + return 0; + kvm_set_pte(pte, __pte(0)); kvm_tlb_flush_vmid_ipa(kvm, addr); } else {