From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Peter Huang(Peng)" Subject: Re: [Question] why x2apic's set by default without host support(on Nehalem CPU). Date: Mon, 22 Jul 2013 20:36:05 +0800 Message-ID: <51ED2735.3050107@huawei.com> References: <51ED1668.7030205@huawei.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------010208020803060403050406" To: , , Return-path: In-Reply-To: <51ED1668.7030205@huawei.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org --------------010208020803060403050406 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit I traced the qemu process, and find out that host cpuid doesn't support x2apic, but VM interception seems enabled x2apic. with function=1(bit 21 indicates x2apic) host_cpuid:ecx=0x009ce3bd guest_cpuid:ecx=0x00b82201 On 2013-07-22 19:24, Peter Huang(Peng) wrote: > Hi, Everyone > > I have been encountered a problem recently. > My box uses Nehalem E5520 CPU, and this model doesn't support x2apic feature. > I created a VM on KVM, and uses cpu mode=pass-through, I can get the right cpu > model from the VM, but I can also see that the CPU in the vm supports x2apic. > > This seems werid. > From QEMU's CPU model definition, Nehalem also doesn't support x2apic. > > Can anyone explain it? > > Thanks to you all! > > Below is the cpuinfo from host and guest: > host: > fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush > dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc > arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 > monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 > popcnt lahf_lm dtherm tpr_shadow vnmi flexpriority ept vpid > > vm: > fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush > mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon rep_good > nopl pni ssse3 cx16 sse4_1 sse4_2 *x2apic *popcnt hypervisor lahf_lm --------------010208020803060403050406 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit I traced the qemu process, and find out that host cpuid doesn't support x2apic,
but VM interception seems enabled x2apic.

with function=1(bit 21 indicates x2apic)
host_cpuid:ecx=0x009ce3bd
guest_cpuid:ecx=0x00b82201

On 2013-07-22 19:24, Peter Huang(Peng) wrote:
Hi, Everyone

I have been encountered a problem recently.
My box uses Nehalem E5520 CPU, and this model doesn't support x2apic feature.
I created a VM on KVM, and uses cpu mode=pass-through, I can get the right cpu
model from the VM, but I can also see that the CPU in the vm supports x2apic.

This seems werid.
From QEMU's CPU model definition, Nehalem also doesn't support x2apic.

Can anyone explain it?

Thanks to you all!

Below is the cpuinfo from host and guest:
host:
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush
 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc
arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64
monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2
popcnt lahf_lm dtherm tpr_shadow vnmi flexpriority ept vpid

vm:
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush
mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon rep_good
 nopl pni ssse3 cx16 sse4_1 sse4_2 x2apic popcnt hypervisor lahf_lm
