Received: by 10.213.65.68 with SMTP id h4csp427058imn; Fri, 16 Mar 2018 07:27:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELvsGhQT6dQfmfh2ofkezgTgVN42+FwyLy1fQpRtVF47C+jeb1on1boebyRzQKq9PD0+zdMl X-Received: by 2002:a17:902:bd09:: with SMTP id p9-v6mr2399846pls.68.1521210455894; Fri, 16 Mar 2018 07:27:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521210455; cv=none; d=google.com; s=arc-20160816; b=xcWyTgFrV7Ig1HzEO5yLA//Ry0KgmGCHuWOEdl1JJhxY4yCRmNhBCpZWH++vF96QUM GoOZxJ1W9ojAn9d12rAdJYTKSYQR8lNB9TRHoIlyJDd5rURCK5UQBmOmKNh0QCHTO/DR riWvf0fRnFoX2Gsghv9JRVbjz0QWrhqQwLjTcgQbFISYL8QYTAV7QlgsK/G9WXp675Ux FM3wJtRgj3WAvRPccUgTTTXixGled03DS2DQjo8yI67bhhXtkh5AFYFSGBXczZntmU4A FkQvXsMYWGq1Bp1hX+kUkviuP4xHcaW08uRAwDDW/j/CF9Bl87Up4eX3vL6YHHJ8dkv8 V1RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=nqkegh+AHFiwnzg00WbimtxOPqwvbENhuoFIu77pk3M=; b=fgLZDpep8RiwHZLFdtE9VZ43KlxPvmBLTiUuS7uFpP+vkc3ipJ7QB+35z8u+8+pOsj LdUDXLuAZLfERrBKQmVlBsjbHh4ZKgJJuLiPZqn2bRzYEY0UednfAzY/vMrRUv2ZinVM 0U35aC17dFRYGr8RuEjO78q6T9vNWiEQpx78OHLMVe9R+8EqskoZQGXx+kjSl5c0hoKA UhKf0FYGZKQr3rn0qEskFtSLlz6+jZ76FxmHvI9M4Qi06Y42MOJ4pZnNveKe58qTY0KV DR1exPqLekzAH38ofwRb8XOX2oke+mFsZfNkYAhe84VHu9M8l39mT0xHAmKUV/I3wCeU l9zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g26si1194861pgv.384.2018.03.16.07.27.22; Fri, 16 Mar 2018 07:27:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753140AbeCPOW1 (ORCPT + 99 others); Fri, 16 Mar 2018 10:22:27 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33234 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753008AbeCPOWZ (ORCPT ); Fri, 16 Mar 2018 10:22:25 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 71A4F402277A; Fri, 16 Mar 2018 14:22:24 +0000 (UTC) Received: from vitty.brq.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id F09D720292A0; Fri, 16 Mar 2018 14:22:21 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org Cc: x86@kernel.org, Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Mohammed Gamal , Cathy Avery , Bandan Das , Thomas Gleixner , Christoph Hellwig , linux-kernel@vger.kernel.org Subject: [PATCH v4 0/7] Enlightened VMCS support for KVM on Hyper-V Date: Fri, 16 Mar 2018 15:22:13 +0100 Message-Id: <20180316142220.32506-1-vkuznets@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 16 Mar 2018 14:22:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 16 Mar 2018 14:22:24 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'vkuznets@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changes since v3: - Add Michael's Reviewed-by to PATCH2,5,6 - PATCH1: - Decipher 'TLFS' and add a reference where it can be obtained [Christoph Hellwig] - PATCH4: - remove vfree() from hv_cpu_die() [Thomas Gleixner] - free hv_vp_assist_page() in the error path [Thomas Gleixner] While on it, add cpuhp_remove_state() call when we fail to allocate hypercall page to make the error path complete. - check hv_vp_assist_page != NULL in hv_get_vp_assist_page() [Thomas Gleixner] - PATCH7: - split off vmx_evmcs.h [Paolo Bonzini] - merge get_evmcs_offset() and get_evmcs_offset_cf() [Paolo Bonzini] - move evmcs_sanitize_exec_ctrls() to setup_vmcs_config [Paolo Bonzini] - rename vmcs_load_enlightened() -> evmcs_load() [Paolo Bonzini] - drop evmcs_sanitize_exec_ctrls() from dump_vmcs() [Paolo Bonzini] When running nested KVM on Hyper-V it's possible to use so called 'Enlightened VMCS' and do normal memory reads/writes instead of doing VMWRITE/VMREAD instructions. In addition, clean field mask provides a huge room for optimization on L0's side. Tight CPUID loop test shows significant speedup (E5-2667 v4 @ 3.20GHz): Before: 18890 cycles After: 8304 cycles Ladi Prosek (1): x86/kvm: rename HV_X64_MSR_APIC_ASSIST_PAGE to HV_X64_MSR_VP_ASSIST_PAGE Vitaly Kuznetsov (6): x86/hyper-v: move hyperv.h out of uapi x86/hyper-v: move definitions from TLFS to hyperv-tlfs.h x86/hyper-v: allocate and use Virtual Processor Assist Pages x86/hyper-v: define struct hv_enlightened_vmcs and clean field bits x86/hyper-v: detect nested features x86/kvm: use Enlightened VMCS when running on Hyper-V MAINTAINERS | 2 +- arch/x86/hyperv/hv_init.c | 45 ++- arch/x86/include/asm/hyperv-tlfs.h | 702 +++++++++++++++++++++++++++++++++++ arch/x86/include/asm/kvm_host.h | 1 + arch/x86/include/asm/mshyperv.h | 94 +---- arch/x86/include/uapi/asm/hyperv.h | 421 --------------------- arch/x86/include/uapi/asm/kvm_para.h | 1 - arch/x86/kernel/cpu/mshyperv.c | 21 +- arch/x86/kvm/hyperv.c | 8 +- arch/x86/kvm/lapic.h | 2 +- arch/x86/kvm/vmx.c | 301 ++++++++++++++- arch/x86/kvm/vmx_evmcs.h | 324 ++++++++++++++++ arch/x86/kvm/x86.c | 2 +- drivers/hv/connection.c | 1 - drivers/hv/hv.c | 1 - drivers/hv/hyperv_vmbus.h | 1 + drivers/hv/vmbus_drv.c | 1 - include/linux/hyperv.h | 1 - 18 files changed, 1396 insertions(+), 533 deletions(-) create mode 100644 arch/x86/include/asm/hyperv-tlfs.h delete mode 100644 arch/x86/include/uapi/asm/hyperv.h create mode 100644 arch/x86/kvm/vmx_evmcs.h -- 2.14.3