Re: [PATCH 0/8][v2] MSI-X mask emulation support for assigned device

2010-10-21 Thread Sheng Yang
On Wednesday 20 October 2010 17:51:01 Avi Kivity wrote: > On 10/20/2010 10:26 AM, Sheng Yang wrote: > > Here is v2. > > > > Changelog: > > > > v1->v2 > > > > The major change from v1 is I've added the in-kernel MSI-X mask emulation >

Re: [PATCH 7/8] KVM: assigned dev: Introduce io_device for MSI-X MMIO accessing

2010-10-21 Thread Sheng Yang
On Thursday 21 October 2010 06:35:11 Michael S. Tsirkin wrote: > On Wed, Oct 20, 2010 at 04:26:31PM +0800, Sheng Yang wrote: > > It would be work with KVM_CAP_DEVICE_MSIX_MASK, which we would enable in > > the last patch. > > > > Signed-off-by: Sheng Yang > >

Re: [PATCH 8/8] KVM: Emulation MSI-X mask bits for assigned devices

2010-10-21 Thread Sheng Yang
On Wednesday 20 October 2010 16:26:32 Sheng Yang wrote: > This patch enable per-vector mask for assigned devices using MSI-X. The basic idea of kernel and QEmu's responsibilities are: 1. Because QEmu owned the irq routing table, so the change of table should still go to the QEmu, lik

Re: [PATCH 8/8] KVM: Emulation MSI-X mask bits for assigned devices

2010-10-21 Thread Sheng Yang
On Thursday 21 October 2010 16:39:07 Michael S. Tsirkin wrote: > On Thu, Oct 21, 2010 at 04:30:02PM +0800, Sheng Yang wrote: > > On Wednesday 20 October 2010 16:26:32 Sheng Yang wrote: > > > This patch enable per-vector mask for assigned devices using MSI-X. > > > >

Re: [PATCH 8/8] KVM: Emulation MSI-X mask bits for assigned devices

2010-10-22 Thread Sheng Yang
On Friday 22 October 2010 18:17:05 Michael S. Tsirkin wrote: > On Fri, Oct 22, 2010 at 12:42:43PM +0800, Sheng Yang wrote: > > On Thursday 21 October 2010 16:39:07 Michael S. Tsirkin wrote: > > > On Thu, Oct 21, 2010 at 04:30:02PM +0800, Sheng Yang wrote: > > > > On W

Re: [PATCH 6/8] KVM: assigned dev: Preparation for mask support in userspace

2010-10-24 Thread Sheng Yang
On Friday 22 October 2010 22:53:13 Marcelo Tosatti wrote: > On Wed, Oct 20, 2010 at 04:26:30PM +0800, Sheng Yang wrote: > > The feature wouldn't be enabled until later patch set msix_flags_enabled. > > It would be enabled along with mask support in kernel. > > >

Re: [PATCH 6/8] KVM: assigned dev: Preparation for mask support in userspace

2010-10-28 Thread Sheng Yang
On Sunday 24 October 2010 20:23:20 Michael S. Tsirkin wrote: > On Sun, Oct 24, 2010 at 08:19:09PM +0800, Sheng Yang wrote: > > > You need a guarantee that MSIX per-vector mask is used for > > > disable_irq/enable_irq, right? I can't see how this provides it. > >

Re: Crash in intel_iommu_assign_device

2010-11-01 Thread Sheng Yang
On Monday 01 November 2010 19:41:21 Jan Kiszka wrote: > Hi Sheng, > > I'm not claiming to understand the details, but this looks like use > (dereference of pte via dma_pte_addr) after release (free_pgtable_page > of dmar_domain->pgd aka pte) to me: > > static int intel_iommu_attach_device(struct

Re: [PATCH] intel-iommu: Fix use after release during device attach

2010-11-02 Thread Sheng Yang
(struct dma_pte *) > phys_to_virt(dma_pte_addr(pte)); > + free_pgtable_page(pte); > } > dmar_domain->agaw--; > } Reviewed-by: Sheng Yang CC iommu mailing list and David. OK, Jan, I got your meaning now. And i

Re: [PATCH] intel-iommu: Fix use after release during device attach

2010-11-02 Thread Sheng Yang
On Tuesday 02 November 2010 15:46:11 Jan Kiszka wrote: > Am 02.11.2010 08:31, Sheng Yang wrote: > > On Tuesday 02 November 2010 15:05:51 Jan Kiszka wrote: > >> From: Jan Kiszka > >> > >> Obtail the new pgd pointer before releasing the page containing this

Re: [PATCH] intel-iommu: Fix use after release during device attach

2010-11-02 Thread Sheng Yang
On Tuesday 02 November 2010 15:31:22 Sheng Yang wrote: > On Tuesday 02 November 2010 15:05:51 Jan Kiszka wrote: > > From: Jan Kiszka > > > > Obtail the new pgd pointer before releasing the page containing this > > value. > > > > Signed-off-by: Jan Kiszka

[PATCH 4/5] KVM: Add kvm_get_irq_routing_entry() func

