RE: [v3 04/26] iommu, x86: Implement irq_set_vcpu_affinity for intel_ir_chip

2015-01-28 Thread Wu, Feng
> -Original Message- > From: David Woodhouse [mailto:dw...@infradead.org] > Sent: Wednesday, January 28, 2015 11:27 PM > To: Wu, Feng > Cc: t...@linutronix.de; mi...@redhat.com; h...@zytor.com; x...@kernel.org; > g...@kernel.org; pbonz...@redhat.com; j...@8bytes.org; > alex.william...@red

Re: Windows 2008 Guest BSODS with CLOCK_WATCHDOG_TIMEOUT on VM migration

2015-01-28 Thread Mikhail Sennikovskii
Hi Jidong, right, this issue is SMP-specific. Mikhail On 27.01.2015 20:09, Jidong Xiao wrote: On Tue, Jan 27, 2015 at 5:55 AM, Mikhail Sennikovskii wrote: Hi all, I've posted the bolow mail to the qemu-dev mailing list, but I've got no response there. That's why I decided to re-post it here

Re: Windows 2008 Guest BSODS with CLOCK_WATCHDOG_TIMEOUT on VM migration

2015-01-28 Thread Mikhail Sennikovskii
Hi Zhang, Thanks a lot for the suggestion, it indeed worked for me! I.e. after adding the hv_relaxed to the list of CPU properties I can no longer reproduce the BSOD on migration with any kernel version that I used so far. Thanks for your help, Mikhail On 28.01.2015 07:42, Zhang Haoyu wrote:

Re: [PATCH v4 0/6] KVM: nVMX: Enable nested apicv support

2015-01-28 Thread Wincy Van
On Thu, Jan 29, 2015 at 11:17 AM, Zhang, Yang Z wrote: > Wincy Van wrote on 2015-01-28: >> v1 ---> v2: >> Use spin lock to ensure vmcs12 is safe when doing nested >> posted interrupt delivery. >> v2 ---> v3: >> 1. Add a new field in nested_vmx to avoid the spin lock in v2. >> 2. Drop send

RE: [PATCH v4 2/6] KVM: nVMX: Enable nested virtualize x2apic mode

