From patchwork Sat Feb 2 01:38:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tianyu Lan X-Patchwork-Id: 10793983 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 A712E6C2 for ; Sat, 2 Feb 2019 01:39:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9994032B54 for ; Sat, 2 Feb 2019 01:39:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8CAB632B7D; Sat, 2 Feb 2019 01:39:41 +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 4DF4432B54 for ; Sat, 2 Feb 2019 01:39:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727844AbfBBBje (ORCPT ); Fri, 1 Feb 2019 20:39:34 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:45959 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727210AbfBBBjd (ORCPT ); Fri, 1 Feb 2019 20:39:33 -0500 Received: by mail-pf1-f194.google.com with SMTP id g62so4074978pfd.12; Fri, 01 Feb 2019 17:39:33 -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=S4ftVHg5FlZ3hwaB6myWBWPeAhGqQEGBON/Y0CtAvlA=; b=agQsC2QdMvpn4C7uhQZI3oL3d4Tompeso7z2aiQkFncmX4JWg/uBamjV6PdFYhVR3k oX2uDQAPGf5vd3JMceHjWd3zOb6honNJovwJzyFsDilYk3h4kPDusmb8mZ7ZEYleqcSE 9uBme4VReWk1RL9qbeNyI+Z8+CHg7tBC670AHNS9Ixurcy4RidGTlBfGSEeSBVskoBE4 kDDouF+hsf/IUxkz3wWDqCor8SL1zRKNxx8sFfe0FC1ZLM9D8d8rtxmhZTbUJwEcx94e uAcqSt+1r9k0d5su0uGKjFvdvzQFGnPHQYuPGbaLZGAetRUCfjM2O99LcXRklvHcAi42 iNaw== 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=S4ftVHg5FlZ3hwaB6myWBWPeAhGqQEGBON/Y0CtAvlA=; b=WxQlOAylkl6JYpWwrvkZ871XamxSsihmKmzsRKTgZicVIyJCRsyeBHZ4LQfg1eV3jd +WJ0NvJewV0ZsuHfH+SgJrNzz9LViTZYjihUWLxDAwK09duLOxvZMWxuTQZ+RpI8Ac8O Cy/548aPx8nDKioiXd2CLF1mlHeHF0/n0rbYgQegnSExYMTwo137gKT8NnJv70vF001+ GdxFOE9ElvdxzCDncsGta+gFohsxuy5T/xiaXS10XFjuLGfPPsnH5LregpIGV2RU26Dc x9dWoTT9shZ040ScoeAUaCSkvuslHNyFg61L6+0cMhe56YvuzIOOiHinISDz2CQamMBB pIig== X-Gm-Message-State: AJcUukdl3Mh5RAkcgtc69MOJ3rnExXzAIhSNR8kcrLihw3AfyN01S52e Vmex4xRZswUpOFHl8rdJxfQ= X-Google-Smtp-Source: ALg8bN6ijptjqFitOy96WFBZeRXgkg4rQ+4Jg8H6p266gaeKh2xdTdOvDwbEn+uVqVIuUB2t5iGdSg== X-Received: by 2002:a62:5910:: with SMTP id n16mr41321495pfb.128.1549071572866; Fri, 01 Feb 2019 17:39:32 -0800 (PST) Received: from localhost.corp.microsoft.com ([167.220.255.67]) by smtp.googlemail.com with ESMTPSA id d3sm9183425pgl.64.2019.02.01.17.39.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Feb 2019 17:39:32 -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 V2 6/10] KVM/MMU: Flush tlb directly in the kvm_mmu_slot_gfn_write_protect() Date: Sat, 2 Feb 2019 09:38:22 +0800 Message-Id: <20190202013825.51261-7-Tianyu.Lan@microsoft.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20190202013825.51261-1-Tianyu.Lan@microsoft.com> References: <20190202013825.51261-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 flush tlb directly in the kvm_mmu_slot_gfn_write_protect() when range flush is available. Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d57574b49823..6b5e9bed6665 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1718,6 +1718,11 @@ bool kvm_mmu_slot_gfn_write_protect(struct kvm *kvm, write_protected |= __rmap_write_protect(kvm, rmap_head, true); } + if (write_protected && kvm_available_flush_tlb_with_range()) { + kvm_flush_remote_tlbs_with_address(kvm, gfn, 1); + write_protected = false; + } + return write_protected; }