From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: [PATCH] eal/x86: get hypervisor name Date: Fri, 1 Dec 2017 14:47:06 +0530 Message-ID: <20171201091705.GA29030@jerin> References: <20171130214720.30098-1-thomas@monjalon.net> <20171201081234.GA24936@jerin> <9012196.L72nSLPZ2J@xps> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, chaozhu@linux.vnet.ibm.com To: Thomas Monjalon Return-path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0068.outbound.protection.outlook.com [104.47.32.68]) by dpdk.org (Postfix) with ESMTP id B4E0E5593 for ; Fri, 1 Dec 2017 10:17:26 +0100 (CET) Content-Disposition: inline In-Reply-To: <9012196.L72nSLPZ2J@xps> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" -----Original Message----- > Date: Fri, 01 Dec 2017 09:52:26 +0100 > From: Thomas Monjalon > To: Jerin Jacob > Cc: dev@dpdk.org, chaozhu@linux.vnet.ibm.com > Subject: Re: [dpdk-dev] [PATCH] eal/x86: get hypervisor name > > 01/12/2017 09:12, Jerin Jacob: > > -----Original Message----- > > > Date: Thu, 30 Nov 2017 22:47:20 +0100 > > > From: Thomas Monjalon > > > To: dev@dpdk.org > > > Subject: [dpdk-dev] [PATCH] eal/x86: get hypervisor name > > > X-Mailer: git-send-email 2.15.0 > > > > > > The CPUID instruction is catched by hypervisor which can return > > > a flag indicating one is running, and its name. > > > > > > Suggested-by: Stephen Hemminger > > > Signed-off-by: Thomas Monjalon > > > --- > > > warning: to be tested > > > --- > > > lib/librte_eal/common/arch/arm/rte_cpuflags.c | 6 +++++ > > > lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c | 6 +++++ > > > lib/librte_eal/common/arch/x86/rte_cpuflags.c | 30 ++++++++++++++++++++++ > > > .../common/include/arch/x86/rte_cpuflags.h | 1 + > > > .../common/include/generic/rte_cpuflags.h | 14 ++++++++++ > > > lib/librte_eal/rte_eal_version.map | 9 ++++++- > > > 6 files changed, 65 insertions(+), 1 deletion(-) > > > RTE_CPUFLAG_FPU, /**< FPU */ > > > diff --git a/lib/librte_eal/common/include/generic/rte_cpuflags.h b/lib/librte_eal/common/include/generic/rte_cpuflags.h > > > index c1c5551fc..3832fb851 100644 > > > --- a/lib/librte_eal/common/include/generic/rte_cpuflags.h > > > +++ b/lib/librte_eal/common/include/generic/rte_cpuflags.h > > > @@ -93,4 +93,18 @@ rte_cpu_check_supported(void); > > > int > > > rte_cpu_is_supported(void); > > > > > > +enum rte_hypervisor { > > > + RTE_HYPERVISOR_NONE, > > > + RTE_HYPERVISOR_KVM, > > > + RTE_HYPERVISOR_HYPERV, > > > + RTE_HYPERVISOR_VMWARE, > > > + RTE_HYPERVISOR_UNKNOWN > > > +}; > > > + > > > +/** > > > + * Get the type of hypervisor it is running on. > > > + */ > > > +enum rte_hypervisor > > > +rte_hypervisor_get_name(void); > > > > Cc: chaozhu@linux.vnet.ibm.com > > > > IMO, cpu_flag area is the not the correct abstraction to get > > the hypervisor name. It is x86 specific. I think, correct > > usage will be to call hypervisor specific APIs like KVM_GET_API_VERSION > > https://lwn.net/Articles/658511/ > > I think it is quite logical because the CPU is virtualized by the hypervisor. > It is similar to get the CPU model, but for a different ring level. At least on non x86, it is not exposed as CPU flags. IMO, *hypervisor*.h file makes more sense rather than rte_cpuflags.h. > > > BTW, What is the need for an DPDK application to know the > > hypervisor name? What action an DPDK application should > > take based on hypervisor name? if is not interest of data plane > > application why it needs to be abstracted in DPDK? > > I see two usages for now. > We can automate the use of the specific VMware TSC (it is an option currently). In my view this use case needed by the DPDK "implementation" not the "application". So internal API makes more sense to me. > We can adapt the device management policy on Hyper-V without waiting a device scan. I am not sure about this? Looks like a candidate for library implementation not for the "application"