2015-01-28 Thread Zhang, Yang Z
Wincy Van wrote on 2015-01-29: > On Thu, Jan 29, 2015 at 10:54 AM, Zhang, Yang Z > wrote: >>> -8646,7 +8750,8 @@ static void prepare_vmcs02(struct kvm_vcpu >>> *vcpu, struct vmcs12 *vmcs12) >>> else >>> vmcs_write64(APIC_ACCESS_ADDR, >>> >>> page_to_phys(vmx->nested.apic_a

[PATCH v3] PCI: Add guard to avoid mapping a invalid msix base address

2015-01-28 Thread Yijing Wang
Sometimes, a pci bridge device BAR was not assigned properly. After we call pci_bus_assign_resources(), the resource of the BAR would be reseted. So if we try to enable msix for this device, it will map a invalid resource as the msix base address, and a warning call trace will report. pci_bus_assi

[PATCH v4 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Wincy Van
Currently, if L1 enables MSR_BITMAP, we will emulate this feature, all of L2's msr access is intercepted by L0. Since many features like virtualize x2apic mode has a complicated logic and it is difficult for us to emulate, we should use hardware and merge the bitmap. This patch introduces nested_v

Re: [PATCH v4 2/6] KVM: nVMX: Enable nested virtualize x2apic mode

2015-01-28 Thread Wincy Van
On Thu, Jan 29, 2015 at 10:54 AM, Zhang, Yang Z wrote: >> -8646,7 +8750,8 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, >> struct vmcs12 *vmcs12) >> else >> vmcs_write64(APIC_ACCESS_ADDR, >> >> page_to_phys(vmx->nested.apic_access_page

[PATCH v4 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Wincy Van
Currently, if L1 enables MSR_BITMAP, we will emulate this feature, all of L2's msr access is intercepted by L0. Since many features like virtualize x2apic mode has a complicated logic and it is difficult for us to emulate, we should use hardware and merge the bitmap. This patch introduces nested_v

Re: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Wincy Van
On Wed, Jan 28, 2015 at 4:05 PM, Zhang, Yang Z wrote: >> @@ -8344,7 +8394,68 @@ static int >> nested_vmx_check_msr_bitmap_controls(struct kvm_vcpu *vcpu, static >> inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu, >>struct vmcs12 >> *vm

[PATCH v4 4/6] KVM: nVMX: Enable nested apic register virtualization

2015-01-28 Thread Wincy Van
We can reduce apic register virtualization cost with this feature, it is also a requirement for virtual interrupt delivery and posted interrupt processing. Signed-off-by: Wincy Van --- arch/x86/kvm/vmx.c | 36 1 files changed, 32 insertions(+), 4 deletions(

Re: [v3 04/26] iommu, x86: Implement irq_set_vcpu_affinity for intel_ir_chip

2015-01-28 Thread David Woodhouse
On Fri, 2014-12-12 at 23:14 +0800, Feng Wu wrote: > Implement irq_set_vcpu_affinity for intel_ir_chip. > > Signed-off-by: Feng Wu > Reviewed-by: Jiang Liu Acked-by: David.Woodhouse assuming a suitable answer to... > + vcpu_pi_info = (struct vcpu_data *)vcpu_info; > + m

Re: [v3 26/26] iommu/vt-d: Add a command line parameter for VT-d posted-interrupts

2015-01-28 Thread David Woodhouse
On Fri, 2014-12-12 at 23:15 +0800, Feng Wu wrote: > Enable VT-d Posted-Interrtups and add a command line > parameter for it. > > Signed-off-by: Feng Wu Acked-by: David Woodhouse -- David WoodhouseOpen Source Technology Centre david.woodho...@intel.com

Re: [v3 06/26] iommu, x86: No need to migrating irq for VT-d Posted-Interrupts

2015-01-28 Thread David Woodhouse
On Fri, 2014-12-12 at 23:14 +0800, Feng Wu wrote: > We don't need to migrate the irqs for VT-d Posted-Interrupts here. > When 'pst' is set in IRTE, the associated irq will be posted to > guests instead of interrupt remapping. The destination of the > interrupt is set in Posted-Interrupts Descriptor

Re: [v3 07/26] iommu, x86: Add cap_pi_support() to detect VT-d PI capability

2015-01-28 Thread David Woodhouse
On Fri, 2014-12-12 at 23:14 +0800, Feng Wu wrote: > Add helper function to detect VT-d Posted-Interrupts capability. > > Signed-off-by: Feng Wu > Reviewed-by: Jiang Liu Acked-by: David Woodhouse -- David WoodhouseOpen Source Technology Centre david.woodho...@intel

Re: [v3 08/26] iommu, x86: Add intel_irq_remapping_capability() for Intel

2015-01-28 Thread David Woodhouse
On Fri, 2014-12-12 at 23:14 +0800, Feng Wu wrote: > Add the Intel side implementation for capability in > struct irq_remap_ops. > > Signed-off-by: Feng Wu > Reviewed-by: Jiang Liu > +static bool intel_irq_remapping_capability(enum irq_remap_cap cap) > +{ > + struct dmar_drhd_unit *drhd; > +

Re: [v3 02/26] iommu: Add new member capability to struct irq_remap_ops

2015-01-28 Thread David Woodhouse
On Fri, 2014-12-12 at 23:14 +0800, Feng Wu wrote: > This patch adds a new member capability to struct irq_remap_ops, > this new function ops can be used to check whether some > features are supported, such as VT-d Posted-Interrupts. > + /* Check some capability is supported */ > + bool (*c

Re: [PATCH v4 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Wincy Van
Sorry, please ignore this mail, the subject is wrong : ( On Wed, Jan 28, 2015 at 11:50 PM, Wincy Van wrote: > Currently, if L1 enables MSR_BITMAP, we will emulate this feature, > all of L2's msr access is intercepted by L0. Since many features > like virtualize x2apic mode has a complicated logic

[PATCH v4 0/6] KVM: nVMX: Enable nested apicv support

2015-01-28 Thread Wincy Van
v1 ---> v2: Use spin lock to ensure vmcs12 is safe when doing nested posted interrupt delivery. v2 ---> v3: 1. Add a new field in nested_vmx to avoid the spin lock in v2. 2. Drop send eoi to L1 when doing nested interrupt delivery. 3. Use hardware MSR bitmap to enable nested virtualize x

[PATCH v4 5/6] KVM: nVMX: Enable nested virtual interrupt delivery

2015-01-28 Thread Wincy Van
With virtual interrupt delivery, the hardware prevent KVM from the low efficiency interrupt inject way. In nested vmx, it is a important feature, we can reduce much more nested-vmexit, especially in high throughput scenes. Signed-off-by: Wincy Van --- arch/x86/kvm/vmx.c | 68 ++

Re: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Wincy Van
On Wed, Jan 28, 2015 at 8:33 PM, Zhang, Yang Z wrote: >>> >>> You are right, but this is not fit for all the cases, we should >>> custom the nested_msr_bitmap. >>> e.g. Currently L0 wants to intercept some of the x2apic msrs' reading: >>> if (enable_apicv) { >>> for (msr

Re: [PATCH v3 2/6] KVM: nVMX: Enable nested virtualize x2apic mode.

2015-01-28 Thread Wincy Van
On Wed, Jan 28, 2015 at 3:31 PM, Paolo Bonzini wrote: >>> > >>> > No need for this function and nested_cpu_has_virt_x2apic_mode. Just >>> > inline them in their caller(s). Same for other cases throughout the >>> > series. >>> > >> Do you mean that we should also inline the same functions in the

Re: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Wincy Van
On Wed, Jan 28, 2015 at 4:00 PM, Zhang, Yang Z wrote: >> @@ -5812,13 +5813,18 @@ static __init int hardware_setup(void) >> (unsigned long >> *)__get_free_page(GFP_KERNEL); >> if (!vmx_msr_bitmap_longmode_x2apic) >> goto out4; >> + >> +

RE: [PATCH v4 2/6] KVM: nVMX: Enable nested virtualize x2apic mode

2015-01-28 Thread Zhang, Yang Z
Wincy Van wrote on 2015-01-28: > When L2 is using x2apic, we can use virtualize x2apic mode to gain higher > performance, especially in apicv case. > > This patch also introduces nested_vmx_check_apicv_controls for the nested > apicv patches. > > Signed-off-by: Wincy Van > --- > arch/x86/kvm/vm

[PATCH v4 3/6] KVM: nVMX: Make nested control MSRs per-cpu

2015-01-28 Thread Wincy Van
To enable nested apicv support, we need per-cpu vmx control MSRs: 1. If in-kernel irqchip is enabled, we can enable nested posted interrupt, we should set posted intr bit in the nested_vmx_pinbased_ctls_high. 2. If in-kernel irqchip is disabled, we can not enable nested posted in

RE: [PATCH v4 0/6] KVM: nVMX: Enable nested apicv support

2015-01-28 Thread Zhang, Yang Z
Wincy Van wrote on 2015-01-28: > v1 ---> v2: > Use spin lock to ensure vmcs12 is safe when doing nested > posted interrupt delivery. > v2 ---> v3: > 1. Add a new field in nested_vmx to avoid the spin lock in v2. > 2. Drop send eoi to L1 when doing nested interrupt delivery. > 3. Use hardw

randconfig bug: ARM/KVM link error in hyp_idmap section

2015-01-28 Thread Arnd Bergmann
Since 0394e1f60520 ("ARM: KVM: enforce maximum size for identity mapped code"), some randconfigs started failing because the hyp_idmap section grows too large. I've tracked this down to the problem of veneers getting erroneously added to this section, but I'm not sure about the fix. The patch below

Re: [Xen-devel] [PATCH v2] PCI: Add guard to avoid mapping a invalid msix base address

2015-01-28 Thread Bjorn Helgaas
On Wed, Jan 28, 2015 at 3:05 PM, Boris Ostrovsky wrote: > On 01/28/2015 01:13 PM, Bjorn Helgaas wrote: >> >> >> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c >> index fd60806..c3e7dfc 100644 >> --- a/drivers/pci/msi.c >> +++ b/drivers/pci/msi.c >> @@ -694,11 +694,16 @@ static void __iomem *ms

Re: [v3 03/26] iommu, x86: Define new irte structure for VT-d Posted-Interrupts

2015-01-28 Thread David Woodhouse
On Fri, 2014-12-12 at 23:14 +0800, Feng Wu wrote: > Add a new irte_pi structure for VT-d Posted-Interrupts. > > Signed-off-by: Feng Wu > Reviewed-by: Jiang Liu I think it makes most sense for this to go along with the other patches rather than through me, and I'm happy for it to do so. -- Dav

Re: [Xen-devel] [PATCH v2] PCI: Add guard to avoid mapping a invalid msix base address

2015-01-28 Thread Yijing Wang
>> >> Right, I think it does. >> >> One question: do we need to check flags for IORESOURCE_DISABLED as well? >> Currently IORESOURCE_DISABLED and IORESOURCE_UNSET are set together for PCI >> so it probably doesn't matter right now but if this changes we won't want to >> use BAR that's disabled, wil

Re: [Xen-devel] [PATCH v2] PCI: Add guard to avoid mapping a invalid msix base address

2015-01-28 Thread Boris Ostrovsky
On 01/28/2015 01:13 PM, Bjorn Helgaas wrote: diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index fd60806..c3e7dfc 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -694,11 +694,16 @@ static void __iomem *msix_map_region(struct pci_dev *dev, unsigned nr_entries) { resource

[PATCH v4 2/6] KVM: nVMX: Enable nested virtualize x2apic mode

2015-01-28 Thread Wincy Van
When L2 is using x2apic, we can use virtualize x2apic mode to gain higher performance, especially in apicv case. This patch also introduces nested_vmx_check_apicv_controls for the nested apicv patches. Signed-off-by: Wincy Van --- arch/x86/kvm/vmx.c | 114 ++

[PATCH v4 6/6] KVM: nVMX: Enable nested posted interrupt processing

2015-01-28 Thread Wincy Van
If vcpu has a interrupt in vmx non-root mode, we will kick that vcpu to inject interrupt timely. With posted interrupt processing, the kick intr is not needed, and interrupts are fully taken care of by hardware. In nested vmx, this feature avoids much more vmexits than non-nested vmx. This patch

RE: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Zhang, Yang Z
Wincy Van wrote on 2015-01-28: > On Wed, Jan 28, 2015 at 7:25 PM, Zhang, Yang Z > wrote: >> Wincy Van wrote on 2015-01-28: >>> On Wed, Jan 28, 2015 at 4:05 PM, Zhang, Yang Z >>> >>> wrote: > @@ -8344,7 +8394,68 @@ static int > nested_vmx_check_msr_bitmap_controls(struct kvm_vcpu *vcpu, st

Re: [PATCH v3 6/6] KVM: nVMX: Enable nested posted interrupt processing.

2015-01-28 Thread Paolo Bonzini
On 28/01/2015 06:54, Wincy Van wrote: > Why? L1 may config these features seperately, we should check them one by one. > e.g. L1 may enable posted interrupt processing and virtual interrupt > delivery, but leaving virtualize x2apic mode disabled, then > nested_cpu_has_virt_x2apic_mode will return

Re: [PATCH v4 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Wincy Van
On Wed, Jan 28, 2015 at 11:52 PM, Wincy Van wrote: > Sorry, please ignore this mail, the subject is wrong : ( > I was confused by gmail's conversation view, gmail put this patch in the v3's conversation. please ignore this. Thanks, Wincy > On Wed, Jan 28, 2015 at 11:50 PM, Wincy Van wrote: >>

RE: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Zhang, Yang Z
Wincy Van wrote on 2015-01-28: > On Wed, Jan 28, 2015 at 8:33 PM, Zhang, Yang Z > wrote: You are right, but this is not fit for all the cases, we should custom the nested_msr_bitmap. e.g. Currently L0 wants to intercept some of the x2apic msrs' reading: if (enab

RE: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Zhang, Yang Z
Wincy Van wrote on 2015-01-24: > When L2 is using x2apic, we can use virtualize x2apic mode to gain higher > performance, especially in apicv case. > > This patch also introduces nested_vmx_check_apicv_controls for the nested > apicv patches. > > Signed-off-by: Wincy Van > --- ...snip... > st

RE: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Zhang, Yang Z
Wincy Van wrote on 2015-01-24: > Currently, if L1 enables MSR_BITMAP, we will emulate this feature, all of L2's > msr access is intercepted by L0. Since many features like virtualize x2apic > mode > has a complicated logic and it is difficult for us to emulate, we should use > hardware and merge t

Re: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Wincy Van
On Wed, Jan 28, 2015 at 9:06 PM, Zhang, Yang Z wrote: __clear_bit(msr, msr_bitmap_nested + 0x000 / f); >>> >>> >>> Anyway, this is not necessary for your current patch. We can consider >>> it later if there really have other features will use it. >>> >> >> Yep, I know what you mean no

Re: [PATCH v3 2/6] KVM: nVMX: Enable nested virtualize x2apic mode.

2015-01-28 Thread Paolo Bonzini
On 28/01/2015 07:19, Wincy Van wrote: >> > >> > No need for this function and nested_cpu_has_virt_x2apic_mode. Just >> > inline them in their caller(s). Same for other cases throughout the >> > series. >> > > Do you mean that we should also inline the same functions in the other > patches of t

RE: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Zhang, Yang Z
Wincy Van wrote on 2015-01-28: > On Wed, Jan 28, 2015 at 4:00 PM, Zhang, Yang Z > wrote: >>> @@ -5812,13 +5813,18 @@ static __init int hardware_setup(void) >>> (unsigned long >>> *)__get_free_page(GFP_KERNEL); >>> if (!vmx_msr_bitmap_longmode_x2apic) >>>

RE: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Zhang, Yang Z
Wincy Van wrote on 2015-01-28: > On Wed, Jan 28, 2015 at 4:05 PM, Zhang, Yang Z > wrote: >>> @@ -8344,7 +8394,68 @@ static int >>> nested_vmx_check_msr_bitmap_controls(struct kvm_vcpu *vcpu, static >>> inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu, >>>

RE: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Zhang, Yang Z
Wincy Van wrote on 2015-01-28: > On Wed, Jan 28, 2015 at 7:52 PM, Zhang, Yang Z > wrote: >>> >>> If L0 wants to intercept a msr, we should set >>> vmx_msr_bitmap_legacy(_x2apic) and vmx_msr_bitmap_longmode(_x2apic), >>> and that bitmaps should only be loaded in non-nested entry. Currently >

Re: Status IGD pass-through with QEMU/KVM

2015-01-28 Thread Alex Williamson
On Wed, 2015-01-28 at 16:02 +0100, Jan Kiszka wrote: > Hi Alex, > > before getting dirty fingers in vain: what is the current status of > handing an IGD GPU to a KVM guest, specifically Windows? I found some > related QEMU patches from last year on the list, but it seems they > didn't progress. Ar

Re: [PATCH v3 2/6] KVM: nVMX: Enable nested virtualize x2apic mode.

2015-01-28 Thread Paolo Bonzini
On 28/01/2015 11:19, Wincy Van wrote: > > Most of the functions are just used once. If you want to keep them, > > please place them all close to the existing ones. > > Yep, I will inline the functions like nested_vmx_check_virt_x2apic and keep > the nested_cpu_has series. Okay, thanks! Paolo -

RE: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Zhang, Yang Z
Zhang, Yang Z wrote on 2015-01-28: > Wincy Van wrote on 2015-01-28: >> On Wed, Jan 28, 2015 at 7:52 PM, Zhang, Yang Z >> >> wrote: > If L0 wants to intercept a msr, we should set vmx_msr_bitmap_legacy(_x2apic) and vmx_msr_bitmap_longmode(_x2apic), and that bitmaps should

Re: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Wincy Van
On Wed, Jan 28, 2015 at 7:52 PM, Zhang, Yang Z wrote: >>> >> >> If L0 wants to intercept a msr, we should set >> vmx_msr_bitmap_legacy(_x2apic) and vmx_msr_bitmap_longmode(_x2apic), >> and that bitmaps should only be loaded in non-nested entry. >> Currently we only clear the corresponding bits if

Re: [PATCH v2] PCI: Add guard to avoid mapping a invalid msix base address

2015-01-28 Thread Bjorn Helgaas
[+cc Konrad, Boris, David, xen-devel, Alex, kvm] On Wed, Jan 28, 2015 at 09:52:17AM +0800, Yijing Wang wrote: > Sometimes, a pci bridge device BAR was not assigned > properly. After we call pci_bus_assign_resources(), the > resource of the BAR would be reseted. So if we try to > enable msix for th

Status IGD pass-through with QEMU/KVM

2015-01-28 Thread Jan Kiszka
Hi Alex, before getting dirty fingers in vain: what is the current status of handing an IGD GPU to a KVM guest, specifically Windows? I found some related QEMU patches from last year on the list, but it seems they didn't progress. Are there open issues without known solutions or is it "just" about

Re: Status IGD pass-through with QEMU/KVM

2015-01-28 Thread Jan Kiszka
On 2015-01-28 16:36, Alex Williamson wrote: > On Wed, 2015-01-28 at 16:02 +0100, Jan Kiszka wrote: >> Hi Alex, >> >> before getting dirty fingers in vain: what is the current status of >> handing an IGD GPU to a KVM guest, specifically Windows? I found some >> related QEMU patches from last year on

RE: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Zhang, Yang Z
Zhang, Yang Z wrote on 2015-01-28: > Wincy Van wrote on 2015-01-24: >> When L2 is using x2apic, we can use virtualize x2apic mode to gain >> higher performance, especially in apicv case. >> >> This patch also introduces nested_vmx_check_apicv_controls for the >> nested apicv patches. Sorry, repli

Re: [PATCH v3 1/6] KVM: nVMX: Use hardware MSR bitmap

2015-01-28 Thread Wincy Van
On Wed, Jan 28, 2015 at 7:25 PM, Zhang, Yang Z wrote: > Wincy Van wrote on 2015-01-28: >> On Wed, Jan 28, 2015 at 4:05 PM, Zhang, Yang Z >> wrote: @@ -8344,7 +8394,68 @@ static int nested_vmx_check_msr_bitmap_controls(struct kvm_vcpu *vcpu, static inline bool nested_vmx_merge_msr_