Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp651958imu; Tue, 11 Dec 2018 05:30:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wo14v2UXyUo0wF7ceA9f623hPgMdpyZpXqFvh70wzT8WAzEBeTdKfN/I7U5t2QXi3quZKw X-Received: by 2002:a63:f615:: with SMTP id m21mr14938206pgh.428.1544535045595; Tue, 11 Dec 2018 05:30:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544535045; cv=none; d=google.com; s=arc-20160816; b=aawK9Aa41g+Cxr/K7NZq2PxWGDxl3ouYO/p9pxraBtbd353kBpvoZqjRzv67bryMX2 uaRAviMK45SL49l9GOknD1vkjxqUyOROAJ23Eyvq3G/Wls3CdGtvRmoLBN+DWvm+zYWM 7x+Mzl+MzTkt9E5tXd3cq7dxzHo8p9vun56jQiVE20hWAEizLaiybuBlc2myUeLGW6H/ nlLAyhpkw2MCJ+daBBt8YUT0KP2GZGKlv7w71umTCo54a7WemsCoi9D5HS5hl2lOd0u4 kNrUmQen5h1lItR+QEX0y8ILNkM8f1zrC4wlBqJfu6FSKgZ0lvLHDDeLNAwUNzkELvVz UbwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=8JgFXwfJGf93Zjx6GB7ZBu5qlycgds78hMf+8flQ2h0=; b=ZuTY62wne9zvZmKoAWEvBwoeOTdBCNHwIPXfrSnity5CxbGWpeM1QIAy8EUEb1TJ3y oQTnkSGUUcEp8MmZWAnFXE3jOGKj3NbcqPoGSyLBJ68cKZIop91lnMiVQVfBw+mMEW0x CGr9R+3H364j7FFoE/bP6lUXr+SKGytPsDRNHxKQBCshU4UDnd29iS23Dy1Z2zVi0ycm S/59RJZchxe2NNm0aUJrIPApQbxcpjq12ewt/gSs3nguVQ68cMRiY1gzq2d6DWtw93uB C7hhVj17fV6YXI2g6jorAb4U+ZrF349BYFPxpwO7sC9VfrKP74T6WQcPQehKZs49Uh43 xoiw== 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 r34si9497255pga.242.2018.12.11.05.30.29; Tue, 11 Dec 2018 05:30:45 -0800 (PST) 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 S1726444AbeLKN2S (ORCPT + 99 others); Tue, 11 Dec 2018 08:28:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8838 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726170AbeLKN2S (ORCPT ); Tue, 11 Dec 2018 08:28:18 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2F01230DC390; Tue, 11 Dec 2018 13:28:18 +0000 (UTC) Received: from vitty.brq.redhat.com.redhat.com (unknown [10.34.244.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0BC461001943; Tue, 11 Dec 2018 13:28:15 +0000 (UTC) From: Vitaly Kuznetsov To: Roman Kagan Cc: "kvm\@vger.kernel.org" , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , "linux-kernel\@vger.kernel.org" , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "x86\@kernel.org" , "Michael Kelley \(EOSG\)" , Eduardo Habkost Subject: Re: [PATCH v2 4/7] x86/kvm/hyper-v: Introduce KVM_GET_SUPPORTED_HV_CPUID In-Reply-To: <20181211124956.GA2378@rkaganb.sw.ru> References: <20181210172159.410-1-vkuznets@redhat.com> <20181210172159.410-5-vkuznets@redhat.com> <20181211124956.GA2378@rkaganb.sw.ru> Date: Tue, 11 Dec 2018 14:28:14 +0100 Message-ID: <87bm5sp501.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 11 Dec 2018 13:28:18 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Roman Kagan writes: > On Mon, Dec 10, 2018 at 06:21:56PM +0100, Vitaly Kuznetsov wrote: >> + >> +Currently, the following list of CPUID leaves are returned: >> + HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS >> + HYPERV_CPUID_INTERFACE >> + HYPERV_CPUID_VERSION >> + HYPERV_CPUID_FEATURES >> + HYPERV_CPUID_ENLIGHTMENT_INFO >> + HYPERV_CPUID_IMPLEMENT_LIMITS >> + HYPERV_CPUID_NESTED_FEATURES >> + >> +HYPERV_CPUID_NESTED_FEATURES leaf is only exposed when Enlightened VMCS was >> +enabled on the corresponding vCPU (KVM_CAP_HYPERV_ENLIGHTENED_VMCS). > > IOW the output of ioctl(KVM_GET_SUPPORTED_HV_CPUID) depends on > whether ioctl(KVM_ENABLE_CAP, KVM_CAP_HYPERV_ENLIGHTENED_VMCS) has > already been called on that vcpu? I wonder if this fits the intended > usage? I added HYPERV_CPUID_NESTED_FEATURES in the list (and made the new ioctl per-cpu and not per-vm) for consistency. *In theory* KVM_CAP_HYPERV_ENLIGHTENED_VMCS is also enabled per-vcpu so some hypothetical userspace can later check enabled eVMCS versions (which can differ across vCPUs!) with KVM_GET_SUPPORTED_HV_CPUID. We will also have direct tlb flush and other nested features there so to avoid addning new KVM_CAP_* for them we need the CPUID. Another thing I'm thinking about is something like 'hv_all' cpu flag for Qemu which would enable everything by setting guest CPUIDs to what KVM_GET_SUPPORTED_HV_CPUID returns. In that case it would also be convenient to have HYPERV_CPUID_NESTED_FEATURES properly filled (or not filled when eVMCS was not enabled). -- Vitaly