From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, T_DKIMWL_WL_HIGH autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF03CC4321E for ; Mon, 10 Sep 2018 08:38:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5A36C2086B for ; Mon, 10 Sep 2018 08:38:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microsoft.com header.i=@microsoft.com header.b="ReevAI5r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A36C2086B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=microsoft.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728071AbeIJNb2 (ORCPT ); Mon, 10 Sep 2018 09:31:28 -0400 Received: from mail-sg2apc01on0113.outbound.protection.outlook.com ([104.47.125.113]:28222 "EHLO APC01-SG2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727488AbeIJNb1 (ORCPT ); Mon, 10 Sep 2018 09:31:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6SH7bYwvFrKYhRncnSi+HAPsCvUzaO9fKNNiRueHzgE=; b=ReevAI5r70nCrQUUb10oPAtEQLM83jJ7peVqCeRDF0c4OSIyglPNCtwsyNyRMtbvQeulfGsIFTsBdu7AFCRoIjtJ9D+TuOfVtiSGi8s4s2OYfG9Dz/BK+O0vpJMLiq/sDRpAplLJnpNx9ta4ZHeHDeXQBUC8pdQlMPp0T+T48/c= Received: from HK0P153MB0129.APCP153.PROD.OUTLOOK.COM (52.133.156.18) by HK0P153MB0097.APCP153.PROD.OUTLOOK.COM (52.133.156.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.5; Mon, 10 Sep 2018 08:38:21 +0000 Received: from HK0P153MB0129.APCP153.PROD.OUTLOOK.COM ([fe80::194c:c2f9:171:1890]) by HK0P153MB0129.APCP153.PROD.OUTLOOK.COM ([fe80::194c:c2f9:171:1890%5]) with mapi id 15.20.1143.010; Mon, 10 Sep 2018 08:38:21 +0000 From: Tianyu Lan CC: Tianyu Lan , "devel@linuxdriverproject.org" , Haiyang Zhang , "hpa@zytor.com" , "kvm@vger.kernel.org" , KY Srinivasan , "linux-kernel@vger.kernel.org" , "mingo@redhat.com" , "pbonzini@redhat.com" , "rkrcmar@redhat.com" , Stephen Hemminger , "tglx@linutronix.de" , "x86@kernel.org" , "Michael Kelley (EOSG)" , vkuznets , Jork Loeser Subject: [PATCH 00/13] x86/KVM/Hyper-v: Add HV ept tlb range flush hypercall support in KVM Thread-Topic: [PATCH 00/13] x86/KVM/Hyper-v: Add HV ept tlb range flush hypercall support in KVM Thread-Index: AQHUSOGhPBr369CIR06oyti6PMRcCA== Date: Mon, 10 Sep 2018 08:38:21 +0000 Message-ID: <20180910083806.65177-1-Tianyu.Lan@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Tianyu.Lan@microsoft.com; x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;HK0P153MB0097;6:Om+nfNGi5yuhFDvtBBkCi2qrbkCCIrywjX7LQ5blwGZKCPJFIHS75YulmfEIj6ulbOThvk/or9iD5Yv/RsX6UoJmQQRKQyH7lyS90BgDC5Iz+KiW5ixjigWW9dvoc8y6bIfDRmvJaTeeIiepZH48HW/ym8oqGhnG9sGdaBlTQIQedT++yAfjhGPtTOtGxjfdCxY+0a8zun6BrqitKwlA9a5IcamVJEkIxFW9D9kuYAL7eG3vHgWg9x+JGge2JBP5ke2M3Wi3wHzGXO9GnaUlsxQJtOfo9ljw1QHk77OPlZr54ekwapBFgOD8qvGgsqbVqmOo0v6Ig3ParSRnRV9oujvEm5Ag6cXTL1zNUEZMMQA6ulse3R05nSTbkzOtxju1NnTbaci35TBr8IO9WfwldsMHWWqXJcnKSeWco6NRtM+3vmvt1h+x1VvCFKMyX/Aw5gVSjPFEd6Al/srAUmXpDg==;5:/AZvcjNh+oJaA92x+lgBXX+DdGBP9wZNXNTElfXjd3gqGMwHY4LOshkZWYKzUdy0iytalzgwavkbQ3O9ukKZKk9uV8XvQEWUlgqyQ/YfNseNYijmMoB3nFNQYNHAVFqEW1AN2U+ZN8843BXQFV2sYtp3KyyLqAGdWYPATvjtKww=;7:Sz9BQZnFuITIyJKDGg4GHm3uabVxxJCcUwdr+vY1Kp06Y8XMQsZK6xIxDQvqK/GCzZAAAGnNoxv0BCSVCZwO8ELoO7vYL7wbGkG7/fPbcVNLuiL6M2HOGvZ/ADUHPAz4i2AcfXQE5sN7mLxRYmYRuRGUZqz6QdpbzpPOiYx/7MEt/GkBjNi74fqDpOcyX5MFUHg7is5t+WD0/ARbAqf2bA0Nf+2gxztpLl7fjZBOHWklSiPtgTN1dALIBXjq0eEh x-ms-office365-filtering-correlation-id: fd4abdf3-50a1-49d5-6284-08d616f8c41a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4618075)(2017052603328)(7193020);SRVR:HK0P153MB0097; x-ms-traffictypediagnostic: HK0P153MB0097: x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(788757137089); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699050);SRVR:HK0P153MB0097;BCL:0;PCL:0;RULEID:;SRVR:HK0P153MB0097; x-forefront-prvs: 07915F544A x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(366004)(396003)(376002)(39850400004)(136003)(199004)(189003)(4326008)(68736007)(107886003)(109986005)(25786009)(81166006)(8936002)(81156014)(8676002)(86612001)(86362001)(102836004)(22452003)(26005)(2906002)(6506007)(53936002)(1076002)(10090500001)(97736004)(5250100002)(6512007)(6436002)(256004)(6486002)(2900100001)(14454004)(10290500003)(99286004)(2616005)(478600001)(476003)(316002)(36756003)(54906003)(6116002)(486006)(106356001)(105586002)(3846002)(1671002)(305945005)(7416002)(7736002)(59246006)(72206003)(66066001)(5660300001);DIR:OUT;SFP:1102;SCL:1;SRVR:HK0P153MB0097;H:HK0P153MB0129.APCP153.PROD.OUTLOOK.COM;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ecx8dEaxDVXsCLSnYxWF0gPQkIf5+4yOJ+qY59+73kYtJUI1wxZVEoBpxhRrOy+I2J9oJ7nLzK8s/Fix13R+T00kQe8Mkf5/JlfAsSNZyfaIvxdUBfNgH9A6zEfXbkBVsq9KllzNO1rS0TlPEQjlvt9036LuzVZhLEWc6C26zyFZNGQXoxG4vpXaZcM989MHSXsMVigvnjMDRLT2oLL2UnWb8gYSiQlk6Um7egRxPKNETo45boMfruHOwz/hE0QpLkymfR/fxZ/nGbPp9RG9KqUTqMZC/sxrHnf2G8I+uCp5Wmtsd38w9Ucc278vwJgofh2HQgEL8gCvHvB/9n8g/5G9gxIBMpC4lNwUF5NTetg= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd4abdf3-50a1-49d5-6284-08d616f8c41a X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Sep 2018 08:38:21.2734 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK0P153MB0097 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For nested memory virtualization, Hyper-v doesn't set write-protect L1 hypervisor EPT page directory and page table node to track changes=20 while it relies on guest to tell it changes via HvFlushGuestAddressLlist hypercall. HvFlushGuestAddressLlist hypercall provides a way to flush EPT page table with ranges which are specified by L1 hypervisor. If L1 hypervisor uses INVEPT or HvFlushGuestAddressSpace hypercall to flush EPT tlb, Hyper-V will invalidate associated EPT shadow page table and sync L1's EPT table when next EPT page fault is triggered. HvFlushGuestAddressLlist hypercall helps to avoid such redundant EPT page fault and synchronization of shadow page table. Lan Tianyu (13): KVM: Add tlb_remote_flush_with_range callback in kvm_x86_ops KVM/MMU: Add tlb flush with range helper function KVM: Replace old tlb flush function with new one to flush a specified range. KVM/MMU: Flush tlb directly in the kvm_handle_hva_range() KVM/MMU: Flush tlb directly in the kvm_zap_gfn_range() KVM/MMU: Flush tlb directly in kvm_mmu_zap_collapsible_spte() KVM: Add flush_link and parent_pte in the struct kvm_mmu_page KVM: Add spte's point in the struct kvm_mmu_page KVM/MMU: Replace tlb flush function with range list flush function x86/hyper-v: Add HvFlushGuestAddressList hypercall support x86/Hyper-v: Add trace in the hyperv_nested_flush_guest_mapping_range() KVM/VMX: Change hv flush logic when ept tables are mismatched. KVM/VMX: Add hv tlb range flush support arch/x86/hyperv/nested.c | 111 +++++++++++++++++++++++++++ arch/x86/include/asm/hyperv-tlfs.h | 17 +++++ arch/x86/include/asm/kvm_host.h | 10 +++ arch/x86/include/asm/mshyperv.h | 7 ++ arch/x86/include/asm/trace/hyperv.h | 14 ++++ arch/x86/kvm/mmu.c | 146 +++++++++++++++++++++++++++++++-= ---- arch/x86/kvm/paging_tmpl.h | 16 +++- arch/x86/kvm/vmx.c | 41 +++++++--- 8 files changed, 331 insertions(+), 31 deletions(-) --=20 2.14.4