From patchwork Fri Feb 22 15:06:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tianyu Lan X-Patchwork-Id: 10826359 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 B8CB5180E for ; Fri, 22 Feb 2019 15:07:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A91E63123F for ; Fri, 22 Feb 2019 15:07:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CC9031356; Fri, 22 Feb 2019 15:07:01 +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 48B303123F for ; Fri, 22 Feb 2019 15:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727240AbfBVPG4 (ORCPT ); Fri, 22 Feb 2019 10:06:56 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:41618 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726278AbfBVPGz (ORCPT ); Fri, 22 Feb 2019 10:06:55 -0500 Received: by mail-pl1-f195.google.com with SMTP id y5so1217984plk.8; Fri, 22 Feb 2019 07:06:55 -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; bh=EiQBCSDAIf/suoeIwapm+FX4BR230o85XgcWooq6xpo=; b=oHeHpCpvC2AoMktGH/FylVXGTrHXAAlZwXTLNGNTPVr+jXY93hFWcuEeceYTyB2prt 2rvvFgZ3gQU9hBYqEtXQWn4hXd7/3XkuVewfkGv86mW/NUOf2IvLU9H7mEBwl9Gp1u5L +jVImO1D2WzSZMxc7RsGxQtHnhV52l0CIjRzNeg1ujDJqpuVFpblk6qFUaS5lAJagbAQ BAyxleQsFdr6Gar/VUDt0QtIf4RMlt73YvIZG7rrHMOcsQUVh68pS/QQCfbhRVvtNJN7 yZbM5BhQLh6tbXzh5iSAT/wgHpkQqs+pDJZ27Fh8wqM/R9hDywOjjUORLVOpG/utNIkI X0nw== 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; bh=EiQBCSDAIf/suoeIwapm+FX4BR230o85XgcWooq6xpo=; b=evbmmiQKDkKshru7L7eBmXk8wNApR7ZC+C9EtXjeaA7Q5oK5HSens0GRtmAoGezoXd BBjVUPT+c/tfJOxT/ji0tWFz4pQBDOq9CcOj27/Sno4ud1Yu8oFq0krDH+AitUTrACIZ p34WAD1FZQsQdqEs8neE2zmAjOVvygW4XbZpvRk1edfZrzE+X7rVPaaxk1x0ERg1YeJ1 PHRq6fZ46c9Q1NDuztFRT5ncVZrwyMcAm0EBM/akGY4pkpMBBT+/Zm1thOcSnnYPL8s8 oJbhd32gQsdWfXWxYILd5GJqL3L/J79CiqckRYjVAFHQgqYyO3OzX16SX9XGlZNgPlV5 Giow== X-Gm-Message-State: AHQUAua8QOkTot25HAxM0GvvR5KkaAc12kZztLYrPa7oJqlXAF8QYH1L jOhAePbmIqO2pNyaI2n91X4= X-Google-Smtp-Source: AHgI3IZbPWlYQzuwjEhbQFDPOboaR5xFVm1PNF+pNbeBeCaY7FX4MLfmcdiKb1W6D3NMvqNF02xA3A== X-Received: by 2002:a17:902:2de4:: with SMTP id p91mr4658872plb.215.1550848015074; Fri, 22 Feb 2019 07:06:55 -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.06.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Feb 2019 07:06:54 -0800 (PST) From: lantianyu1986@gmail.com X-Google-Original-From: Tianyu.Lan@microsoft.com Cc: Lan Tianyu , benh@kernel.crashing.org, bp@alien8.de, catalin.marinas@arm.com, christoffer.dall@arm.com, devel@linuxdriverproject.org, haiyangz@microsoft.com, hpa@zytor.com, jhogan@kernel.org, kvmarm@lists.cs.columbia.edu, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, kys@microsoft.com, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, marc.zyngier@arm.com, mingo@redhat.com, mpe@ellerman.id.au, paul.burton@mips.com, paulus@ozlabs.org, pbonzini@redhat.com, ralf@linux-mips.org, rkrcmar@redhat.com, sashal@kernel.org, sthemmin@microsoft.com, tglx@linutronix.de, will.deacon@arm.com, x86@kernel.org, michael.h.kelley@microsoft.com, vkuznets@redhat.com Subject: [PATCH V3 00/10] X86/KVM/Hyper-V: Add HV ept tlb range list flush support in KVM Date: Fri, 22 Feb 2019 23:06:27 +0800 Message-Id: <20190222150637.2337-1-Tianyu.Lan@microsoft.com> X-Mailer: git-send-email 2.14.4 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 patchset is to introduce hv ept tlb range list flush function support in the KVM MMU component. Flushing ept tlbs of several address range can be done via single hypercall and new list flush function is used in the kvm_mmu_commit_zap_page() and FNAME(sync_page). This patchset also adds more hv ept tlb range flush support in more KVM MMU function. This patchset is based on the fix patch "x86/Hyper-V: Fix definition HV_MAX_FLUSH_REP_COUNT". (https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1939455.html) Change since v2: 1) Fix calculation of flush pages in the kvm_fill_hv_flush_list_func() 2) Change the logic of setting/clearing last_level flag Change since v1: 1) Make flush list as a hlist instead of list in order to keep struct kvm_mmu_page size. 2) Add last_level flag in the struct kvm_mmu_page instead of spte pointer 3) Move tlb flush from kvm_mmu_notifier_clear_flush_young() to kvm_age_hva() 4) Use range flush in the kvm_vm_ioctl_get/clear_dirty_log() Lan Tianyu (10): X86/Hyper-V: Add parameter offset for hyperv_fill_flush_guest_mapping_list() KVM/VMX: Fill range list in kvm_fill_hv_flush_list_func() KVM/MMU: Introduce tlb flush with range list KVM/MMU: Use range flush in sync_page() KVM/MMU: Flush tlb directly in the kvm_mmu_slot_gfn_write_protect() KVM: Add kvm_get_memslot() to get memslot via slot id KVM: Use tlb range flush in the kvm_vm_ioctl_get/clear_dirty_log() KVM: Add flush parameter for kvm_age_hva() KVM/MMU: Use tlb range flush in the kvm_age_hva() KVM/MMU: Add last_level flag in the struct mmu_spte_page arch/arm/include/asm/kvm_host.h | 3 +- arch/arm64/include/asm/kvm_host.h | 3 +- arch/mips/include/asm/kvm_host.h | 3 +- arch/mips/kvm/mmu.c | 11 ++++++-- arch/powerpc/include/asm/kvm_host.h | 3 +- arch/powerpc/kvm/book3s.c | 10 +++++-- arch/powerpc/kvm/e500_mmu_host.c | 3 +- arch/x86/hyperv/nested.c | 4 +-- arch/x86/include/asm/kvm_host.h | 11 +++++++- arch/x86/include/asm/mshyperv.h | 2 +- arch/x86/kvm/mmu.c | 55 ++++++++++++++++++++++++++++++------- arch/x86/kvm/mmu.h | 7 +++++ arch/x86/kvm/paging_tmpl.h | 5 ++-- arch/x86/kvm/vmx/vmx.c | 18 ++++++++++-- arch/x86/kvm/x86.c | 16 ++++++++--- include/linux/kvm_host.h | 1 + virt/kvm/arm/mmu.c | 13 +++++++-- virt/kvm/kvm_main.c | 51 ++++++++++++++-------------------- 18 files changed, 156 insertions(+), 63 deletions(-)