2010-11-03 Thread Sheng Yang
We need to query the entry later. Signed-off-by: Sheng Yang --- include/linux/kvm_host.h |2 ++ virt/kvm/irq_comm.c | 20 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 7f9e4b7..e2ecbac

[PATCH 0/5 v3] MSI-X mask supporting for assigned device(kernel)

2010-11-03 Thread Sheng Yang
e number. This version also removed the capability enabling mechanism. Because we want to use the struct kvm_assigned_msix_entry with new IOCTL, so there is no compatible issue. Please review. And I would run more test with current patch. So far so good. -- regards Yang, Sheng Sheng Yang (5): PCI

[PATCH 3/5] KVM: Move struct kvm_io_device to kvm_host.h

2010-11-03 Thread Sheng Yang
Then it can be used in struct kvm_assigned_dev_kernel later. Signed-off-by: Sheng Yang --- include/linux/kvm_host.h | 23 +++ virt/kvm/iodev.h | 25 + 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/linux

[PATCH 5/5] KVM: assigned dev: MSI-X mask support

2010-11-03 Thread Sheng Yang
er to accelerate. Userspace shouldn't access the device MMIO directly for the information, instead it should uses provided API to do so. Signed-off-by: Sheng Yang --- Documentation/kvm/api.txt | 46 +++ arch/x86/kvm/x86.c|1 + include/linux/kvm.h | 21 +++- include/linux/

[PATCH 2/5] PCI: Add mask bit definition for MSI-X table

2010-11-03 Thread Sheng Yang
Then we can use it instead of magic number 1. Cc: Matthew Wilcox Cc: Jesse Barnes Cc: linux-...@vger.kernel.org Signed-off-by: Sheng Yang --- drivers/pci/msi.c|4 ++-- include/linux/pci_regs.h |1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci

[PATCH 1/5] PCI: MSI: Move MSI-X entry definition to pci_regs.h

2010-11-03 Thread Sheng Yang
Then it can be used by others. Reviewed-by: Matthew Wilcox Cc: Jesse Barnes Cc: linux-...@vger.kernel.org Signed-off-by: Sheng Yang --- drivers/pci/msi.h|6 -- include/linux/pci_regs.h |7 +++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/pci

[PATCH 0/3] MSI-X mask supporting for assigned device(QEmu)

2010-11-03 Thread Sheng Yang
Sheng Yang (3): qemu-kvm: Ioctl for in-kernel mask support qemu-kvm: device assignment: Some clean up about MSI-X code qemu-kvm: device assignment: emulate MSI-X mask bits hw/device-assignment.c | 236 ++-- qemu-kvm.c | 15

[PATCH 2/3] qemu-kvm: device assignment: Some clean up about MSI-X code