--------------010208020803060403050406-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [Question] why x2apic's set by default without host support(on Nehalem CPU). Date: Mon, 22 Jul 2013 20:55:40 -0300 Message-ID: <20130722235540.GA20029@amt.cnet> References: <51ED1668.7030205@huawei.com> <51ED2735.3050107@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org To: "Peter Huang(Peng)" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1766 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515Ab3GWC32 (ORCPT ); Mon, 22 Jul 2013 22:29:28 -0400 Content-Disposition: inline In-Reply-To: <51ED2735.3050107@huawei.com> Sender: kvm-owner@vger.kernel.org List-ID: Peter, Because x2apic support is emulated in software. On Mon, Jul 22, 2013 at 08:36:05PM +0800, Peter Huang(Peng) wrote: > I traced the qemu process, and find out that host cpuid doesn't support x2apic, > but VM interception seems enabled x2apic. > > with function=1(bit 21 indicates x2apic) > host_cpuid:ecx=0x009ce3bd > guest_cpuid:ecx=0x00b82201 > > On 2013-07-22 19:24, Peter Huang(Peng) wrote: > > Hi, Everyone > > > > I have been encountered a problem recently. > > My box uses Nehalem E5520 CPU, and this model doesn't support x2apic feature. > > I created a VM on KVM, and uses cpu mode=pass-through, I can get the right cpu > > model from the VM, but I can also see that the CPU in the vm supports x2apic. > > > > This seems werid. > > From QEMU's CPU model definition, Nehalem also doesn't support x2apic. > > > > Can anyone explain it? > > > > Thanks to you all! > > > > Below is the cpuinfo from host and guest: > > host: > > fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush > > dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc > > arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 > > monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 > > popcnt lahf_lm dtherm tpr_shadow vnmi flexpriority ept vpid > > > > vm: > > fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush > > mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon rep_good > > nopl pni ssse3 cx16 sse4_1 sse4_2 *x2apic *popcnt hypervisor lahf_lm From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Peter Huang(Peng)" Subject: Re: [Question] why x2apic's set by default without host support(on Nehalem CPU). Date: Tue, 23 Jul 2013 10:38:06 +0800 Message-ID: <51EDEC8E.4050802@huawei.com> References: <51ED1668.7030205@huawei.com> <51ED2735.3050107@huawei.com> <20130722235540.GA20029@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Cc: , To: Marcelo Tosatti Return-path: Received: from szxga01-in.huawei.com ([119.145.14.64]:62346 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753205Ab3GWCiS (ORCPT ); Mon, 22 Jul 2013 22:38:18 -0400 In-Reply-To: <20130722235540.GA20029@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: Hi, Marcelo Thanks for replying. I noticed that, kvm has emulated x2apic, but I can't find where the code exits. Could you give me some hint? Thanks again. On 2013-07-23 7:55, Marcelo Tosatti wrote: > Peter, > > Because x2apic support is emulated in software. > > On Mon, Jul 22, 2013 at 08:36:05PM +0800, Peter Huang(Peng) wrote: >> I traced the qemu process, and find out that host cpuid doesn't support x2apic, >> but VM interception seems enabled x2apic. >> >> with function=1(bit 21 indicates x2apic) >> host_cpuid:ecx=0x009ce3bd >> guest_cpuid:ecx=0x00b82201 >> >> On 2013-07-22 19:24, Peter Huang(Peng) wrote: >>> Hi, Everyone >>> >>> I have been encountered a problem recently. >>> My box uses Nehalem E5520 CPU, and this model doesn't support x2apic feature. >>> I created a VM on KVM, and uses cpu mode=pass-through, I can get the right cpu >>> model from the VM, but I can also see that the CPU in the vm supports x2apic. >>> >>> This seems werid. >>> From QEMU's CPU model definition, Nehalem also doesn't support x2apic. >>> >>> Can anyone explain it? >>> >>> Thanks to you all! >>> >>> Below is the cpuinfo from host and guest: >>> host: >>> fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush >>> dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc >>> arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 >>> monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 >>> popcnt lahf_lm dtherm tpr_shadow vnmi flexpriority ept vpid >>> >>> vm: >>> fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush >>> mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon rep_good >>> nopl pni ssse3 cx16 sse4_1 sse4_2 *x2apic *popcnt hypervisor lahf_lm From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1EHq-0003JE-EH for qemu-devel@nongnu.org; Mon, 22 Jul 2013 07:28:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1EHo-0008Bx-U7 for qemu-devel@nongnu.org; Mon, 22 Jul 2013 07:28:18 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:61337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1EHo-00088s-9O for qemu-devel@nongnu.org; Mon, 22 Jul 2013 07:28:16 -0400 Message-ID: <51ED1668.7030205@huawei.com> Date: Mon, 22 Jul 2013 19:24:24 +0800 From: "Peter Huang(Peng)" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------070602050307050305060609" Subject: [Qemu-devel] [Question] why x2apic's set by default without host support(on Nehalem CPU). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --------------070602050307050305060609 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Hi, Everyone I have been encountered a problem recently. My box uses Nehalem E5520 CPU, and this model doesn't support x2apic feature. I created a VM on KVM, and uses cpu mode=pass-through, I can get the right cpu model from the VM, but I can also see that the CPU in the vm supports x2apic. This seems werid. >>From QEMU's CPU model definition, Nehalem also doesn't support x2apic. Can anyone explain it? Thanks to you all! Below is the cpuinfo from host and guest: host: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm dtherm tpr_shadow vnmi flexpriority ept vpid vm: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon rep_good nopl pni ssse3 cx16 sse4_1 sse4_2 *x2apic *popcnt hypervisor lahf_lm --------------070602050307050305060609 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Hi, Everyone

I have been encountered a problem recently.
My box uses Nehalem E5520 CPU, and this model doesn't support x2apic feature.
I created a VM on KVM, and uses cpu mode=pass-through, I can get the right cpu
model from the VM, but I can also see that the CPU in the vm supports x2apic.

This seems werid.
From QEMU's CPU model definition, Nehalem also doesn't support x2apic.

Can anyone explain it?

Thanks to you all!

Below is the cpuinfo from host and guest:
host:
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush
 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc
arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64
monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2
popcnt lahf_lm dtherm tpr_shadow vnmi flexpriority ept vpid

vm:
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush
mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon rep_good
 nopl pni ssse3 cx16 sse4_1 sse4_2 x2apic popcnt hypervisor lahf_lm
--------------070602050307050305060609-- From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1GN3-00032o-Ry for qemu-devel@nongnu.org; Mon, 22 Jul 2013 09:41:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1GN2-0000vK-MX for qemu-devel@nongnu.org; Mon, 22 Jul 2013 09:41:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50918) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1GN2-0000vD-FP for qemu-devel@nongnu.org; Mon, 22 Jul 2013 09:41:48 -0400 Date: Mon, 22 Jul 2013 10:41:38 -0300 From: Eduardo Habkost Message-ID: <20130722134138.GE19826@otherpad.lan.raisama.net> References: <51ED1668.7030205@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51ED1668.7030205@huawei.com> Subject: Re: [Qemu-devel] [Question] why x2apic's set by default without host support(on Nehalem CPU). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Peter Huang(Peng)" Cc: libvir-list@redhat.com, qemu-devel@nongnu.org On Mon, Jul 22, 2013 at 07:24:24PM +0800, Peter Huang(Peng) wrote: > Hi, Everyone > > I have been encountered a problem recently. > My box uses Nehalem E5520 CPU, and this model doesn't support x2apic feature. > I created a VM on KVM, and uses cpu mode=pass-through, I can get the right cpu > model from the VM, but I can also see that the CPU in the vm supports x2apic. > > This seems werid. > From QEMU's CPU model definition, Nehalem also doesn't support x2apic. > > Can anyone explain it? > libvirt's "host-passthrough" uses "-cpu host', and it "-cpu host" enables every feature that can be enabled on the host. As KVM x2apic emulation doesn't require host CPU support, it gets enabled. If the behavior of "-cpu host" doesn't match libvirt expectations, we need to clarify what are the requirements, and maybe have a "try to be close to host CPU mode" as opposed to the current "enable everything that can be enabled" mode. -- Eduardo From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1FLg-000627-72 for qemu-devel@nongnu.org; Mon, 22 Jul 2013 08:36:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1FLd-0000E6-TG for qemu-devel@nongnu.org; Mon, 22 Jul 2013 08:36:20 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:7621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1FLd-0000DM-0I for qemu-devel@nongnu.org; Mon, 22 Jul 2013 08:36:17 -0400 Message-ID: <51ED2735.3050107@huawei.com> Date: Mon, 22 Jul 2013 20:36:05 +0800 From: "Peter Huang(Peng)" MIME-Version: 1.0 References: <51ED1668.7030205@huawei.com> In-Reply-To: <51ED1668.7030205@huawei.com> Content-Type: multipart/alternative; boundary="------------010208020803060403050406" Subject: Re: [Qemu-devel] [Question] why x2apic's set by default without host support(on Nehalem CPU). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, mtosatti@redhat.com, kvm@vger.kernel.org --------------010208020803060403050406 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit I traced the qemu process, and find out that host cpuid doesn't support x2apic, but VM interception seems enabled x2apic. with function=1(bit 21 indicates x2apic) host_cpuid:ecx=0x009ce3bd guest_cpuid:ecx=0x00b82201 On 2013-07-22 19:24, Peter Huang(Peng) wrote: > Hi, Everyone > > I have been encountered a problem recently. > My box uses Nehalem E5520 CPU, and this model doesn't support x2apic feature. > I created a VM on KVM, and uses cpu mode=pass-through, I can get the right cpu > model from the VM, but I can also see that the CPU in the vm supports x2apic. > > This seems werid. > From QEMU's CPU model definition, Nehalem also doesn't support x2apic. > > Can anyone explain it? > > Thanks to you all! > > Below is the cpuinfo from host and guest: > host: > fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush > dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc > arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 > monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 > popcnt lahf_lm dtherm tpr_shadow vnmi flexpriority ept vpid > > vm: > fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush > mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon rep_good > nopl pni ssse3 cx16 sse4_1 sse4_2 *x2apic *popcnt hypervisor lahf_lm --------------010208020803060403050406 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit I traced the qemu process, and find out that host cpuid doesn't support x2apic,
but VM interception seems enabled x2apic.

