Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6078444ybe; Tue, 17 Sep 2019 19:42:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzboshvG9kL15c6h99XYqqpDeSAq1dyfJ6k+XaclLxzGHQ+enYuvAWyChcslHAr5kJKsg55 X-Received: by 2002:aa7:d607:: with SMTP id c7mr8102638edr.286.1568774536295; Tue, 17 Sep 2019 19:42:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568774536; cv=none; d=google.com; s=arc-20160816; b=exOdqhgTxyIyTSsnkPH3RS5h+a0rgE2naJwsVj/28UhvrY+6vAkrOW+HS1uAVYl9LU ukBIkB1A377cckvmydfyRZSqUPulhKEC7k2RxSEICMQ4AK9l6vrUfPwFRmEhhXMfLKAC XJOrxeCJa/9AKI0iSvedIpgB26+/492MWphAncEO6WGrLtztwNCaoDWEcU/3nXnuUmt9 YfT20XmLs0SbH6sm/8jKulUTnMHopgQduzkALaxbUh6stlax+EKTDk9Nii8NvTXWWv6l 5txkjgE/BBA07xLbQvUCxWi3Bze+wsNAWyi+fOKejJL75O+dNrL9wqaQ7MYRVl5qMuNp h4Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=WpdhIb/HVSs710LcKaJm7aGI4UYk0FgZtLy6pHU/E7I=; b=bPN2grJRXS7W+V5zQ0vOa5eaJfmCmVEuFNnx0a8bzCc5FgLJAJeShrDATtNzNyGpPW WNUukaT8H24tR/0eMpOHHp1Luyqys8h7Rv9hRBgm3e52hBEZM4mlzc+y9S7j7tXLHMn7 h2XU7EiKfGXmamOQbqOz7x5/Mn4rPsAxHemyny+1FGfTR7RI2nRghRecCs0aW4ak2Wj5 1g9s9BxyLpeF4g2Kb3Ss8eg7phnrSsexi1wIP+Rqpw7twhuiU6K0UdGtDK1ymyl4Wp7d 8LKCnozaa7sgowccCSWkz+yb0xKazyZNLsFAtsPq9+eyNNQiXGei1cRYyibYt7l8NIbk zdyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bEkFHto9; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4si196604eji.152.2019.09.17.19.41.53; Tue, 17 Sep 2019 19:42:16 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bEkFHto9; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726524AbfIRBzr (ORCPT + 99 others); Tue, 17 Sep 2019 21:55:47 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40355 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725884AbfIRBzq (ORCPT ); Tue, 17 Sep 2019 21:55:46 -0400 Received: by mail-pf1-f193.google.com with SMTP id x127so3296983pfb.7; Tue, 17 Sep 2019 18:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=WpdhIb/HVSs710LcKaJm7aGI4UYk0FgZtLy6pHU/E7I=; b=bEkFHto9bgaJFozXvPcDAP9sOziRJ1a39ytrGCFhceycWTnUGuL0tEG1zjySa4ko86 1i99GxosJphUChFuLilgBo87ghBxrZxeAynAvfEUM8u4ToDb+zwG+fYQSD+iXK17xKtX o8iNbNy4DkE7f5ZWcMdVww7NvF13UoswzJ2edSzkuwBhrAUvPq6ers4z4SpUbNKrCliE lomkueb9TlI4/6m2QkcUpJ8+vXUJhEvOgbrtahh7ahAJiImLYcWH0q7wMMAmdFJnIQPF LodRcKlngsVu/fC1AbR4sV7HTx5SLuF4CBfL791oxHGBRDE/CvgExsp8A4AMMkr0CVGS KMNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=WpdhIb/HVSs710LcKaJm7aGI4UYk0FgZtLy6pHU/E7I=; b=d5ROzrnRvOLjnNNqJmbokGjd8UA1ynieJhIFOAiDvAg3BN/IqYcNevQHjEcBVHzcaY ReDzvRrFAmU69eKBcsbVUAkv+1tWu6fRy4B+Icp5RZSvJG4UVHWIJe6XRleJP0M5dw9N HF/EdDhfWlr8ZUCLmhcXgMmcrMlmbSULW8QliWWGHI8zlbpq40GCTwfXkjAQLwMKbDtu X4RIVou38dUmoebyF5ZzHi5I08O8+IGSZWEqzRRkl/f82+h/3lsr2TD3CZbfTMeLsheO 02WSmhHiyRlXmk+j/2icPU38sj9mEuzrXb2c6ggO2JVJ6bqAUgSt7dHxctqTyXu3lO0V 7MMg== X-Gm-Message-State: APjAAAV4DspkUhGmExUSMccWFnHzM7qvOucImZUpuCeemixwx7B3GZxV CdBywVu1XybhLIdXA/V3gZ1ijwjVMMlbjkf+j1M= X-Received: by 2002:a65:5043:: with SMTP id k3mr1752884pgo.406.1568771745985; Tue, 17 Sep 2019 18:55:45 -0700 (PDT) MIME-Version: 1.0 References: <20190822143021.7518-1-Tianyu.Lan@microsoft.com> <7ea7fa06-f100-1507-8507-1c701877c8ab@redhat.com> <874l1baqnf.fsf@vitty.brq.redhat.com> In-Reply-To: <874l1baqnf.fsf@vitty.brq.redhat.com> From: Tianyu Lan Date: Wed, 18 Sep 2019 09:55:34 +0800 Message-ID: Subject: Re: [PATCH V4 0/3] KVM/Hyper-V: Add Hyper-V direct tlb flush support To: Vitaly Kuznetsov Cc: Paolo Bonzini , Tianyu Lan , kvm , linux-doc@vger.kernel.org, linux-hyperv@vger.kernel.org, "linux-kernel@vger kernel org" , Radim Krcmar , corbet@lwn.net, KY Srinivasan , Haiyang Zhang , Stephen Hemminger , Sasha Levin , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "the arch/x86 maintainers" , michael.h.kelley@microsoft.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 17, 2019 at 11:28 PM Vitaly Kuznetsov wro= te: > > Paolo Bonzini writes: > > > On 22/08/19 16:30, lantianyu1986@gmail.com wrote: > >> From: Tianyu Lan > >> > >> This patchset is to add Hyper-V direct tlb support in KVM. Hyper-V > >> in L0 can delegate L1 hypervisor to handle tlb flush request from > >> L2 guest when direct tlb flush is enabled in L1. > >> > >> Patch 2 introduces new cap KVM_CAP_HYPERV_DIRECT_TLBFLUSH to enable > >> feature from user space. User space should enable this feature only > >> when Hyper-V hypervisor capability is exposed to guest and KVM profile > >> is hided. There is a parameter conflict between KVM and Hyper-V hyperc= all. > >> We hope L2 guest doesn't use KVM hypercall when the feature is > >> enabled. Detail please see comment of new API "KVM_CAP_HYPERV_DIRECT_T= LBFLUSH" > >> > >> Change since v3: > >> - Update changelog in each patches. > >> > >> Change since v2: > >> - Move hv assist page(hv_pa_pg) from struct kvm to struct kvm_= hv. > >> > >> Change since v1: > >> - Fix offset issue in the patch 1. > >> - Update description of KVM KVM_CAP_HYPERV_DIRECT_TLBFLUSH. > >> > >> Tianyu Lan (2): > >> x86/Hyper-V: Fix definition of struct hv_vp_assist_page > >> KVM/Hyper-V: Add new KVM capability KVM_CAP_HYPERV_DIRECT_TLBFLUSH > >> > >> Vitaly Kuznetsov (1): > >> KVM/Hyper-V/VMX: Add direct tlb flush support > >> > >> Documentation/virtual/kvm/api.txt | 13 +++++++++++++ > >> arch/x86/include/asm/hyperv-tlfs.h | 24 ++++++++++++++++++----- > >> arch/x86/include/asm/kvm_host.h | 4 ++++ > >> arch/x86/kvm/vmx/evmcs.h | 2 ++ > >> arch/x86/kvm/vmx/vmx.c | 39 +++++++++++++++++++++++++++++= +++++++++ > >> arch/x86/kvm/x86.c | 8 ++++++++ > >> include/uapi/linux/kvm.h | 1 + > >> 7 files changed, 86 insertions(+), 5 deletions(-) > >> > > > > Queued, thanks. > > > > I had a suggestion how we can get away without the new capability (like > direct tlb flush gets automatically enabled when Hyper-V hypercall page > is activated and we know we can't handle KVM hypercalls any more) > but this can probably be done as a follow-up. > Hi Vital'y=EF=BC=9A Actually, I have tried your proposal but it turns out KVM in L1 fails to enable direct tlb flush most time after nested VM starts. "hv_enlightenments_control. nested_flush_hypercall" flag in evmcs is cleared by Hyper-V after run nested VM. I still wait answer from Hyper-V team. So far, it looks like enabling direct tlb flush before start nested VM is a safe way.Once get more infomration from Hyper-V team and we = may have a look to how to enable your proposal. --=20 Best regards Tianyu Lan