2010-11-03 Thread Sheng Yang
Signed-off-by: Sheng Yang --- hw/device-assignment.c | 77 --- 1 files changed, 52 insertions(+), 25 deletions(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index 2605bd1..8a98876 100644 --- a/hw/device-assignment.c +++ b/hw

[PATCH 1/3] qemu-kvm: Ioctl for in-kernel mask support

2010-11-03 Thread Sheng Yang
Signed-off-by: Sheng Yang --- qemu-kvm.c | 15 +++ qemu-kvm.h |6 ++ 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index 733d0a9..ba6db51 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1092,6 +1092,21 @@ int kvm_assign_set_msix_entry

[PATCH 3/3] qemu-kvm: device assignment: emulate MSI-X mask bits

2010-11-03 Thread Sheng Yang
This patch emulated MSI-X per vector mask bit on assigned device. Signed-off-by: Sheng Yang --- hw/device-assignment.c | 161 ++-- 1 files changed, 155 insertions(+), 6 deletions(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index

Re: [PATCH 3/3] qemu-kvm: device assignment: emulate MSI-X mask bits

2010-11-04 Thread Sheng Yang
On Thursday 04 November 2010 18:04:08 Michael S. Tsirkin wrote: > On Thu, Nov 04, 2010 at 02:18:21PM +0800, Sheng Yang wrote: > > This patch emulated MSI-X per vector mask bit on assigned device. > > > > Signed-off-by: Sheng Yang > > Also pls update the in-tree he

Re: [PATCH 2/5] PCI: Add mask bit definition for MSI-X table

2010-11-04 Thread Sheng Yang
On Thursday 04 November 2010 17:50:29 Michael S. Tsirkin wrote: > On Thu, Nov 04, 2010 at 02:15:18PM +0800, Sheng Yang wrote: > > Then we can use it instead of magic number 1. > > > > Cc: Matthew Wilcox > > Cc: Jesse Barnes > > Cc: linux-...@vger.kernel.

Re: [PATCH 2/5] PCI: Add mask bit definition for MSI-X table

2010-11-04 Thread Sheng Yang
On Friday 05 November 2010 08:48:43 Hidetoshi Seto wrote: > (2010/11/04 15:15), Sheng Yang wrote: > > Then we can use it instead of magic number 1. > > > > Cc: Matthew Wilcox > > Cc: Jesse Barnes > > Cc: linux-...@vger.kernel.org > > Signed-off-by: Sh

Re: [PATCH 1/3] qemu-kvm: Ioctl for in-kernel mask support

2010-11-04 Thread Sheng Yang
On Thursday 04 November 2010 17:47:58 Michael S. Tsirkin wrote: > On Thu, Nov 04, 2010 at 02:18:19PM +0800, Sheng Yang wrote: > > Signed-off-by: Sheng Yang > > --- > > > > qemu-kvm.c | 15 +++ > > qemu-kvm.h |6 ++ > > 2 files

Re: [PATCH 5/5] KVM: assigned dev: MSI-X mask support

2010-11-04 Thread Sheng Yang
On Thursday 04 November 2010 18:43:22 Michael S. Tsirkin wrote: > On Thu, Nov 04, 2010 at 02:15:21PM +0800, Sheng Yang wrote: > > This patch enable per-vector mask for assigned devices using MSI-X. > > > > This patch provided two new APIs: one is for guest to specific dev

Re: [PATCH 2/3] qemu-kvm: device assignment: Some clean up about MSI-X code

2010-11-04 Thread Sheng Yang
On Thursday 04 November 2010 17:47:16 Michael S. Tsirkin wrote: > On Thu, Nov 04, 2010 at 02:18:20PM +0800, Sheng Yang wrote: > > Signed-off-by: Sheng Yang > > If you have the energy for cleanups, how about > removing most of msi/msix code in device-assignment and using

Re: [PATCH 3/3] qemu-kvm: device assignment: emulate MSI-X mask bits

2010-11-04 Thread Sheng Yang
On Thursday 04 November 2010 17:44:27 Michael S. Tsirkin wrote: Thanks very much for reviewing this! Seems nobody cares about userspace one before... > On Thu, Nov 04, 2010 at 02:18:21PM +0800, Sheng Yang wrote: > > This patch emulated MSI-X per vector mask bit on assign

Re: [PATCH 5/5] KVM: assigned dev: MSI-X mask support

2010-11-04 Thread Sheng Yang
On Friday 05 November 2010 10:44:19 Sheng Yang wrote: > On Thursday 04 November 2010 18:43:22 Michael S. Tsirkin wrote: > > On Thu, Nov 04, 2010 at 02:15:21PM +0800, Sheng Yang wrote: > > > This patch enable per-vector mask for assigned devices using MSI-X. > > > > &

Re: KVM: VMX: remove GUEST_CR3 write from vmx_vcpu_run

2009-10-22 Thread Sheng Yang
On Tuesday 20 October 2009 20:37:20 Marcelo Tosatti wrote: > GUEST_CR3 is updated via kvm_set_cr3 whenever CR3 value > changes. The description is not that accuracy... If CR3 value change in guest when EPT enabled, no VM Exit would happen, then no kvm_set_cr3... -- regards Yang, Sheng > > Sign

[PATCH 1/1] Fix unable to detect libpci

2009-11-12 Thread Sheng Yang
commit 75fe7882 "Test for libpci, not only for header" compile a libpci test file. But the pciutils with defined PCI_COMPRESSED_IDS also need zlib when compile, otherwise the compile would fail, and detection fail then CC: Juan Quintela Signed-off-by: Sheng Yang --- configure |

[PATCH 1/1] Fix null DESTDIR in depmod execution

2009-11-12 Thread Sheng Yang
commit 52ea5897fa9fdadf0cc1a5242a23ce3dab599769 "Use DESTDIR consitently on installation" add -b ${DESTDIR} to depmod. But the DESTDIR is default NULL, then depmod would report error. Set DESTDIR=/ as default Signed-off-by: Sheng Yang --- Makefile |2 +- 1 files changed, 1 insert

[PATCH] qemu-kvm: Fix INTx assigned device can't work bug

2009-11-24 Thread Sheng Yang
e of the fact that people don't use INTx these days...) CC: Gerd Hoffmann Signed-off-by: Sheng Yang --- hw/device-assignment.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index 516cf14..64f3dc2 100644 --- a/h

[PATCH] qemu-kvm: Fix assigned device config space

2009-11-26 Thread Sheng Yang
The new pci_dev->dev.config is a uint_8 pointer, but get_real_device() still using sizeof(pci_dev->dev.config) to fill the configuration space, which lost most of information. Spot the issue when INTx cannot work again after previous fix... Signed-off-by: Sheng Yang --- hw/device-assign

[PATCH] KVM: VMX: Disable unrestricted guest when EPT disabled

2009-11-27 Thread Sheng Yang
Otherwise would cause VMEntry failure when using ept=0 on unrestricted guest supported processors. Signed-off-by: Sheng Yang --- arch/x86/kvm/vmx.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 80367c5..1092e8a 100644

[PATCH] KVM: Fix possible circular locking in kvm_vm_ioctl_assign_device()

2009-12-07 Thread Sheng Yang
One possible order is: KVM_CREATE_IRQCHIP ioctl(took kvm->lock) -> kvm_iobus_register_dev() -> down_write(kvm->slots_lock). The other one is in kvm_vm_ioctl_assign_device(), which take kvm->slots_lock first, then kvm->lock. Observe it due to kernel locking debug warnings. Si

Re: [PATCH 2/4] KVM: Add accessor for reading cr4 (or some bits of cr4)

2009-12-07 Thread Sheng Yang
On Monday 07 December 2009 18:47:10 Avi Kivity wrote: > Some bits of cr4 can be owned by the guest on vmx, so when we read them, > we copy them to the vcpu structure. In preparation for making the set of > guest-owned bits dynamic, use helpers to access these bits so we don't need > to know where

Re: [PATCH 2/4] KVM: Add accessor for reading cr4 (or some bits of cr4)

2009-12-08 Thread Sheng Yang
On Tue, Dec 08, 2009 at 11:36:59AM +0200, Avi Kivity wrote: > On 12/08/2009 09:57 AM, Sheng Yang wrote: > >vcpu->arch.cr0 = cr0; > >>- vmx_set_cr4(vcpu, vcpu->arch.cr4); > >>+ vmx_set_cr4(vcpu, kvm_read_cr4(vcpu)); > >>}

[PATCH] KVM: VMX: Add instruction rdtscp support for guest

2009-12-09 Thread Sheng Yang
Before enabling, execution of "rdtscp" in guest would result in #UD. Signed-off-by: Sheng Yang --- arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/vmx.c |3 ++- 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include

Re: [PATCH] KVM: VMX: Add instruction rdtscp support for guest

2009-12-09 Thread Sheng Yang
On Wednesday 09 December 2009 17:54:46 Avi Kivity wrote: > On 12/09/2009 11:11 AM, Sheng Yang wrote: > > Before enabling, execution of "rdtscp" in guest would result in #UD. > > > > Signed-off-by: Sheng Yang > > --- > > arch/x86/include/asm/vmx.h |

Re: [PATCH 1/2] KVM: Discard shadow_mt_mask

2009-12-11 Thread Sheng Yang
On Mon, Apr 27, 2009 at 05:47:44PM +0800, Sheng Yang wrote: > mt_mask is out of date, now it have only been used as a flag to indicate if > TDP > enabled. Get rid of it and use tdp_enabled instead. I realized this one break NPT on my way home... Would update the patches soon. -- reg

Re: [PATCH] KVM: Fix possible circular locking in kvm_vm_ioctl_assign_device()

2009-12-13 Thread Sheng Yang
On Monday 07 December 2009 16:58:04 Sheng Yang wrote: > One possible order is: > > KVM_CREATE_IRQCHIP ioctl(took kvm->lock) -> kvm_iobus_register_dev() -> > down_write(kvm->slots_lock). > > The other one is in kvm_vm_ioctl_assign_device(), which take > kvm-

[PATCH] KVM: Fix possible circular locking in kvm_vm_ioctl_assign_device()

2009-12-14 Thread Sheng Yang
e it due to kernel locking debug warnings. Signed-off-by: Sheng Yang --- virt/kvm/assigned-dev.c |6 +++--- virt/kvm/kvm_main.c |2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index fd9c097..f73de63 100644 --- a/virt/

[PATCH] KVM: VMX: Trap and invalid MWAIT/MONITOR instruction

2009-12-14 Thread Sheng Yang
We don't support these instructions, but guest can execute them even if the feature('monitor') haven't been exposed in CPUID. So we would trap and inject a #UD if guest try this way. Signed-off-by: Sheng Yang --- arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/

[PATCH] KVM: VMX: Trap and invalid MWAIT/MONITOR instruction

2009-12-14 Thread Sheng Yang
We don't support these instructions, but guest can execute them even if the feature('monitor') haven't been exposed in CPUID. So we would trap and inject a #UD if guest try this way. Signed-off-by: Sheng Yang --- arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/

[PATCH 0/4] Add support for RDTSCP in VMX

2009-12-15 Thread Sheng Yang
After discussion with Avi, we decided to take this chance to extend the shared MSR framework, discard the limitation of "All CPU should have same value for the MSRs". But the limitation of "The MSRs' value shouldn't be modified after they were read" still apply. I have tested this patchset using 2

[PATCH 1/4] KVM: VMX: Remove redundant variable

2009-12-15 Thread Sheng Yang
It's no longer necessary. Signed-off-by: Sheng Yang --- arch/x86/kvm/vmx.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9a0a2cf..5c464ed 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2383,14 +23

[PATCH 3/4] x86: Add IA32_TSC_AUX MSR

2009-12-15 Thread Sheng Yang
Also replaced the hardcode value in write_tsc() and write_tscp_aux(). CC: Ingo Molnar Signed-off-by: Sheng Yang --- arch/x86/include/asm/msr-index.h |1 + arch/x86/include/asm/msr.h |4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/msr

[PATCH 2/4] KVM: Extended shared_msr_global to per CPU

2009-12-15 Thread Sheng Yang
w the shared_msr_global still have one assumption: it can only deal with the MSRs that won't change in host after KVM module loaded. Signed-off-by: Sheng Yang --- arch/x86/kvm/x86.c | 64 ++-- 1 files changed, 42 insertions(+), 22 deletions(-) di

[PATCH 4/4] KVM: VMX: Add instruction rdtscp support for guest

2009-12-15 Thread Sheng Yang
Before enabling, execution of "rdtscp" in guest would result in #UD. Signed-off-by: Sheng Yang --- arch/x86/include/asm/kvm_host.h |1 + arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/svm.c |6 ++ arch/x86/kvm/vmx.c

[PATCH 2/4] KVM: Extended shared_msr_global to per CPU

2009-12-17 Thread Sheng Yang
w the shared_msr_global still have one assumption: it can only deal with the MSRs that won't change in host after KVM module loaded. Signed-off-by: Sheng Yang --- How about this? Move the all initialization to hardware_enable(). And only initialized once for each cpu. arch/x86/kvm/x8

[PATCH 4/4] KVM: VMX: Add instruction rdtscp support for guest

2009-12-17 Thread Sheng Yang
Before enabling, execution of "rdtscp" in guest would result in #UD. Signed-off-by: Sheng Yang --- Reflect guest CPUID on vmcs fields as well, but it involved some more code which would only executed once... Do we need a callback there for post-"cpuid setting"? arch/x86/in

Re: [PATCH 4/4] KVM: VMX: Add instruction rdtscp support for guest

2009-12-17 Thread Sheng Yang
On Thursday 17 December 2009 18:39:22 Avi Kivity wrote: > On 12/17/2009 11:33 AM, Sheng Yang wrote: > > Before enabling, execution of "rdtscp" in guest would result in #UD. > > > > Signed-off-by: Sheng Yang > > --- > > > > Reflect guest CPUID

Re: [PATCH 2/4] KVM: Extended shared_msr_global to per CPU

2009-12-17 Thread Sheng Yang
On Thursday 17 December 2009 18:32:08 Avi Kivity wrote: > On 12/17/2009 11:32 AM, Sheng Yang wrote: > > shared_msr_global saved host value of relevant MSRs, but it have an > > assumption that all MSRs it tracked shared the value across the different > > CPUs. It's no

[PATCH 0/6 v2] Add support for RDTSCP in VMX

2009-12-18 Thread Sheng Yang
-- regards Yang, Sheng arch/x86/include/asm/kvm_host.h |2 + arch/x86/include/asm/msr-index.h |1 + arch/x86/include/asm/msr.h |4 +- arch/x86/include/asm/vmx.h |1 + arch/x86/kernel/vsyscall_64.c|3 +- arch/x86/kvm/svm.c | 13 +++ arch/x86

[PATCH 1/6] KVM: VMX: Remove redundant variable

2009-12-18 Thread Sheng Yang
It's no longer necessary. Signed-off-by: Sheng Yang --- arch/x86/kvm/vmx.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9a0a2cf..5c464ed 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2383,14 +23

[PATCH 2/6] x86: Add IA32_TSC_AUX MSR

2009-12-18 Thread Sheng Yang
Also replaced the hardcode value in write_tsc() and write_tscp_aux(). Signed-off-by: Sheng Yang --- (Already applied by Ingo) arch/x86/include/asm/msr-index.h |1 + arch/x86/include/asm/msr.h |4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86

[PATCH 3/6] KVM: Extended shared_msr_global to per CPU

2009-12-18 Thread Sheng Yang
w the shared_msr_global still have one assumption: it can only deal with the MSRs that won't change in host after KVM module loaded. Signed-off-by: Sheng Yang --- arch/x86/kvm/x86.c | 55 +++ 1 files changed, 33 insertions(+), 22 deletions(-) di

[PATCH 4/6] x86: Raise vsyscall priority on hotplug notifier chain

2009-12-18 Thread Sheng Yang
KVM need vsyscall_init() to initialize MSR_TSC_AUX before it read the value. Per Avi's suggestion, this patch raised vsyscall priority on hotplug notifier chain, to 30. CC: Ingo Molnar CC: linux-ker...@vger.kernel.org Signed-off-by: Sheng Yang --- arch/x86/kernel/vsyscall_64.c |3 +

[PATCH 5/6] KVM: Add cpuid_update() callback to kvm_x86_ops

2009-12-18 Thread Sheng Yang
Sometime, we need to adjust some state in order to reflect guest CPUID setting, e.g. if we don't expose rdtscp to guest, we won't want to enable it on hardware. cpuid_update() is introduced for this purpose. Also export kvm_find_cpuid_entry() for later use. Signed-off-by: Sheng Yang

[PATCH 6/6] KVM: VMX: Add instruction rdtscp support for guest

2009-12-18 Thread Sheng Yang
Before enabling, execution of "rdtscp" in guest would result in #UD. Signed-off-by: Sheng Yang --- arch/x86/include/asm/kvm_host.h |1 + arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/svm.c |7 arch/x86/kvm/vmx.c

Re: [PATCH qemu-kvm] device assignment: default requires IOMMU

2009-12-23 Thread Sheng Yang
On Thursday 24 December 2009 14:51:23 Simon Horman wrote: > On Thu, Dec 24, 2009 at 01:45:34AM +0100, Alexander Graf wrote: > > Am 23.12.2009 um 23:40 schrieb Chris Wright : > > >[ resend, fixing email header, sorry for duplicate ] > > > > > >The default mode for device assignment is to rely on an

Re: [patch 00/11] convert slotslock to SRCU v2

2009-12-24 Thread Sheng Yang
On Thursday 24 December 2009 22:56:38 Gleb Natapov wrote: > On Thu, Dec 24, 2009 at 10:30:24AM +0200, Avi Kivity wrote: > > On 12/23/2009 06:35 PM, Marcelo Tosatti wrote: > > >Addressing comments. > > > > Looks good. > > Looks good to me too. One small comment on the naming: kvm->memslots->memsl

Re: [patch 00/11] convert slotslock to SRCU v2

2009-12-25 Thread Sheng Yang
On Saturday 26 December 2009 00:27:11 Avi Kivity wrote: > On 12/25/2009 02:25 PM, Marcelo Tosatti wrote: > >> One small comment on the naming: > >> > >> kvm->memslots->memslots[i] > >> kvm->aliases->aliases[i] > >> > >> Doesn't look good... > > > > Hi Sheng, > > > > Yes its somewhat confusing but i

Re: unable to assign devices with VT-d in KVM

2009-12-28 Thread Sheng Yang
On Monday 28 December 2009 00:42:37 Erez Shitrit wrote: > [I hope I didn't duplicate my response] > I tried it, still have kernel-panic, > Currently the message is: > " > > MP-BIOS bug: 8254 timer not connected to IO-APIC > Kernel panic - not syncing: IO-APIC + timer doesn't work! Try using th

Re: unable to assign devices with VT-d in KVM

2009-12-28 Thread Sheng Yang
On Monday 28 December 2009 00:42:37 Erez Shitrit wrote: > [I hope I didn't duplicate my response] > I tried it, still have kernel-panic, > Currently the message is: > " > > MP-BIOS bug: 8254 timer not connected to IO-APIC > Kernel panic - not syncing: IO-APIC + timer doesn't work! Try using th

Re: unable to assign devices with VT-d in KVM

2009-12-29 Thread Sheng Yang
On Wednesday 30 December 2009 00:10:42 Erez Shitrit wrote: > I tried it also, the same result :( > > Any idea? What's your guest kernel version? I'd like to reproduce it. -- regards Yang, Sheng > > Thanks, Erez > -Original Message- > From: Sheng Yan

Re: [PATCH 0/5] Lazy fpu, cr0.ts

2009-12-31 Thread Sheng Yang
On Thursday 31 December 2009 00:25:37 Avi Kivity wrote: > There are currently some inefficiencies in how we virtualize the fpu and > cr0: > > - we trap changes to cr0.ts unconditionally; however, when the guest fpu > is loaded, we're not really interested in cr0.ts (it's only needed when > th

[PATCH 0/3] EPT 1GB page support

2010-01-05 Thread Sheng Yang
-- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH 2/3] KVM: x86: Fix host_mapping_level()

2010-01-05 Thread Sheng Yang
When found a error hva, should not return PAGE_SIZE but the level... Also clean up the coding style of the following loop. Signed-off-by: Sheng Yang --- arch/x86/kvm/mmu.c |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c

[PATCH 1/3] KVM: x86: Rename gb_page_enable() to get_lpage_level() in kvm_x86_ops

2010-01-05 Thread Sheng Yang
Then the callback can provide the maximum supported large page level, which is more flexible. Also move the gb page support into x86_64 specific. Signed-off-by: Sheng Yang --- arch/x86/include/asm/kvm_host.h |2 +- arch/x86/kvm/svm.c |6 +++--- arch/x86/kvm/vmx.c

[PATCH 3/3] KVM: VMX: Enable EPT 1GB page support

2010-01-05 Thread Sheng Yang
Signed-off-by: Sheng Yang --- arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/mmu.c |8 +--- arch/x86/kvm/vmx.c | 11 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index 713ed9a

Re: [PATCH 3/3] KVM: VMX: Enable EPT 1GB page support

2010-01-05 Thread Sheng Yang
On Tuesday 05 January 2010 18:43:21 Avi Kivity wrote: > On 01/05/2010 12:12 PM, Sheng Yang wrote: > > Signed-off-by: Sheng Yang > > --- > > arch/x86/include/asm/vmx.h |1 + > > arch/x86/kvm/mmu.c |8 +--- > > arch/x86/kvm/vmx.c

[PATCH 0/4 v2] EPT 1GB page support

2010-01-05 Thread Sheng Yang
-- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH 1/4] KVM: x86: Moving PT_*_LEVEL to mmu.h

2010-01-05 Thread Sheng Yang
We can use them in x86.c and vmx.c now... Signed-off-by: Sheng Yang --- arch/x86/kvm/mmu.c |4 arch/x86/kvm/mmu.h |4 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index c43c2ab..15daf3c 100644 --- a/arch/x86/kvm/mmu.c

[PATCH 2/4] KVM: x86: Rename gb_page_enable() to get_lpage_level() in kvm_x86_ops

2010-01-05 Thread Sheng Yang
Then the callback can provide the maximum supported large page level, which is more flexible. Also move the gb page support into x86_64 specific. Signed-off-by: Sheng Yang --- arch/x86/include/asm/kvm_host.h |2 +- arch/x86/kvm/svm.c |6 +++--- arch/x86/kvm/vmx.c

[PATCH 3/4] KVM: x86: Fix host_mapping_level()

2010-01-05 Thread Sheng Yang
When found a error hva, should not return PAGE_SIZE but the level... Also clean up the coding style of the following loop. Cc: sta...@kernel.org Signed-off-by: Sheng Yang --- arch/x86/kvm/mmu.c |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b

[PATCH 4/4] KVM: VMX: Enable EPT 1GB page support

2010-01-05 Thread Sheng Yang
Signed-off-by: Sheng Yang --- arch/x86/include/asm/vmx.h |1 + arch/x86/kvm/mmu.c |8 +--- arch/x86/kvm/vmx.c | 11 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index 713ed9a

Re: [PATCH 4/4] KVM: VMX: Enable EPT 1GB page support

2010-01-06 Thread Sheng Yang
On Wednesday 06 January 2010 17:19:15 Marcelo Tosatti wrote: > On Tue, Jan 05, 2010 at 07:02:29PM +0800, Sheng Yang wrote: > > Signed-off-by: Sheng Yang > > --- > > arch/x86/include/asm/vmx.h |1 + > > arch/x86/kvm/mmu.c |8 +--- > >

The HPET issue on Linux

2010-01-06 Thread Sheng Yang
Hi Beth I still found the emulated HPET would result in some boot failure. For example, on my 2.6.30, with HPET enabled, the kernel would fail check_timer(), especially in timer_irq_works(). The testing of timer_irq_works() is let 10 ticks pass(using mdelay()), and want to confirm the clock so

Re: The HPET issue on Linux

2010-01-06 Thread Sheng Yang
On Thursday 07 January 2010 02:36:26 Beth Kon wrote: > Dor Laor wrote: > > On 01/06/2010 12:09 PM, Gleb Natapov wrote: > >> On Wed, Jan 06, 2010 at 05:48:52PM +0800, Sheng Yang wrote: > >>> Hi Beth > >>> > >>> I still found the emulated HPET wo

[PATCH] KVM: Add missing emulation failure report in kvm_mmu_page_fault()

2010-01-15 Thread Sheng Yang
Currently we only have handle_invalid_guest_state() reported emulation failure... Signed-off-by: Sheng Yang --- arch/x86/kvm/mmu.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 4f5508c..037e52a 100644 --- a/arch/x86/kvm

Re: [PATCH] KVM: Add missing emulation failure report in kvm_mmu_page_fault()

2010-01-18 Thread Sheng Yang
On Sunday 17 January 2010 20:34:23 Avi Kivity wrote: > On 01/15/2010 10:44 AM, Sheng Yang wrote: > > Currently we only have handle_invalid_guest_state() reported emulation > > failure... > > > > Signed-off-by: Sheng Yang > > --- > > arch/x86/kvm/mmu.c |

Re: [PATCH] KVM: Add missing emulation failure report in kvm_mmu_page_fault()

2010-01-18 Thread Sheng Yang
On Monday 18 January 2010 19:32:14 Avi Kivity wrote: > On 01/18/2010 11:32 AM, Sheng Yang wrote: > > On Sunday 17 January 2010 20:34:23 Avi Kivity wrote: > >> On 01/15/2010 10:44 AM, Sheng Yang wrote: > >>> Currently we only have handle_invalid_guest_state() re

Re: [PATCH] KVM: Add missing emulation failure report in kvm_mmu_page_fault()

2010-01-19 Thread Sheng Yang
On Tuesday 19 January 2010 15:57:57 Gleb Natapov wrote: > On Tue, Jan 19, 2010 at 09:54:44AM +0200, Avi Kivity wrote: > > On 01/19/2010 05:06 AM, Sheng Yang wrote: > > >>There are two problems with the kernel failure report. First, it > > >>doesn't repor

[PATCH] KVM: x86: Remove emulation failure report

2010-01-19 Thread Sheng Yang
ove the emulation failure report in handle_invalid_guest_state(), and would inspected the guest using userspace tool in the future. Signed-off-by: Sheng Yang --- arch/x86/kvm/vmx.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index

[PATCH] kvm: qemu: Remove reminder for checking dmesg after emulation failure

2010-01-19 Thread Sheng Yang
User can use QEmu to get more information. E.g. using the QEmu built-in disassembly to get the failure instruction like(in the monitor): x /20i $eip to dump the code at $eip, or using "x /20i $eip-20" to look around. Signed-off-by: Sheng Yang --- qemu-kvm.c |2 +- 1 files

[PATCH] KVM: Ensure the exit frequency to QEmu for coalesced MMIO

2010-01-20 Thread Sheng Yang
on, for it would doing nothing at all in userspace handler. Signed-off-by: Sheng Yang --- arch/x86/include/asm/kvm_host.h |2 ++ arch/x86/kvm/x86.c | 31 +++ 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h

Re: [PATCH] KVM: Ensure the exit frequency to QEmu for coalesced MMIO

2010-01-20 Thread Sheng Yang
On Wednesday 20 January 2010 16:35:59 Sheng Yang wrote: > The default action of calesced MMIO is, cache the writing in buffer, until: > 1. The buffer is full. > 2. Or the exit to QEmu due to other reasons. > > But this would result in a very late writing in some condition. >

Re: [PATCH] KVM: Ensure the exit frequency to QEmu for coalesced MMIO

2010-01-20 Thread Sheng Yang
On Wednesday 20 January 2010 17:11:51 Avi Kivity wrote: > On 01/20/2010 10:35 AM, Sheng Yang wrote: > > The default action of calesced MMIO is, cache the writing in buffer, > > until: 1. The buffer is full. > > 2. Or the exit to QEmu due to other reasons. > > > >

Re: [PATCH] KVM: Ensure the exit frequency to QEmu for coalesced MMIO

2010-01-20 Thread Sheng Yang
On Wednesday 20 January 2010 17:47:48 Avi Kivity wrote: > On 01/20/2010 11:34 AM, Sheng Yang wrote: > >> I think we can even do this from the I/O thread, without stopping a > >> vcpu, since the colaesced mmio page is not tied to a vcpu but is a vm > >> property. >

[PATCH] KVM: Fix kvm_coalesced_mmio_ring duplicate allocation

2010-01-21 Thread Sheng Yang
The commit 0953ca73 "KVM: Simplify coalesced mmio initialization" allocate kvm_coalesced_mmio_ring in the kvm_coalesced_mmio_init(), but didn't discard the original allocation... Signed-off-by: Sheng Yang --- virt/kvm/kvm_main.c | 17 - 1 files changed, 0 in

[PATCH] kvm: Flush coalesced MMIO buffer periodly

2010-01-21 Thread Sheng Yang
riodly flushing coalesced MMIO buffer in QEmu IO thread. By this way, We don't need vcpu explicit exit to QEmu to handle this issue. Current synchronize rate is 1/25s. Signed-off-by: Sheng Yang --- qemu-kvm.c | 47 +-- qemu-kvm.h |2 ++ 2 files ch

Re: [PATCH] Debug vcpu add

2010-01-21 Thread Sheng Yang
On Thursday 21 January 2010 19:50:17 Liu, Jinsong wrote: > From 479e84d9ce9d7d78d845f438071a4b1a44aca0bb Mon Sep 17 00:00:00 2001 > From: Liu, Jinsong > Date: Fri, 22 Jan 2010 03:30:33 +0800 > Subject: [PATCH] Debug vcpu add Jinsong, this name is pretty strange... I think something like "Fix

[PATCH] kvm: Flush coalesced MMIO buffer periodly

2010-01-21 Thread Sheng Yang
a flushing for coalesced MMIO buffer in VGA update handler. By this way, We don't need vcpu explicit exit to QEmu to handle this issue. Signed-off-by: Sheng Yang --- Like this? qemu-kvm.c | 26 -- qemu-kvm.h |6 ++ vl.c |2 ++ 3 files changed,

Re: KVM Virtual CPU time profiling

2010-01-21 Thread Sheng Yang
On Friday 22 January 2010 02:41:35 Saksena, Abhishek wrote: > Hi All, > Is there a way in KVM to measure the real physical (CPU) time consumed by > each running Virtual CPU? (I want to do time profiling of the virtual > machines running on host system) > > Also, is there an explanation somewher

Re: [PATCH] kvm: Flush coalesced MMIO buffer periodly

2010-01-24 Thread Sheng Yang
On Sunday 24 January 2010 15:35:58 Avi Kivity wrote: > On 01/22/2010 04:22 AM, Sheng Yang wrote: > > The default action of coalesced MMIO is, cache the writing in buffer, > > until: 1. The buffer is full. > > 2. Or the exit to QEmu due to other reasons. > > > > But

[PATCH] kvm: Flush coalesced MMIO buffer periodly

2010-01-24 Thread Sheng Yang
shing coalesced MMIO buffer in VGA update handler. By this way, We don't need vcpu explicit exit to QEmu to handle this issue. Signed-off-by: Sheng Yang --- cpu-all.h |2 ++ exec.c |6 ++ kvm-all.c | 20 qemu-kvm.c |9 +++-- qemu-kvm.h |2 +

[PATCH v2][uqmaster] kvm: Flush coalesced MMIO buffer periodly

2010-01-26 Thread Sheng Yang
shing coalesced MMIO buffer in VGA update handler. By this way, We don't need vcpu explicit exit to QEmu to handle this issue. Signed-off-by: Sheng Yang --- cpu-all.h |2 ++ exec.c|6 ++ kvm-all.c | 21 + kvm.h |1 + vl.c |2 ++ 5 files ch

Re: [PATCH v2][uqmaster] kvm: Flush coalesced MMIO buffer periodly

2010-01-26 Thread Sheng Yang
On Tue, Jan 26, 2010 at 10:59:17AM +0100, Alexander Graf wrote: > > On 26.01.2010, at 10:41, Sheng Yang wrote: > > > --- a/kvm-all.c > > +++ b/kvm-all.c > > @@ -59,6 +59,7 @@ struct KVMState > > int vmfd; > > int regs_modified; >

<    2   3   4   5   6   7   8   9   10   11   >