From patchwork Wed Jan 31 09:34:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10193775 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2BF1F60383 for ; Wed, 31 Jan 2018 10:09:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A4032808F for ; Wed, 31 Jan 2018 10:09:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EE8B28514; Wed, 31 Jan 2018 10:09:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E6F62808F for ; Wed, 31 Jan 2018 10:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=pljVi7THsJbIZug0HEZE7JCMic2ed/JdCgQU8hYF3d8=; b=rqvftFqWALYO0n0r4QQEnzSn1F /IaZcPoAG3lg6s1/MofmsL6gGY0OIGEyuA8gByWC2FeZCXgw5w9Ao5SRzdSQmBNxy6a9XjNfA9sry kgt0hZA3WORL1+BsuAl+qnzGQa0lIK7SGf35df35eiBaTM8CRaO8TVrkc/wgTF0TdTn0WuAU56vS2 YKOzpY2frny/Z+vi4MGSQl8tb2xhvW7C9dVDagpMyk1AzNxKX5ibTI/UZT4ZZFh5lIfqdUWO3nAUl Re1f22tOZE71vQPPaWfqvTGXbRA2hNUZuu885DTtuS4RW2EJ+B6LnbFd/mMnFXUhv75GW8tEq8Vs5 azvoYGTw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1egpK6-0007qh-V0; Wed, 31 Jan 2018 10:08:58 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1egpK5-0007pG-3I for linux-arm-kernel@bombadil.infradead.org; Wed, 31 Jan 2018 10:08:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6O9CvNG1c1yy9n//a/qKWp56sLhf7FSCKaw1PrsQjfw=; b=dLLlSx/FhFG4ERo9fLkWtUtbH DHvKjKzYFcYEtIfC/IuXNiO6FyG3qN04rZUqN53juAi6L3f0U4GdP5XClzbO3gqa5VM+E3LSWGR30 vAhttXDzAzVGn93PLAks0TLoWov23l1uXe5hQUvPVV1AkRA6xK+8/d9uhi6Asl7KOs7RBUkYsX0SF FKGTGv5VaprRjGFjWqYSBgglEMcIv6pGNDmz2YW5l5YVi/V2sTPZ4LRvXxCGkmBsXKVM4vJWKoUY0 bqK3duigQgJEYehqWGAWeH5o14H6Q+k7l5OaHwKxTQtl4DMEvoUwHauI+cOsZoUjC5uKjZBI5CBbb UO/x3ezBA==; Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by merlin.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1egoo7-00066E-Os for linux-arm-kernel@lists.infradead.org; Wed, 31 Jan 2018 09:36:01 +0000 Received: by mail-wm0-x242.google.com with SMTP id i186so6667654wmi.4 for ; Wed, 31 Jan 2018 01:35:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6O9CvNG1c1yy9n//a/qKWp56sLhf7FSCKaw1PrsQjfw=; b=EH53OFhcOgalBZ7E0MUmbEvTVdL8awEohKBZeB9yMZgitq2hlzqSOTALgMg2rUOEZO rJ+1hdvaUw+FiY3/GEHBhdwoTgkRkzaBZvWy7YtgKt6/pjMRkEtpTOCJhgFJKeTQ5eUE nG2tyQq8Phfpnf2DArSzQTVjy04qtnNj07Y08= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6O9CvNG1c1yy9n//a/qKWp56sLhf7FSCKaw1PrsQjfw=; b=kRXMFxVnsix2yP1dH2CPvmdLNnEcZF0iwJr5oRG3Xcnu+6IuYUMn6noHrqjHz7q7DP mNf/jmNtMFRCD/DYDJ3dpONBkUqZKtTzvCSBQ6EXqeC7rlXPKvgOnSI8lsS8DAhdt8iV qY6rBWIWE67bcpbO8AzlddfkvPbVFghTPe9/dMM59y5upSFhlHsHcXaMJq3WokaqZ2Bw Jix7nq+KiwDQOjRRTO4i5snKJNDTFYHRUwBq5ZvoSUiR9iAGIlV3eCjTpXsnX48A865U Rd0I+UaAYo3uUQugVu2Vo/5e2Svddb+PrrNiGPZpjfvp2CX0Ve5gAZRivOywSACaVHQn vcSw== X-Gm-Message-State: AKwxytf4XeQTg4ChzPeSkRp9Zz7xpkWqloQ7tFjUKtY2IDcA4T8SHFlv y/4iR8g4rwsHqR7WYYK2mbTZww== X-Google-Smtp-Source: AH8x226eR1UcLhMkA27w9jxXmMZzRKuPeMg8yPyy6iaS1ETpEiwKE5VyzGO7czW08Wdph4g8dxxbhg== X-Received: by 10.80.142.25 with SMTP id 25mr39458808edw.127.1517391340131; Wed, 31 Jan 2018 01:35:40 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id z2sm10247837edc.50.2018.01.31.01.35.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jan 2018 01:35:39 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 19/28] KVM: arm/arm64: Only clean the dcache on translation fault Date: Wed, 31 Jan 2018 10:34:58 +0100 Message-Id: <20180131093507.22219-20-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180131093507.22219-1-christoffer.dall@linaro.org> References: <20180131093507.22219-1-christoffer.dall@linaro.org> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc Zyngier The only case where we actually need to perform a dcache maintenance is when we map the page for the first time, and subsequent permission faults do not require cache maintenance. Let's make it conditional on not being a permission fault (and thus a translation fault). Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/mmu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c index 0417c8e2a81c..f956efbd933d 100644 --- a/virt/kvm/arm/mmu.c +++ b/virt/kvm/arm/mmu.c @@ -1400,7 +1400,9 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, new_pmd = kvm_s2pmd_mkwrite(new_pmd); kvm_set_pfn_dirty(pfn); } - clean_dcache_guest_page(vcpu, pfn, PMD_SIZE); + + if (fault_status != FSC_PERM) + clean_dcache_guest_page(vcpu, pfn, PMD_SIZE); if (exec_fault) { new_pmd = kvm_s2pmd_mkexec(new_pmd); @@ -1416,7 +1418,9 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, kvm_set_pfn_dirty(pfn); mark_page_dirty(kvm, gfn); } - clean_dcache_guest_page(vcpu, pfn, PAGE_SIZE); + + if (fault_status != FSC_PERM) + clean_dcache_guest_page(vcpu, pfn, PAGE_SIZE); if (exec_fault) { new_pte = kvm_s2pte_mkexec(new_pte);