Re: [v5 15/19] KVM: eventfd: add irq bypass consumer management

2015-07-13 Thread Paolo Bonzini
13/07/2015 15:16, Eric Auger wrote: + irqfd-consumer.token = (void *)irqfd-eventfd; + kvm_arch_irq_consumer_init(irqfd-consumer); what if the architecture does not implement kvm_arch_irq_consumer_init? Also you are using here this single function kvm_arch_irq_consumer_init to do

Re: [PATCH v3 01/10] KVM: MMU: fix decoding cache type from MTRR

2015-07-13 Thread Paolo Bonzini
On 13/07/2015 16:45, Xiao Guangrong wrote: +/* MTRR is completely disabled, use UC for all of physical memory. */ +if (!(mtrr_state-enabled 0x2)) +return MTRR_TYPE_UNCACHABLE; actually disappears in commit fa61213746a7 (KVM: MTRR: simplify kvm_mtrr_get_guest_memory_type,

Re: [PATCH v3 01/10] KVM: MMU: fix decoding cache type from MTRR

2015-07-13 Thread Paolo Bonzini
On 12/07/2015 20:59, Xiao Guangrong wrote: On 07/13/2015 01:33 AM, Alex Williamson wrote: On Wed, 2015-05-13 at 14:42 +0800, Xiao Guangrong wrote: There are some bugs in current get_mtrr_type(); 1: bit 1 of mtrr_state-enabled is corresponding bit 11 of IA32_MTRR_DEF_TYPE MSR which

[PATCH] KVM: svm: remove KVM_QUIRK_CD_NW_CLEARED quirk

2015-07-10 Thread Paolo Bonzini
, where CD/NW are not touched by vmentry/vmexit. Note that buggy firmware that does not clear CD/NW is _seriously_ old: SeaBIOS for example has been doing it since October 2008. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/svm.c | 14 +++--- 1 file changed, 7 insertions

Re: [PATCH] kvm/x86: add support for MONITOR_TRAP_FLAG

2015-07-10 Thread Paolo Bonzini
On 09/07/2015 21:49, Jan Kiszka wrote: CPU_BASED_MOV_DR_EXITING | CPU_BASED_UNCOND_IO_EXITING | - CPU_BASED_USE_IO_BITMAPS | CPU_BASED_MONITOR_EXITING | + CPU_BASED_USE_IO_BITMAPS | CPU_BASED_MONITOR_TRAP_FLAG | CPU_BASED_MONITOR_EXITING | Overlong line.

Re: [PATCH 07/13] arm64: KVM: VHE: Patch out use of HVC

2015-07-10 Thread Paolo Bonzini
On 08/07/2015 19:54, Marc Zyngier wrote: Alternatively, I could move it to arch/arm64/include/asm (renamed to kvm_vhe_macros.h?), which would solve this issue. I just gave it a go, and that seems sensible enough. Yes, that would do. Alternatively: * create kvm_hyp_macros.h and put more

Re: [RFC v1 5/5] Call irqbypass update routine when updating irqfd

2015-07-10 Thread Paolo Bonzini
On 10/07/2015 10:28, Wu, Feng wrote: Yes, you are right. All we need is the producer information which has been passed in the register routine. And we can easily make this update logic inside the consumer. Thanks for your comments! BTW, Paolo Alex, in VFIO framework, how can we know a

Re: [PATCH] KVM: x86: Add host physical address width capability

2015-07-10 Thread Paolo Bonzini
On 09/07/2015 20:57, Laszlo Ersek wrote: Without EPT, you don't hit the processor limitation with your setup, but the user should nevertheless still be notified. I disagree. FWIW, I also disagree (and it looks like Bandan disagrees with himself now :)). In fact, I think shadow paging

Re: [PATCH 2/4] KVM: SVM: use NPT page attributes

2015-07-10 Thread Paolo Bonzini
On 10/07/2015 03:19, Xiao Guangrong wrote: yes, this is correct. QEMU still does not have support for disabling quirks, so gCR0.CD is currently hidden on SVM. I would like to include this series in 4.2, while for 4.3 I will disable the quirk above altogether (it is superseded by the way

Re: [PATCH] KVM: x86: Add host physical address width capability

2015-07-10 Thread Paolo Bonzini
On 10/07/2015 16:57, Laszlo Ersek wrote: ... In any case, please understand that I'm not campaigning for this warning :) IIRC the warning was your (very welcome!) idea after I reported the problem; I'm just trying to ensure that the warning match the exact issue I encountered.

Re: [PATCH] virt: IRQ bypass manager

2015-07-10 Thread Paolo Bonzini
On 10/07/2015 19:52, Alex Williamson wrote: Perhaps if a second consumer comes along that would be justification for tying it elsewhere in the build system. ARM will obviously need to do similar. Are there better options? Also, there's no maintainer for the top level virt/ directory.

Re: [RFC v2 0/6] IRQ bypass manager and irqfd consumer

2015-07-09 Thread Paolo Bonzini
On 09/07/2015 16:13, Alex Williamson wrote: On Thu, 2015-07-09 at 14:28 +0200, Joerg Roedel wrote: On Tue, Jul 07, 2015 at 11:17:48AM -0600, Alex Williamson wrote: Hosting the bypass manager in kernel/irq seemed appropriate, but really it could be anywhere. Does anyone have a different

Re: [PATCH 2/4] KVM: SVM: use NPT page attributes

2015-07-09 Thread Paolo Bonzini
On 09/07/2015 04:30, Xiao Guangrong wrote: diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 602b974a60a6..0f125c1860ec 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1085,6 +1085,47 @@ static u64 svm_compute_tsc_offset(struct kvm_vcpu *vcpu, u64 target_tsc)

Re: [PATCH 0/2] mips/kvm: Fixes for big endian MIPS64 hosts

2015-07-09 Thread Paolo Bonzini
On 09/07/2015 10:13, Leon Alrae wrote: On 08/07/2015 16:22, Paolo Bonzini wrote: On 08/07/2015 17:03, James Hogan wrote: Hi Paolo, On 24/04/15 11:26, James Hogan wrote: A couple of small fixes for accessing 32-bit KVM registers on big endian, and to sign extend struct kvm_regs registers

Re: [Qemu-devel] [PATCH 0/2] mips/kvm: Fixes for big endian MIPS64 hosts

2015-07-09 Thread Paolo Bonzini
On 09/07/2015 16:00, Peter Maydell wrote: I've actually just applied them to master as buildfixes :-) No, wait, I'm confusing this set with a different 2-patch set of MIPS fixes. Paolo, can you go ahead and take them through the kvm tree? Sure, I had already queued them in fact. Paolo

Re: [PATCH] KVM: x86: Add host physical address width capability

2015-07-09 Thread Paolo Bonzini
On 09/07/2015 00:36, Bandan Das wrote: Let userspace inquire the maximum physical address width of the host processors; this can be used to identify maximum memory that can be assigned to the guest. Reported-by: Laszlo Ersek ler...@redhat.com Signed-off-by: Bandan Das b...@redhat.com ---

Re: [PATCH] target-i386: Sanity check host processor physical address width

2015-07-09 Thread Paolo Bonzini
On 09/07/2015 00:42, Bandan Das wrote: If a Linux guest is assigned more memory than is supported by the host processor, the guest is unable to boot. That is expected, however, there's no message indicating the user what went wrong. This change prints a message to stderr if KVM has the

Re: [PATCH] kvm: x86: fix load xsave feature warning

2015-07-09 Thread Paolo Bonzini
On 09/07/2015 09:44, Wanpeng Li wrote: [ 68.196974] WARNING: CPU: 1 PID: 2140 at arch/x86/kvm/x86.c:3161 kvm_arch_vcpu_ioctl+0xe88/0x1340 [kvm]() [ 68.196975] Modules linked in: snd_hda_codec_hdmi i915 rfcomm bnep bluetooth i2c_algo_bit rfkill nfsd drm_kms_helper nfs_acl nfs drm lockd

Re: [PATCH] KVM: x86: Add host physical address width capability

2015-07-09 Thread Paolo Bonzini
On 09/07/2015 08:43, Laszlo Ersek wrote: On 07/09/15 08:09, Paolo Bonzini wrote: On 09/07/2015 00:36, Bandan Das wrote: Let userspace inquire the maximum physical address width of the host processors; this can be used to identify maximum memory that can be assigned to the guest

Re: [PATCH] KVM: Add Kconfig option to signal cross-endian guests

2015-07-09 Thread Paolo Bonzini
On 09/07/2015 11:48, Laurent Vivier wrote: On 09/07/2015 09:49, Thomas Huth wrote: The option for supporting cross-endianness legacy guests in the vhost and tun code should only be available on systems that support cross-endian guests. I'm sure I misunderstand something, but what

Re: [PATCH] KVM: Add Kconfig option to signal cross-endian guests

2015-07-09 Thread Paolo Bonzini
On 09/07/2015 11:48, Laurent Vivier wrote: On 09/07/2015 09:49, Thomas Huth wrote: The option for supporting cross-endianness legacy guests in the vhost and tun code should only be available on systems that support cross-endian guests. I'm sure I misunderstand something, but what

Re: [PATCH] target-i386: Sanity check host processor physical address width

2015-07-09 Thread Paolo Bonzini
On 09/07/2015 10:26, Laszlo Ersek wrote: Perhaps KVM could simply hide memory above the limit (i.e. treat it as MMIO), and the BIOS could remove RAM above the limit from the e820 memory map? I'd prefer to leave the guest firmware*s* out of this... :) E820 is a legacy BIOS concept.

Re: [PATCH 2/4] KVM: SVM: use NPT page attributes

2015-07-08 Thread Paolo Bonzini
On 08/07/2015 07:59, Xiao Guangrong wrote: On 07/07/2015 09:45 PM, Paolo Bonzini wrote: Right now, NPT page attributes are not used, and the final page attribute depends solely on gPAT (which however is not synced correctly), the guest MTRRs and the guest page attributes. However, we

[PATCH 3/4] KVM: SVM: Sync g_pat with guest-written PAT value

2015-07-08 Thread Paolo Bonzini
From: Jan Kiszka jan.kis...@siemens.com When hardware supports the g_pat VMCB field, we can use it for emulating the PAT configuration that the guest configures by writing to the corresponding MSR. Signed-off-by: Jan Kiszka jan.kis...@siemens.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com

[PATCH 4/4] KVM: x86: apply guest MTRR virtualization on host reserved pages

2015-07-08 Thread Paolo Bonzini
. Suggested-by: Xiao Guangrong guangrong.x...@linux.intel.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/svm.c | 7 ++- arch/x86/kvm/vmx.c | 11 +++ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index d36cfaf5a97a

Re: [PATCH 0/2] mips/kvm: Fixes for big endian MIPS64 hosts

2015-07-08 Thread Paolo Bonzini
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 08/07/2015 17:03, James Hogan wrote: Hi Paolo, On 24/04/15 11:26, James Hogan wrote: A couple of small fixes for accessing 32-bit KVM registers on big endian, and to sign extend struct kvm_regs registers so as to work on MIPS64 hosts.

[PATCH 2/4] KVM: SVM: use NPT page attributes

2015-07-08 Thread Paolo Bonzini
the type. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/svm.c | 101 ++--- 1 file changed, 96 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 602b974a60a6..414ec25b673e 100644 --- a/arch/x86/kvm

[PATCH 1/4] KVM: count number of assigned devices

2015-07-08 Thread Paolo Bonzini
that they provide this information to KVM. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/iommu.c| 2 ++ arch/x86/kvm/x86.c | 18 ++ include/linux/kvm_host.h| 18 ++ virt

[RFC/RFT PATCH v3 0/4] KVM: x86: full virtualization of guest MTRR

2015-07-08 Thread Paolo Bonzini
Paolo Bonzini (3): KVM: count number of assigned devices KVM: SVM: use NPT page attributes KVM: x86: apply guest MTRR virtualization on host reserved pages arch/x86/include/asm/kvm_host.h | 2 + arch/x86/kvm/iommu.c| 2 + arch/x86/kvm/svm.c | 108

Re: [PATCH 07/13] arm64: KVM: VHE: Patch out use of HVC

2015-07-08 Thread Paolo Bonzini
On 08/07/2015 18:19, Marc Zyngier wrote: +/* Hack to allow stringification of macros... */ +#define __S__(a,args...) __stringify(a, ##args) +#define _S_(a,args...) __S__(a, args) + +.macro ifnvhe nonvhe vhe + alternative_insn\nonvhe, \vhe,

Re: [PATCH 1/4] KVM: count number of assigned devices

2015-07-07 Thread Paolo Bonzini
On 07/07/2015 17:22, Alex Williamson wrote: -#define __KVM_HAVE_ARCH_NONCOHERENT_DMA +#define __KVM_HAVE_ARCH_VFIO_HOOKS Do we really want to tie these two things together under something that's not strictly a vfio option? Legacy assignment also makes use of these, as shown in this

Re: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-07 Thread Paolo Bonzini
On 07/07/2015 09:10, Eric Auger wrote: On 07/06/2015 07:41 PM, Paolo Bonzini wrote: On 06/07/2015 19:09, Eric Auger wrote: The good thing is that this helps a bit forming a lock hierarchy across the subsystems, for example irq bypass mutex outside vfio_platform_irq spinlock, because you

Re: [PATCH v6 0/12] HyperV equivalent of pvpanic driver

2015-07-07 Thread Paolo Bonzini
msrs store in cpu state and it's migration Signed-off-by: Andrey Smetanin asmeta...@virtuozzo.com Signed-off-by: Denis V. Lunev d...@openvz.org CC: Gleb Natapov g...@kernel.org CC: Paolo Bonzini pbonz...@redhat.com I'm queuing patches 1-8 to the KVM tree. For patch 9-12, I've applied them

Re: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-07 Thread Paolo Bonzini
On 07/07/2015 13:13, Wu, Feng wrote: You can use container_of to add it to your own struct, e.g. struct irq_bypass_consumer cons; struct irq_bypass_producer *prod; Do you mean this: struct kvm_kernel_irqfd { .. struct irq_bypass_consumer cons;

Re: [PATCH 12/12] i386/kvm: Hyper-v crash msrs set/get'ers and migration

2015-07-07 Thread Paolo Bonzini
On 03/07/2015 14:01, Denis V. Lunev wrote: @@ -904,6 +905,7 @@ typedef struct CPUX86State { uint64_t msr_hv_guest_os_id; uint64_t msr_hv_vapic; uint64_t msr_hv_tsc; +uint64_t msr_hv_crash_prm[HV_X64_MSR_CRASH_PARAMS]; Do not abbreviate variable names! The enum even says

Re: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-07 Thread Paolo Bonzini
On 07/07/2015 12:58, Wu, Feng wrote: -Original Message- From: Eric Auger [mailto:eric.au...@linaro.org] Sent: Monday, July 06, 2015 8:11 PM To: eric.au...@st.com; eric.au...@linaro.org; linux-arm-ker...@lists.infradead.org; kvm...@lists.cs.columbia.edu; kvm@vger.kernel.org;

Re: [kvm-unit-tests PATCH 1/2] arm/arm64: spinlock-test fixup

2015-07-07 Thread Paolo Bonzini
On 07/07/2015 13:24, Andrew Jones wrote: The reason I switched was that the non-atomic test didn't work for me. I have now debugged it, and it needs this: @@ -29,12 +29,12 @@ static void gcc_builtin_unlock(int *lock_var) } static void none_lock(int *lock_var) { - while

Re: [PATCH] KVM: nVMX: VMX instructions: add checks for #GP/#SS exceptions

2015-07-07 Thread Paolo Bonzini
On 17/04/2015 04:22, Eugene Korenevsky wrote: According to Intel SDM several checks must be applied for memory operands of VMX instructions. Long mode: #GP(0) or #SS(0) depending on the segment must be thrown if the memory address is in a non-canonical form. Protected mode, checks in

Re: [PATCH 12/12] i386/kvm: Hyper-v crash msrs set/get'ers and migration

2015-07-07 Thread Paolo Bonzini
On 03/07/2015 14:01, Denis V. Lunev wrote: diff --git a/linux-headers/asm-x86/hyperv.h b/linux-headers/asm-x86/hyperv.h index ce6068d..5f88dc7 100644 --- a/linux-headers/asm-x86/hyperv.h +++ b/linux-headers/asm-x86/hyperv.h @@ -108,6 +108,8 @@ #define HV_X64_HYPERCALL_PARAMS_XMM_AVAILABLE

Re: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-07 Thread Paolo Bonzini
On 07/07/2015 13:18, Wu, Feng wrote: Then I still need assign prod and de-assign prod in irq_bypass_register_consumer/irq_bypass_unregister_consumer, Right? Would you please share why this is better. The need to store the consumer-producer link seems to be unique to posted interrupts. It is

Re: [RFC/RFT PATCH v2 0/4] KVM: x86: full virtualization of guest MTRR

2015-07-07 Thread Paolo Bonzini
On 07/07/2015 16:06, Joerg Roedel wrote: I do not have any AMD machines that support an IOMMU, so I would like some help testing these patches. Thanks, What kind of testing do you want? Booting a guest with a device attached is probably not sufficient, right? The guest should not take

Re: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-07 Thread Paolo Bonzini
On 07/07/2015 13:33, Wu, Feng wrote: The need to store the consumer-producer link seems to be unique to posted interrupts. It is difficult to say without seeing the PI code, but I prefer to keep the bypass manager as small as possible. Fine. I will follow your suggestion! If

[RFC/RFT PATCH v2 0/4] KVM: x86: full virtualization of guest MTRR

2015-07-07 Thread Paolo Bonzini
would like some help testing these patches. Thanks, Paolo v1-v2: AMD IOMMUs do have snooping control [Joerg] New patch 1 Jan Kiszka (1): KVM: SVM: Sync g_pat with guest-written PAT value Paolo Bonzini (3): KVM: count number of assigned devices KVM: SVM: use NPT page attributes

[PATCH 2/4] KVM: SVM: use NPT page attributes

2015-07-07 Thread Paolo Bonzini
only includes the other types. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/svm.c | 47 ++- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 602b974a60a6..0f125c1860ec

[PATCH 1/4] KVM: count number of assigned devices

2015-07-07 Thread Paolo Bonzini
that they provide this information to KVM. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/include/asm/kvm_host.h | 3 ++- arch/x86/kvm/iommu.c| 2 ++ arch/x86/kvm/x86.c | 18 ++ include/linux/kvm_host.h| 18 +- virt

[PATCH 2/3] KVM: SVM: Sync g_pat with guest-written PAT value

2015-07-07 Thread Paolo Bonzini
From: Jan Kiszka jan.kis...@siemens.com When hardware supports the g_pat VMCB field, we can use it for emulating the PAT configuration that the guest configures by writing to the corresponding MSR. Signed-off-by: Jan Kiszka jan.kis...@siemens.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com

[RFC/RFT PATCH 0/3] KVM: x86: full virtualization of guest MTRR

2015-07-07 Thread Paolo Bonzini
would like some help testing these patches. Thanks, Paolo Jan Kiszka (1): KVM: SVM: Sync g_pat with guest-written PAT value Paolo Bonzini (2): KVM: SVM: use NPT page attributes KVM: x86: apply guest MTRR virtualization on host reserved pages arch/x86/kvm/svm.c | 54

Re: [PATCH] KVM: VMX: fix vmwrite to invalid VMCS

2015-07-07 Thread Paolo Bonzini
On 07/07/2015 15:50, Radim Krčmář wrote: Andrey reported offlist that the bug went away by reverting 1cde293. So the patch would at least need a new commit message. :) I think it's a different bug than the one Andrey reproduced (https://bugzilla.kernel.org/show_bug.cgi?id=100671). I'll

[PATCH 1/3] KVM: SVM: use NPT page attributes

2015-07-07 Thread Paolo Bonzini
only includes the other types. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/svm.c | 47 ++- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 602b974a60a6..1eeb412e057b

[PATCH 3/3] KVM: x86: apply guest MTRR virtualization on host reserved pages

2015-07-07 Thread Paolo Bonzini
. Suggested-by: Xiao Guangrong guangrong.x...@linux.intel.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/svm.c | 7 ++- arch/x86/kvm/vmx.c | 11 +++ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 089153666c54

[PATCH] KVM: x86: reintroduce kvm_is_mmio_pfn

2015-07-07 Thread Paolo Bonzini
The call to get_mt_mask was really using kvm_is_reserved_pfn to detect an MMIO-backed page. In this case, we want false to be returned for the zero page. Reintroduce a separate kvm_is_mmio_pfn predicate for this use only. Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/mmu.c

[PATCH 3/4] KVM: SVM: Sync g_pat with guest-written PAT value

2015-07-07 Thread Paolo Bonzini
From: Jan Kiszka jan.kis...@siemens.com When hardware supports the g_pat VMCB field, we can use it for emulating the PAT configuration that the guest configures by writing to the corresponding MSR. Signed-off-by: Jan Kiszka jan.kis...@siemens.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com

[PATCH 4/4] KVM: x86: apply guest MTRR virtualization on host reserved pages

2015-07-07 Thread Paolo Bonzini
. Suggested-by: Xiao Guangrong guangrong.x...@linux.intel.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- arch/x86/kvm/svm.c | 7 ++- arch/x86/kvm/vmx.c | 11 +++ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 728ac43fae16

Re: [BUG/RFC] Two cpus are not brought up normally in SLES11 sp3 VM after reboot

2015-07-06 Thread Paolo Bonzini
On 06/07/2015 11:59, zhanghailiang wrote: Besides, the follow is the cpus message got from host. 80FF72F5-FF6D-E411-A8C8-00821800:/home/fsp/hrg # virsh qemu-monitor-command instance-000 * CPU #0: pc=0x7f64160c683d thread_id=68570 CPU #1: pc=0x810301f1 (halted)

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-06 Thread Paolo Bonzini
On 06/07/2015 12:37, Christoffer Dall wrote: I don't view it as 'the kernel requires this' but as 'the kernel will not complain with arbitrary error code if you set the devid flag' capability, and it's up to userspace (as usual) to provide the correct arguments for things to work, and up to

Re: [BUG/RFC] Two cpus are not brought up normally in SLES11 sp3 VM after reboot

2015-07-06 Thread Paolo Bonzini
On 06/07/2015 09:54, zhanghailiang wrote: From host, we found that QEMU vcpu1 thread and vcpu7 thread were not consuming any cpu (Should be in idle state), All of VCPUs' stacks in host is like bellow: [a07089b5] kvm_vcpu_block+0x65/0xa0 [kvm] [a071c7c1]

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-06 Thread Paolo Bonzini
On 06/07/2015 13:23, Andre Przywara wrote: Hi Paolo, thanks for looking at this! On 06/07/15 12:07, Paolo Bonzini wrote: On 06/07/2015 12:37, Christoffer Dall wrote: I don't view it as 'the kernel requires this' but as 'the kernel will not complain with arbitrary error code if you

Re: [RFC v2 1/6] KVM: arm/arm64: select IRQ_BYPASS_MANAGER

2015-07-06 Thread Paolo Bonzini
On 06/07/2015 14:11, Eric Auger wrote: Select IRQ_BYPASS_MANAGER when CONFIG_KVM is set Signed-off-by: Eric Auger eric.au...@linaro.org --- v1 - v2: - also set IRQ_BYPASS_MANAGER for arm64 --- arch/arm/kvm/Kconfig | 1 + arch/arm64/kvm/Kconfig | 1 + 2 files changed, 2

Re: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-06 Thread Paolo Bonzini
On 06/07/2015 14:11, Eric Auger wrote: diff --git a/kernel/irq/bypass.c b/kernel/irq/bypass.c index 5d0f92b..efadbe5 100644 --- a/kernel/irq/bypass.c +++ b/kernel/irq/bypass.c @@ -19,6 +19,42 @@ static LIST_HEAD(producers); static LIST_HEAD(consumers); static DEFINE_MUTEX(lock); +/*

Re: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-06 Thread Paolo Bonzini
On 06/07/2015 19:09, Eric Auger wrote: The good thing is that this helps a bit forming a lock hierarchy across the subsystems, for example irq bypass mutex outside vfio_platform_irq spinlock, because you cannot have a spinlock inside the mutex. I think that all of your six callbacks are

Re: [kvm-unit-tests PATCH 1/2] arm/arm64: spinlock-test fixup

2015-07-06 Thread Paolo Bonzini
On 06/07/2015 15:31, Andrew Jones wrote: + if (argc strcmp(argv[0], non-atomic) != 0) { You want == here, don't you? The reason I switched was that the non-atomic test didn't work for me. I have now debugged it, and it needs this: @@ -29,12 +29,12 @@ static void gcc_builtin_unlock(int

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-06 Thread Paolo Bonzini
On 06/07/2015 17:37, Andre Przywara wrote: Wouldn't: if (kvm_vm_check_extension(s, KVM_CAP_MSI_DEVID)) { kroute.flags = KVM_MSI_VALID_DEVID; kroute.u.msi.devid = (pci_bus_num(dev-bus) 8) | dev-devfn; } be saner (without a global variable)? That would make the

Re: [RFC v2 3/6] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-06 Thread Paolo Bonzini
On 06/07/2015 17:35, Eric Auger wrote: diff --git a/kernel/irq/bypass.c b/kernel/irq/bypass.c index 5d0f92b..efadbe5 100644 --- a/kernel/irq/bypass.c +++ b/kernel/irq/bypass.c @@ -19,6 +19,42 @@ static LIST_HEAD(producers); static LIST_HEAD(consumers); static DEFINE_MUTEX(lock);

[GIT PULL] Second batch of KVM changes for 4.2 (+ preempt notifier fix)

2015-07-05 Thread Paolo Bonzini
Linus, The following changes since commit 9bdc771f2c29a11920f477fba05a58e23ee42554: Merge tag 'acpica-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm (2015-07-02 17:11:28 -0700) are available in the git repository at:

Re: [PATCH] KVM: VMX: fix vmwrite to invalid VMCS

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 15:49, Radim Krčmář wrote: fpu_activate is called outside of vcpu_load(), which means it should not touch VMCS, but fpu_activate needs to. Avoid the call by moving it to a point where we know that the guest needs eager FPU and VMCS is loaded. This will get rid of the

Re: [PATCH] arm/run: don't enable KVM if system can't do it

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 14:24, Alex Bennée wrote: Andrew Jones drjo...@redhat.com writes: On Thu, Jul 02, 2015 at 03:45:17PM +0200, Paolo Bonzini wrote: On 02/07/2015 13:51, Andrew Jones wrote: 4) I recently mentioned[*] it might be nice to add a '-force-tcg' type of arm/run command line

Re: [PATCH 3/3] arm/arm64: speed up spinlocks and atomic ops

2015-07-03 Thread Paolo Bonzini
On 25/06/2015 20:45, Andrew Jones wrote: spinlock torture tests made it clear that checking mmu_enabled() every time we call spin_lock is a bad idea. As most tests will want the MMU enabled the entire time, then we can inline a light weight nobody disabled the mmu check, and bail out early.

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 15:12, Eric Auger wrote: Linux IRQ and active should be okay. As to the vfio_device handle, you should link it from the vfio_platform_device instead. And for the vfio_platform_device, you can link it from the vfio_platform_irq instead. For this last one, I don't think this

Re: [PATCH 2/3] arm/arm64: drop mmu_set_enabled

2015-07-03 Thread Paolo Bonzini
On 25/06/2015 20:45, Andrew Jones wrote: The mmu is enabled automatically for all cpus, they must disable it themselves if they don't want it on. Switch from managing a cpumask of enabled cpus to one of disabled cpus. This allows us to remove the mmu_set_enabled call from secondary_cinit,

Re: [PATCH 1/3] arm/arm64: spinlocks: fix memory barriers

2015-07-03 Thread Paolo Bonzini
On 25/06/2015 18:12, Andrew Jones wrote: It shouldn't be necessary to use a barrier on the way into spin_lock. We'll be focused on a single address until we get it (exclusively) set, and then we'll do a barrier on the way out. Also, it does make sense to do a barrier on the way in to

Re: [PATCH 1/3] arm/arm64: Introduce mmu_disable

2015-07-03 Thread Paolo Bonzini
On 25/06/2015 20:45, Andrew Jones wrote: Allow unit test cpus to disable the MMU. Why not? We want the test framework to be as flexible as possible. Callers will have to deal with the cache coherency fallout... Cache flush support is still forthcoming to the framework though.

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 09:00, Wu, Feng wrote: struct irq_bypass_consumer { struct list_head node; void *token; + unsigned irq;/*got from producer when registered*/ void (*add_producer)(struct irq_bypass_producer *, struct

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 08:54, Eric Auger wrote: Oh... we can get gsi from irq_bypass_consumer - _irqfd - gsi, so it is not needed in irq_bypass_consumer. Got it! :) The issue I have is that struct _irqfd is local to eventfd.c so it cannot be used in archi specific code. Is it acceptable to move it

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Paolo Bonzini
On 02/07/2015 15:17, Eric Auger wrote: + void (*stop_producer)(struct irq_bypass_producer *); + void (*resume_producer)(struct irq_bypass_producer *); Also, can you call these just stop/resume ... + void (*add_consumer)(struct irq_bypass_producer *, +

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 04:43, Wu, Feng wrote: struct irq_bypass_consumer { struct list_head node; void *token; + unsigned irq; /*got from producer when registered*/ void (*add_producer)(struct irq_bypass_producer *, struct irq_bypass_consumer

Re: [[PATCH 2/2] kvm: enable preemption to register/unregister preempt notifier

2015-07-03 Thread Paolo Bonzini
g...@kernel.org CC: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Tiejun Chen tiejun.c...@intel.com --- virt/kvm/kvm_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 848af90..bde5f66f 100644 --- a/virt/kvm

Re: [Qemu-devel] [PATCH 00/16] implement vNVDIMM

2015-07-02 Thread Paolo Bonzini
On 02/07/2015 11:20, Stefan Hajnoczi wrote: Currently, the NVDIMM driver has been merged into upstream Linux Kernel and this patchset tries to enable it in virtualization field From a device model perspective, have you checked whether it makes sense to integrate nvdimms into the pc-dimm

Re: [RFC 16/17] KVM: eventfd: add irq bypass consumer management

2015-07-02 Thread Paolo Bonzini
On 02/07/2015 15:17, Eric Auger wrote: This patch adds the registration/unregistration of an irq_bypass_consumer on irqfd assignment/deassignment. Signed-off-by: Eric Auger eric.au...@linaro.org --- virt/kvm/eventfd.c | 22 +++--- 1 file changed, 19 insertions(+), 3

Re: [PATCH 9/9] qemu/kvm: kvm hyper-v based guest crash event handling

2015-07-02 Thread Paolo Bonzini
On 02/07/2015 15:19, Andrey Smetanin wrote: +if (has_msr_hv_crash) { +env-msr_hv_crash_ctl = HV_X64_MSR_CRASH_CTL_NOTIFY; The value is always host-defined, so I think it doesn't need a field in CPUX86State. On the other hand, this: Kernel just works with that

Re: [PATCH] arm/run: don't enable KVM if system can't do it

2015-07-02 Thread Paolo Bonzini
On 02/07/2015 13:51, Andrew Jones wrote: 4) I recently mentioned[*] it might be nice to add a '-force-tcg' type of arm/run command line option, allowing tcg to be used even if it's possible to use kvm. Adding that at the same time would be nice. Can you just use --no-kvm? It is

Re: [RFC 13/17] KVM: introduce kvm_arch functions for IRQ bypass

2015-07-02 Thread Paolo Bonzini
On 02/07/2015 15:17, Eric Auger wrote: +#ifdef CONFIG_IRQ_BYPASS_MANAGER Please use a separate symbol CONFIG_KVM_HAVE_IRQ_BYPASS. +void kvm_arch_add_producer(struct irq_bypass_consumer *, +struct irq_bypass_producer *); add_irq_bypass_producer, and so on below.

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-02 Thread Paolo Bonzini
On 02/07/2015 15:17, Eric Auger wrote: - new fields are added on producer side: linux irq, vfio_device handle, active which reflects whether the source is active (at interrupt controller level or at VFIO level - automasked -) and finally an opaque pointer which will be used to point to

Re: [Qemu-devel] [PATCH 00/16] implement vNVDIMM

2015-07-02 Thread Paolo Bonzini
On 02/07/2015 20:01, Xiao Guangrong wrote: Thanks for your review, Stefan and Paolo! On 07/02/2015 05:52 PM, Paolo Bonzini wrote: On 02/07/2015 11:20, Stefan Hajnoczi wrote: Currently, the NVDIMM driver has been merged into upstream Linux Kernel and this patchset tries to enable

Re: [PATCH 07/12] kvm/x86: added hyper-v crash data and ctl msr's get/set'ers

2015-07-02 Thread Paolo Bonzini
On 02/07/2015 18:07, Denis V. Lunev wrote: From: Andrey Smetanin asmeta...@virtuozzo.com Added hyper-v crash msr's(HV_X64_MSR_CRASH*) data and control geters and setters. Userspace should check that such msr's available by check of KVM_CAP_HYPERV_MSR_CRASH capability. It should use the

Re: [PATCH 12/12] qemu/kvm/x86: hyper-v crash msrs set/get'ers and migration

2015-07-02 Thread Paolo Bonzini
On 02/07/2015 18:07, Denis V. Lunev wrote: +if (cpu-hyperv_crash +kvm_check_extension(cs-kvm_state, KVM_CAP_HYPERV_MSR_CRASH) 0) { +c-edx |= HV_X64_GUEST_CRASH_MSR_AVAILABLE; +has_msr_hv_crash = true; +} + Please patch

Re: [PATCH 11/12] qemu: add crash_occurred flag into CPUState

2015-07-02 Thread Paolo Bonzini
On 02/07/2015 18:18, Andreas Färber wrote: +uint32_t crash_occurred; volatile sig_atomic_t exit_request; uint32_t interrupt_request; int singlestep_enabled; If you add this field to CPUState, you'll also need to reset it in qom/cpu.c. Or is it intentionally

Re: [PATCH 3/9] kvm: add hyper-v crash msrs values

2015-07-01 Thread Paolo Bonzini
On 01/07/2015 18:06, Peter Hornyack wrote: If userspace is controlling the crash capabilities then HV_X64_MSR_CRASH_CTL_CONTENTS is not needed. Actually you still need to: userspace cannot write anything but 0 or (1ULL 63). However, the name makes less sense, so I'm in favor of removing the

Re: [PATCH 1/1] KVM: s390: virtio-ccw: don't overwrite config space values

2015-07-01 Thread Paolo Bonzini
On 29/06/2015 16:44, Christian Borntraeger wrote: From: Cornelia Huck cornelia.h...@de.ibm.com Eric noticed problems with vhost-scsi and virtio-ccw: vhost-scsi complained about overwriting values in the config space, which was triggered by a broken implementation of virtio-ccw's config

Re: [PATCH] KVM: x86: remove data variable from kvm_get_msr_common

2015-07-01 Thread Paolo Bonzini
On 29/06/2015 12:39, Nicolas Iooss wrote: Commit 609e36d372ad (KVM: x86: pass host_initiated to functions that read MSRs) modified kvm_get_msr_common function to use msr_info-data instead of data but missed one occurrence. Replace it and remove the unused local variable. Fixes:

Re: [PATCH v3 0/9] HyperV equivalent of pvpanic driver

2015-07-01 Thread Paolo Bonzini
Smetanin asmeta...@virtuozzo.com Signed-off-by: Denis V. Lunev d...@openvz.org CC: Gleb Natapov g...@kernel.org CC: Paolo Bonzini pbonz...@redhat.com The patches look good, thanks. I'll queue them as soon as I start merging 4.3 features. Paolo -- To unsubscribe from this list: send the line

Re: [PATCH 0/1] KVM: s390: virtio-ccw: Fix config space values

2015-07-01 Thread Paolo Bonzini
On 01/07/2015 15:45, Michael S. Tsirkin wrote: Paolo, here is fix targetted for kvm/master (4.2) that fixes an issue with virtio config space on s390. It mostly manifests in vhost-scsi not working properly on s390. The problem itself might affect other things as well so cc

Re: [PATCH 0/3] KVM: x86: legacy NMI watchdog fixes

2015-07-01 Thread Paolo Bonzini
On 30/06/2015 22:19, Radim Krčmář wrote: Until v2.6.37, Linux used NMI watchdog that utilized IO-APIC and LVT0. This series fixes some problems with APICv, restore, and concurrency while keeping the monster asleep. Queued for 4.2. Paolo -- To unsubscribe from this list: send the line

Re: [PATCH 3/3] KVM: x86: make vapics_in_nmi_mode atomic

2015-07-01 Thread Paolo Bonzini
On 30/06/2015 22:19, Radim Krčmář wrote: Writes were a bit racy, but hard to turn into a bug at the same time. (Particularly because modern Linux doesn't use this feature anymore.) I suspect patch 2 makes this race much easier to trigger, so it deserves Cc: stable@ as well. Paolo

Re: [PATCH 0/1] KVM: s390: virtio-ccw: Fix config space values

2015-07-01 Thread Paolo Bonzini
On 01/07/2015 16:18, Michael S. Tsirkin wrote: On Wed, Jul 01, 2015 at 04:05:27PM +0200, Paolo Bonzini wrote: On 01/07/2015 15:45, Michael S. Tsirkin wrote: Paolo, here is fix targetted for kvm/master (4.2) that fixes an issue with virtio config space on s390. It mostly manifests

Re: [PATCH 2/3] KVM: x86: properly restore LVT0

2015-07-01 Thread Paolo Bonzini
On 30/06/2015 22:19, Radim Krčmář wrote: Legacy NMI watchdog didn't work after migration/resume, because vapics_in_nmi_mode was left at 0. Signed-off-by: Radim Krčmář rkrc...@redhat.com --- arch/x86/kvm/lapic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/lapic.c

Re: [PATCH 8/9] kvm/x86: add sending hyper-v crash notification to user space

2015-07-01 Thread Paolo Bonzini
to send the whole series again; just resend this one patch. Paolo Signed-off-by: Andrey Smetanin asmeta...@virtuozzo.com Signed-off-by: Denis V. Lunev d...@openvz.org CC: Paolo Bonzini pbonz...@redhat.com CC: Gleb Natapov g...@kernel.org --- arch/x86/kvm/x86.c | 8 include/uapi

Re: [PATCH 9/9] qemu/kvm: kvm hyper-v based guest crash event handling

2015-07-01 Thread Paolo Bonzini
On 30/06/2015 13:33, Denis V. Lunev wrote: +static int kvm_arch_handle_hv_crash(CPUState *cs) +{ +X86CPU *cpu = X86_CPU(cs); +CPUX86State *env = cpu-env; + +/* Mark that Hyper-v guest crash occurred */ +env-hv_crash_occurred = 1; This need not be a hv crash. You can

Re: [PATCH 3/9] kvm: add hyper-v crash msrs values

2015-07-01 Thread Paolo Bonzini
On 30/06/2015 13:33, Denis V. Lunev wrote: +#define HV_X64_MSR_CRASH_CTL_NOTIFY (1ULL 63) +#define HV_X64_MSR_CRASH_CTL_CONTENTS\ + (HV_X64_MSR_CRASH_CTL_NOTIFY) Why is HV_X64_MSR_CRASH_CTL_CONTENTS needed? Can I just remove it? Paolo -- To unsubscribe from

Re: [PATCH] MAINTAINERS: separate section for s390 virtio drivers

2015-07-01 Thread Paolo Bonzini
is probably a good idea. +S: Supported +F: drivers/s390/kvm/ Since we are at it, do we want to rename the directory to drivers/s390/virtio? Anyway: Acked-by: Paolo Bonzini pbonz...@redhat.com Paolo VIRTIO HOST (VHOST) M: Michael S. Tsirkin m...@redhat.com L: kvm@vger.kernel.org

Re: [PATCH 7/9] kvm/x86: added hyper-v crash data and ctl msr's get/set'ers

2015-07-01 Thread Paolo Bonzini
On 30/06/2015 13:33, Denis V. Lunev wrote: +static int kvm_hv_msr_set_crash_ctl(struct kvm_vcpu *vcpu, u64 data, bool host) +{ + struct kvm_hv *hv = vcpu-kvm-arch.hyperv; + + if (host) + hv-hv_crash_ctl = data; + You need to check against

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