Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1842608imm; Mon, 3 Sep 2018 10:52:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbFBVefJYhqFlfDNzftYvtCihk/PCMQdJdsdY/AjJxybTU1bIOCPXqlLxZ2oKEYk26zbkBq X-Received: by 2002:a62:ca0d:: with SMTP id n13-v6mr30858651pfg.69.1535997170780; Mon, 03 Sep 2018 10:52:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535997170; cv=none; d=google.com; s=arc-20160816; b=X6RKi0Uxc53skFo0j3cjJqjhocSzvJ9RIDO30lfiwZmeRGM0Xxe4KyO2sA/dcG8+b4 vg8eOmPQ46aC8RvY5Efy6g1pOoIZPnWC8Q70h4eTcbACXjxAO6a5WOqdhudYXWb8yEVV EVhSoJgpUtx2R3fTzSIbjNg3GdT6je6693PyNPL0QC4wD3qKJcK+AsoFnLC+1y0bpQlC /zozxJIUuw05BD30DucLGLggSVrj5AAXCpgEQITPhbpcDwvQaaPO9WfmLGh1meiarUoN RTjaaHUrwfn7ZIapEpXzHRH+ICS+/erJ9PMHBks6oxbsmNtqxBUPkxmw9WfGesynTNEx Aj4w== 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=KwNmLVMNZ2ibQE14hXw9tO95UR57yBxuyyfa3n26nF8=; b=DEY/DbzxbYvLY3iW0N8QPiUdbk2k8qdIarpkdvdGZ5FawucuH4H2ja92r9LomYJc3O 6jyjpIcHjByjl0MyYi3fHN0xQU4t0LrkMx/9vPPKW3bz3wZRZakowIDHW2vy0fSsgDs4 F7bZQ/CbLEdeEL99cOnXn82DyMzmH5aLu9x443DT4lBgVWcjqCI2SXPGBhywSWch2aF1 bxSAS8CAKFXMz8DedonIe3FRNwb0YjnlcEBB9ee/BaQgxjSPe+0pPdRLOfOh0q8ILnqm ftUT2AkGjWrOLyZOVSelvt8WwENRNdM0ePx9XsfIjiptJwLkuJ/ZNCtVdp9lyqsOcqvo BJJQ== 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 r18-v6si17869441pgj.194.2018.09.03.10.52.35; Mon, 03 Sep 2018 10:52:50 -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 S1728458AbeICVVu (ORCPT + 99 others); Mon, 3 Sep 2018 17:21:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38586 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728365AbeICVVs (ORCPT ); Mon, 3 Sep 2018 17:21:48 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 67382CFC; Mon, 3 Sep 2018 17:00:49 +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.4 51/80] KVM: arm/arm64: Skip updating PTE entry if no change Date: Mon, 3 Sep 2018 18:49:29 +0200 Message-Id: <20180903164936.189580418@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903164934.171677301@linuxfoundation.org> References: <20180903164934.171677301@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.4-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 --- arch/arm/kvm/mmu.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c @@ -961,6 +961,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 {