with function=1(bit 21 indicates x2apic)
host_cpuid:ecx=0x009ce3bd
guest_cpuid:ecx=0x00b82201

On 2013-07-22 19:24, Peter Huang(Peng) wrote:
Hi, Everyone

I have been encountered a problem recently.
My box uses Nehalem E5520 CPU, and this model doesn't support x2apic feature.
I created a VM on KVM, and uses cpu mode=pass-through, I can get the right cpu
model from the VM, but I can also see that the CPU in the vm supports x2apic.

This seems werid.
From QEMU's CPU model definition, Nehalem also doesn't support x2apic.

Can anyone explain it?

Thanks to you all!

Below is the cpuinfo from host and guest:
host:
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush
 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc
arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64
monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2
popcnt lahf_lm dtherm tpr_shadow vnmi flexpriority ept vpid

vm:
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush
mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon rep_good
 nopl pni ssse3 cx16 sse4_1 sse4_2 x2apic popcnt hypervisor lahf_lm
--------------010208020803060403050406-- From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Sas-0001h4-5f for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:44:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1Sar-0001IC-At for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:44:54 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:31784) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Saq-0001HU-NX for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:44:53 -0400 Message-ID: <51EDEE20.4060206@huawei.com> Date: Tue, 23 Jul 2013 10:44:48 +0800 From: "Peter Huang(Peng)" MIME-Version: 1.0 References: <51ED1668.7030205@huawei.com> <20130722134138.GE19826@otherpad.lan.raisama.net> In-Reply-To: <20130722134138.GE19826@otherpad.lan.raisama.net> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Question] why x2apic's set by default without host support(on Nehalem CPU). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: libvir-list@redhat.com, qemu-devel@nongnu.org > libvirt's "host-passthrough" uses "-cpu host', and it "-cpu host" > enables every feature that can be enabled on the host. >>From my test results, I found that even when use host-passthrough mode, VM's cpu features are very different from host, this doesn't match what host-passthrough mode's explanation. libvirt's option exlanation: With this mode, the CPU visible to the guest should be exactly the same as the host CPU even in the aspects that libvirt does not understand. > If the behavior of "-cpu host" doesn't match libvirt expectations, we > need to clarify what are the requirements, and maybe have a "try to be > close to host CPU mode" as opposed to the current "enable everything > that can be enabled" mode. Does the results above indicates what you mean to do? or the current way doesn't work as we expect. Thanks! From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1SLw-00049j-QC for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:29:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1SLv-0004S1-T4 for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:29:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1SLv-0004Rq-LQ for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:29:27 -0400 Date: Mon, 22 Jul 2013 20:55:40 -0300 From: Marcelo Tosatti Message-ID: <20130722235540.GA20029@amt.cnet> References: <51ED1668.7030205@huawei.com> <51ED2735.3050107@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51ED2735.3050107@huawei.com> Subject: Re: [Qemu-devel] [Question] why x2apic's set by default without host support(on Nehalem CPU). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Peter Huang(Peng)" Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org Peter, Because x2apic support is emulated in software. On Mon, Jul 22, 2013 at 08:36:05PM +0800, Peter Huang(Peng) wrote: > I traced the qemu process, and find out that host cpuid doesn't support x2apic, > but VM interception seems enabled x2apic. > > with function=1(bit 21 indicates x2apic) > host_cpuid:ecx=0x009ce3bd > guest_cpuid:ecx=0x00b82201 > > On 2013-07-22 19:24, Peter Huang(Peng) wrote: > > Hi, Everyone > > > > I have been encountered a problem recently. > > My box uses Nehalem E5520 CPU, and this model doesn't support x2apic feature. > > I created a VM on KVM, and uses cpu mode=pass-through, I can get the right cpu > > model from the VM, but I can also see that the CPU in the vm supports x2apic. > > > > This seems werid. > > From QEMU's CPU model definition, Nehalem also doesn't support x2apic. > > > > Can anyone explain it? > > > > Thanks to you all! > > > > Below is the cpuinfo from host and guest: > > host: > > fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush > > dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc > > arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 > > monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 > > popcnt lahf_lm dtherm tpr_shadow vnmi flexpriority ept vpid > > > > vm: > > fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush > > mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon rep_good > > nopl pni ssse3 cx16 sse4_1 sse4_2 *x2apic *popcnt hypervisor lahf_lm From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1SUP-0002nT-Vi for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:38:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1SUP-0007YK-3y for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:38:13 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:63734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1SUO-0007YB-Fp for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:38:13 -0400 Message-ID: <51EDEC8E.4050802@huawei.com> Date: Tue, 23 Jul 2013 10:38:06 +0800 From: "Peter Huang(Peng)" MIME-Version: 1.0 References: <51ED1668.7030205@huawei.com> <51ED2735.3050107@huawei.com> <20130722235540.GA20029@amt.cnet> In-Reply-To: <20130722235540.GA20029@amt.cnet> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Question] why x2apic's set by default without host support(on Nehalem CPU). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org Hi, Marcelo Thanks for replying. I noticed that, kvm has emulated x2apic, but I can't find where the code exits. Could you give me some hint? Thanks again. On 2013-07-23 7:55, Marcelo Tosatti wrote: > Peter, > > Because x2apic support is emulated in software. > > On Mon, Jul 22, 2013 at 08:36:05PM +0800, Peter Huang(Peng) wrote: >> I traced the qemu process, and find out that host cpuid doesn't support x2apic, >> but VM interception seems enabled x2apic. >> >> with function=1(bit 21 indicates x2apic) >> host_cpuid:ecx=0x009ce3bd >> guest_cpuid:ecx=0x00b82201 >> >> On 2013-07-22 19:24, Peter Huang(Peng) wrote: >>> Hi, Everyone >>> >>> I have been encountered a problem recently. >>> My box uses Nehalem E5520 CPU, and this model doesn't support x2apic feature. >>> I created a VM on KVM, and uses cpu mode=pass-through, I can get the right cpu >>> model from the VM, but I can also see that the CPU in the vm supports x2apic. >>> >>> This seems werid. >>> From QEMU's CPU model definition, Nehalem also doesn't support x2apic. >>> >>> Can anyone explain it? >>> >>> Thanks to you all! >>> >>> Below is the cpuinfo from host and guest: >>> host: >>> fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush >>> dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc >>> arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 >>> monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 >>> popcnt lahf_lm dtherm tpr_shadow vnmi flexpriority ept vpid >>> >>> vm: >>> fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush >>> mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon rep_good >>> nopl pni ssse3 cx16 sse4_1 sse4_2 *x2apic *popcnt hypervisor lahf_lm From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1auB-00075C-AA for qemu-devel@nongnu.org; Tue, 23 Jul 2013 07:37:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1au8-0001RA-Ja for qemu-devel@nongnu.org; Tue, 23 Jul 2013 07:37:23 -0400 Received: from smtp.vivo.cz ([85.132.139.19]:39623) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1akd-0006dm-QS for qemu-devel@nongnu.org; Tue, 23 Jul 2013 07:27:31 -0400 Date: Tue, 23 Jul 2013 13:27:12 +0200 From: Jiri Denemark Message-ID: <20130723112712.GF4718@orkuz.home> References: <51ED1668.7030205@huawei.com> <20130722134138.GE19826@otherpad.lan.raisama.net> <51EDEE20.4060206@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51EDEE20.4060206@huawei.com> Subject: Re: [Qemu-devel] [Question] why x2apic's set by default without host support(on Nehalem CPU). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Peter Huang(Peng)" Cc: libvir-list@redhat.com, Eduardo Habkost , qemu-devel@nongnu.org On Tue, Jul 23, 2013 at 10:44:48 +0800, Peter Huang(Peng) wrote: > > libvirt's "host-passthrough" uses "-cpu host', and it "-cpu host" > > enables every feature that can be enabled on the host. > From my test results, I found that even when use host-passthrough mode, VM's > cpu features are very different from host, this doesn't match what host-passthrough > mode's explanation. > > libvirt's option exlanation: > With this mode, the CPU visible to the guest should be exactly the same as the host > CPU even in the aspects that libvirt does not understand. The libvirt documentation is what needs to be updated. While host-passthrough is asking for a CPU which is as close as possible to the real host CPU, there are features that need special handling before they can be provided to a guest. And if the hypervisor does not provide that handling, it may just filter such feature out. Also if some features can be efficiently provided to a guest even though the host CPU does not provide them (x2apic is an example of such feature), they may be provided to a guest. Jirka From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1nIr-0001EL-1f for qemu-devel@nongnu.org; Tue, 23 Jul 2013 20:51:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1nIn-00086A-QM for qemu-devel@nongnu.org; Tue, 23 Jul 2013 20:51:40 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:24894) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1nIn-00084q-7I for qemu-devel@nongnu.org; Tue, 23 Jul 2013 20:51:37 -0400 Message-ID: <51EF2469.1090402@huawei.com> Date: Wed, 24 Jul 2013 08:48:41 +0800 From: "Peter Huang(Peng)" MIME-Version: 1.0 References: <51ED1668.7030205@huawei.com> <20130722134138.GE19826@otherpad.lan.raisama.net> <51EDEE20.4060206@huawei.com> <20130723112712.GF4718@orkuz.home> In-Reply-To: <20130723112712.GF4718@orkuz.home> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Question] why x2apic's set by default without host support(on Nehalem CPU). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , libvir-list@redhat.com, qemu-devel@nongnu.org, Jiri Denemark Hi,Jiri Thanks for replying. So why VM identified different features from host is due to the hypervisor filtering. I will dig into the hypervisor of how it filter features, and update status later. Thanks again. On 2013-07-23 19:27, Jiri Denemark wrote: > On Tue, Jul 23, 2013 at 10:44:48 +0800, Peter Huang(Peng) wrote: >>> libvirt's "host-passthrough" uses "-cpu host', and it "-cpu host" >>> enables every feature that can be enabled on the host. >> From my test results, I found that even when use host-passthrough mode, VM's >> cpu features are very different from host, this doesn't match what host-passthrough >> mode's explanation. >> >> libvirt's option exlanation: >> With this mode, the CPU visible to the guest should be exactly the same as the host >> CPU even in the aspects that libvirt does not understand. > The libvirt documentation is what needs to be updated. While > host-passthrough is asking for a CPU which is as close as possible to > the real host CPU, there are features that need special handling before > they can be provided to a guest. And if the hypervisor does not provide > that handling, it may just filter such feature out. Also if some > features can be efficiently provided to a guest even though the host CPU > does not provide them (x2apic is an example of such feature), they may > be provided to a guest. > > Jirka > From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1pFL-0008EH-Iq for qemu-devel@nongnu.org; Tue, 23 Jul 2013 22:56:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1pFK-0004oe-Kr for qemu-devel@nongnu.org; Tue, 23 Jul 2013 22:56:11 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:20206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1pFI-0004nK-Vw for qemu-devel@nongnu.org; Tue, 23 Jul 2013 22:56:10 -0400 Message-ID: <51EF4201.9040802@huawei.com> Date: Wed, 24 Jul 2013 10:54:57 +0800 From: "Peter Huang(Peng)" MIME-Version: 1.0 References: <51ED1668.7030205@huawei.com> <20130722134138.GE19826@otherpad.lan.raisama.net> <51EDEE20.4060206@huawei.com> <20130723112712.GF4718@orkuz.home> <51EF2469.1090402@huawei.com> In-Reply-To: <51EF2469.1090402@huawei.com> Content-Type: multipart/alternative; boundary="------------000104080503030705040204" Subject: [Qemu-devel] [Solved]FYI//Re: [Question] why x2apic's set by default without host support(on Nehalem CPU). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , libvir-list@redhat.com, qemu-devel@nongnu.org, Jiri Denemark --------------000104080503030705040204 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit FYI, just for information sharing. KVM emulated x2apic feature no matter host supports it or not. You can get the code from arch/x86/kvm/cpuid.c. kvm_dev_ioctl_get_supported_cpuid ()->do_cpuid_ent() /* we support x2apic emulation even if host does not support * it since we emulate x2apic in software */ entry->ecx |= F(*X2APIC*); QEMU will get this feature through kvm_ioctl(). On 2013-07-24 8:48, Peter Huang(Peng) wrote: > Hi,Jiri > > Thanks for replying. > > So why VM identified different features from host is due to the hypervisor filtering. > I will dig into the hypervisor of how it filter features, and update status later. > > Thanks again. --------------000104080503030705040204 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit FYI, just for information sharing.

KVM emulated x2apic feature no matter host supports it or not.
You can get the code from arch/x86/kvm/cpuid.c.
kvm_dev_ioctl_get_supported_cpuid ()->do_cpuid_ent()

  /* we support x2apic emulation even if host does not support

                 * it since we emulate x2apic in software */

                entry->ecx |= F(X2APIC);


QEMU will get this feature through kvm_ioctl().

On 2013-07-24 8:48, Peter Huang(Peng) wrote:
Hi,Jiri

Thanks for replying.

So why VM identified different features from host is due to the hypervisor filtering.
I will dig into the hypervisor of how it filter features, and update status later.

Thanks again.
--------------000104080503030705040204--