Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1827696imm; Mon, 3 Sep 2018 10:28:05 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbAeP93kzBNiQ6P8UHeI2muynIo94LOMSk7CB+A6xyNJnp8/AqStWuqiHfATO9G9M4o8iMr X-Received: by 2002:a63:5204:: with SMTP id g4-v6mr27026055pgb.274.1535995685758; Mon, 03 Sep 2018 10:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995685; cv=none; d=google.com; s=arc-20160816; b=mrhz91BbOYXQn19DKLO8bXICcDT6Gh5SDDW7t6c9+H/lZ1CUemwnZLM6ecjyqwyWHy amC1c+zUL0ExcUnrBgPqiHT0jr1bqANuJ2EuEIhjPIit+pnceXGIqr7dbLg64IUBy1VU f6Dutd4JjQSb6u5LaKgfIkDDGj3t4gd7tTINNIDen1WGbX8f83vvOScPm8lWM7hO9mKF Amlrt6qJ0sr0f3Niit/Suy8r2e4AGI6XpgzeBRHSbUVZZ1+wJbqwnr7F/2qa8DawOP6X ClSyibC23xxGwLK+MFHVjAl8SiGmh3DjvYPz0q0SVFOyvijFei6QXmPTkdSU/UVfhW8l 1ICA== 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=23E5Ghl8bwjSdPEvdiaKG//2KuTmzcHHJlrL+I3WUzA=; b=vG57/cK4kBuPZJh/VXJiLBL9sZNcoDe7OpTQYWozg2wF58nqjKxmTFNEzawQ16OtfW 3RYbFwe81YlM0ZGEww/67FBf3pkHPjBz1qSDWcbo/+Ng1GJYhbVvJ44aPEFeiib5f2J/ XsdUEnHeffEclMfpITI+6iprJoEb/hVbFJQ9UxvbAiP7Vl2WHcB1ZlrLNu1Lp9bqaUAo 01tZyOdb2HO6Dlf33SK3UqLaMALmNFi/Jk5Bp8g0fFfQbyKKxUsKPVcIJgae5MfjL4jR qDbrwfxGqDblsgpUrbLL5k6gLqaZk+ROCUuQzeEWZXwj21/qDg9iWeVOryuaMMMQV++0 s+Tg== 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 a84-v6si19308449pfj.300.2018.09.03.10.27.50; Mon, 03 Sep 2018 10:28:05 -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 S1730831AbeICVrd (ORCPT + 99 others); Mon, 3 Sep 2018 17:47:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45894 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728541AbeICVrc (ORCPT ); Mon, 3 Sep 2018 17:47:32 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8C409D24; Mon, 3 Sep 2018 17:26:24 +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.14 101/165] KVM: arm/arm64: Skip updating PTE entry if no change Date: Mon, 3 Sep 2018 18:56:27 +0200 Message-Id: <20180903165700.585005789@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@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: 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 @@ -985,6 +985,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 {