From patchwork Fri Feb 22 15:06:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tianyu Lan X-Patchwork-Id: 10826379 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B9781180E for ; Fri, 22 Feb 2019 15:07:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAA463123F for ; Fri, 22 Feb 2019 15:07:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E02F313CD; Fri, 22 Feb 2019 15:07:33 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59B0B31358 for ; Fri, 22 Feb 2019 15:07:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727409AbfBVPH2 (ORCPT ); Fri, 22 Feb 2019 10:07:28 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:41827 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726838AbfBVPH2 (ORCPT ); Fri, 22 Feb 2019 10:07:28 -0500 Received: by mail-pf1-f194.google.com with SMTP id d25so1237391pfn.8; Fri, 22 Feb 2019 07:07:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HSIeB4k5ZuogmL6MUD/u+Ar8YyEEuP4vsoidGitcBOo=; b=VFEDarizmQAexjrnIXw10DNn/NEU/q3swR8bwAjLeGeWR5tr50z2EvERNhdjvyBtb4 VqcDze6oJyEG2pknFT+FiETqiVnE0DZHnLwja3h0uY8qOOjM21+Dp6SLpG/BC3cE4h81 SF/psiWa1QApresuj0e8ND3u+47m/GWHAnUBUNUC7nvhjODQgJkjJ6VL5W9Z5qzpBEql aj+3/jBXo1eCh94oYlGSFb8sc69YJn3TYkh/EmPjUsk5AMD6kLLfgTmUnd3sAw1vBVnr hJaY7uoZAfxkdaMxF06564Gne0Mr7a2eQI5ZiDFFUQvgZkp3OVmUBVZyCVYSG/kRWDXN qDFA== 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=HSIeB4k5ZuogmL6MUD/u+Ar8YyEEuP4vsoidGitcBOo=; b=LfkCJR/JdbuCXVEMq/MSzBOi8cuezfKkTWDoin8H2Yb4hjzhLv5dleDJ6sLaw2Yxbt ffRIuDY+I/0j0dGSKpWLPe62lOP+vRq0eNIH7ZM7wJPdkCL5e4KpW04oPt0PHBJJ8Oxj 321bKu/vSMIoxLvD6XVTw0reE+TrkdhF8OoOJ07QydMhWZRTOC5a6HljXbs7N4ySI1KS ljQTW2NGEWQ8pmniCopt1mws9QhtLDbrSV0W8wPycUvvtOhhJZdU9Ih4KCzRGz7dvyGO ea3afExj7q+fur2WsT5AjaOwzb76BvmIEg2elU+6mHR0Kk3PSRhqwfmRgSgHNuTLuFrZ AsNw== X-Gm-Message-State: AHQUAublPNughAlHtmTeAIPh0hOmIL1XuZiUgGmjnioaEaePxcyzmyeJ wXTaPXY83CPyl8xaGE7DCTo= X-Google-Smtp-Source: AHgI3IYeKFBy5DfEgi7+NoEfVT1WeWulgurOSdqM73OPfGXKYCvFjRfn6bTV8zsuwtVzgFf4mlVMaQ== X-Received: by 2002:a63:2ccb:: with SMTP id s194mr4379235pgs.214.1550848047046; Fri, 22 Feb 2019 07:07:27 -0800 (PST) Received: from localhost.corp.microsoft.com ([167.220.255.67]) by smtp.googlemail.com with ESMTPSA id a4sm6151780pga.52.2019.02.22.07.07.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Feb 2019 07:07:26 -0800 (PST) From: lantianyu1986@gmail.com X-Google-Original-From: Tianyu.Lan@microsoft.com Cc: Lan Tianyu , christoffer.dall@arm.com, marc.zyngier@arm.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, jhogan@kernel.org, ralf@linux-mips.org, paul.burton@mips.com, paulus@ozlabs.org, benh@kernel.crashing.org, mpe@ellerman.id.au, pbonzini@redhat.com, rkrcmar@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, michael.h.kelley@microsoft.com, kys@microsoft.com, vkuznets@redhat.com Subject: [PATCH V3 4/10] KVM/MMU: Use range flush in sync_page() Date: Fri, 22 Feb 2019 23:06:31 +0800 Message-Id: <20190222150637.2337-5-Tianyu.Lan@microsoft.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20190222150637.2337-1-Tianyu.Lan@microsoft.com> References: <20190222150637.2337-1-Tianyu.Lan@microsoft.com> To: unlisted-recipients:; (no To-header on input) Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lan Tianyu This patch is to use range flush to flush tlbs of input struct kvm_mmu_page in the sync_page(). If range flush is not available, kvm_flush_remote_tlbs_with_address() will call kvm_flush_remote_tlbs(). Signed-off-by: Lan Tianyu --- arch/x86/kvm/paging_tmpl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 6bdca39829bc..768c5c64e3f8 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -1033,8 +1033,9 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp) true, false, host_writable); } - if (set_spte_ret & SET_SPTE_NEED_REMOTE_TLB_FLUSH) - kvm_flush_remote_tlbs(vcpu->kvm); + + kvm_flush_remote_tlbs_with_address(vcpu->kvm, sp->gfn, + KVM_PAGES_PER_HPAGE(sp->role.level + 1)); return nr_present; }