[patch added to the 3.12 stable tree] MIPS: KVM: Fix CACHE immediate offset sign extension
From: James Hogan <james.ho...@imgtec.com> This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. === commit c5c2a3b998f1ff5a586f9d37e154070b8d550d17 upstream. The immediate field of the CACHE instruction is signed, so ensure that it gets sign extended by casting it to an int16_t rather than just masking the low 16 bits. Fixes: e685c689f3a8 ("KVM/MIPS32: Privileged instruction/target branch emulation.") Signed-off-by: James Hogan <james.ho...@imgtec.com> Cc: Ralf Baechle <r...@linux-mips.org> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Gleb Natapov <g...@kernel.org> Cc: linux-m...@linux-mips.org Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> Signed-off-by: James Hogan <james.ho...@imgtec.com> Signed-off-by: Jiri Slaby <jsl...@suse.cz> --- arch/mips/kvm/kvm_mips_emul.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c index c76f297b7149..33085819cd89 100644 --- a/arch/mips/kvm/kvm_mips_emul.c +++ b/arch/mips/kvm/kvm_mips_emul.c @@ -935,7 +935,7 @@ kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, uint32_t cause, base = (inst >> 21) & 0x1f; op_inst = (inst >> 16) & 0x1f; - offset = inst & 0x; + offset = (int16_t)inst; cache = (inst >> 16) & 0x3; op = (inst >> 18) & 0x7; -- 2.6.4 -- 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 added to the 3.12 stable tree] MIPS: KVM: Uninit VCPU in vcpu_create error path
From: James Hogan <james.ho...@imgtec.com> This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. === commit 585bb8f9a5e592f2ce7abbe5ed3112d5438d2754 upstream. If either of the memory allocations in kvm_arch_vcpu_create() fail, the vcpu which has been allocated and kvm_vcpu_init'd doesn't get uninit'd in the error handling path. Add a call to kvm_vcpu_uninit() to fix this. Fixes: 669e846e6c4e ("KVM/MIPS32: MIPS arch specific APIs for KVM") Signed-off-by: James Hogan <james.ho...@imgtec.com> Cc: Ralf Baechle <r...@linux-mips.org> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Gleb Natapov <g...@kernel.org> Cc: linux-m...@linux-mips.org Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> Signed-off-by: James Hogan <james.ho...@imgtec.com> Signed-off-by: Jiri Slaby <jsl...@suse.cz> --- arch/mips/kvm/kvm_mips.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index 2cb24788a8a6..7e7de1f2b8ed 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c @@ -312,7 +312,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) if (!gebase) { err = -ENOMEM; - goto out_free_cpu; + goto out_uninit_cpu; } kvm_info("Allocated %d bytes for KVM Exception Handlers @ %p\n", ALIGN(size, PAGE_SIZE), gebase); @@ -372,6 +372,9 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) out_free_gebase: kfree(gebase); +out_uninit_cpu: + kvm_vcpu_uninit(vcpu); + out_free_cpu: kfree(vcpu); -- 2.6.4 -- 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 added to the 3.12 stable tree] MIPS: KVM: Fix ASID restoration logic
From: James Hogan <james.ho...@imgtec.com> This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. === commit 002374f371bd02df864cce1fe85d90dc5b292837 upstream. ASID restoration on guest resume should determine the guest execution mode based on the guest Status register rather than bit 30 of the guest PC. Fix the two places in locore.S that do this, loading the guest status from the cop0 area. Note, this assembly is specific to the trap & emulate implementation of KVM, so it doesn't need to check the supervisor bit as that mode is not implemented in the guest. Fixes: b680f70fc111 ("KVM/MIPS32: Entry point for trampolining to...") Signed-off-by: James Hogan <james.ho...@imgtec.com> Cc: Ralf Baechle <r...@linux-mips.org> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Gleb Natapov <g...@kernel.org> Cc: linux-m...@linux-mips.org Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> Signed-off-by: James Hogan <james.ho...@imgtec.com> Signed-off-by: Jiri Slaby <jsl...@suse.cz> --- arch/mips/kvm/kvm_locore.S | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S index 03a2db58b22d..ba5ce99c021d 100644 --- a/arch/mips/kvm/kvm_locore.S +++ b/arch/mips/kvm/kvm_locore.S @@ -159,9 +159,11 @@ FEXPORT(__kvm_mips_vcpu_run) FEXPORT(__kvm_mips_load_asid) /* Set the ASID for the Guest Kernel */ - INT_SLL t0, t0, 1 /* with kseg0 @ 0x4000, kernel */ - /* addresses shift to 0x8000 */ - bltzt0, 1f /* If kernel */ + PTR_L t0, VCPU_COP0(k1) + LONG_L t0, COP0_STATUS(t0) + andit0, KSU_USER | ST0_ERL | ST0_EXL + xorit0, KSU_USER + bnezt0, 1f /* If kernel */ INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID/* else user */ 1: @@ -438,9 +440,11 @@ __kvm_mips_return_to_guest: mtc0t0, CP0_EPC /* Set the ASID for the Guest Kernel */ - INT_SLL t0, t0, 1 /* with kseg0 @ 0x4000, kernel */ - /* addresses shift to 0x8000 */ - bltzt0, 1f /* If kernel */ + PTR_L t0, VCPU_COP0(k1) + LONG_L t0, COP0_STATUS(t0) + andit0, KSU_USER | ST0_ERL | ST0_EXL + xorit0, KSU_USER + bnezt0, 1f /* If kernel */ INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID/* else user */ 1: -- 2.6.4 -- 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 3.12 04/91] MIPS: KVM: Uninit VCPU in vcpu_create error path
From: James Hogan <james.ho...@imgtec.com> 3.12-stable review patch. If anyone has any objections, please let me know. === commit 585bb8f9a5e592f2ce7abbe5ed3112d5438d2754 upstream. If either of the memory allocations in kvm_arch_vcpu_create() fail, the vcpu which has been allocated and kvm_vcpu_init'd doesn't get uninit'd in the error handling path. Add a call to kvm_vcpu_uninit() to fix this. Fixes: 669e846e6c4e ("KVM/MIPS32: MIPS arch specific APIs for KVM") Signed-off-by: James Hogan <james.ho...@imgtec.com> Cc: Ralf Baechle <r...@linux-mips.org> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Gleb Natapov <g...@kernel.org> Cc: linux-m...@linux-mips.org Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> Signed-off-by: James Hogan <james.ho...@imgtec.com> Signed-off-by: Jiri Slaby <jsl...@suse.cz> --- arch/mips/kvm/kvm_mips.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index 2cb24788a8a6..7e7de1f2b8ed 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c @@ -312,7 +312,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) if (!gebase) { err = -ENOMEM; - goto out_free_cpu; + goto out_uninit_cpu; } kvm_info("Allocated %d bytes for KVM Exception Handlers @ %p\n", ALIGN(size, PAGE_SIZE), gebase); @@ -372,6 +372,9 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) out_free_gebase: kfree(gebase); +out_uninit_cpu: + kvm_vcpu_uninit(vcpu); + out_free_cpu: kfree(vcpu); -- 2.6.4 -- 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 3.12 03/91] MIPS: KVM: Fix CACHE immediate offset sign extension
From: James Hogan <james.ho...@imgtec.com> 3.12-stable review patch. If anyone has any objections, please let me know. === commit c5c2a3b998f1ff5a586f9d37e154070b8d550d17 upstream. The immediate field of the CACHE instruction is signed, so ensure that it gets sign extended by casting it to an int16_t rather than just masking the low 16 bits. Fixes: e685c689f3a8 ("KVM/MIPS32: Privileged instruction/target branch emulation.") Signed-off-by: James Hogan <james.ho...@imgtec.com> Cc: Ralf Baechle <r...@linux-mips.org> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Gleb Natapov <g...@kernel.org> Cc: linux-m...@linux-mips.org Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> Signed-off-by: James Hogan <james.ho...@imgtec.com> Signed-off-by: Jiri Slaby <jsl...@suse.cz> --- arch/mips/kvm/kvm_mips_emul.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c index c76f297b7149..33085819cd89 100644 --- a/arch/mips/kvm/kvm_mips_emul.c +++ b/arch/mips/kvm/kvm_mips_emul.c @@ -935,7 +935,7 @@ kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, uint32_t cause, base = (inst >> 21) & 0x1f; op_inst = (inst >> 16) & 0x1f; - offset = inst & 0x; + offset = (int16_t)inst; cache = (inst >> 16) & 0x3; op = (inst >> 18) & 0x7; -- 2.6.4 -- 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 3.12 02/91] MIPS: KVM: Fix ASID restoration logic
From: James Hogan <james.ho...@imgtec.com> 3.12-stable review patch. If anyone has any objections, please let me know. === commit 002374f371bd02df864cce1fe85d90dc5b292837 upstream. ASID restoration on guest resume should determine the guest execution mode based on the guest Status register rather than bit 30 of the guest PC. Fix the two places in locore.S that do this, loading the guest status from the cop0 area. Note, this assembly is specific to the trap & emulate implementation of KVM, so it doesn't need to check the supervisor bit as that mode is not implemented in the guest. Fixes: b680f70fc111 ("KVM/MIPS32: Entry point for trampolining to...") Signed-off-by: James Hogan <james.ho...@imgtec.com> Cc: Ralf Baechle <r...@linux-mips.org> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Gleb Natapov <g...@kernel.org> Cc: linux-m...@linux-mips.org Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> Signed-off-by: James Hogan <james.ho...@imgtec.com> Signed-off-by: Jiri Slaby <jsl...@suse.cz> --- arch/mips/kvm/kvm_locore.S | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S index 03a2db58b22d..ba5ce99c021d 100644 --- a/arch/mips/kvm/kvm_locore.S +++ b/arch/mips/kvm/kvm_locore.S @@ -159,9 +159,11 @@ FEXPORT(__kvm_mips_vcpu_run) FEXPORT(__kvm_mips_load_asid) /* Set the ASID for the Guest Kernel */ - INT_SLL t0, t0, 1 /* with kseg0 @ 0x4000, kernel */ - /* addresses shift to 0x8000 */ - bltzt0, 1f /* If kernel */ + PTR_L t0, VCPU_COP0(k1) + LONG_L t0, COP0_STATUS(t0) + andit0, KSU_USER | ST0_ERL | ST0_EXL + xorit0, KSU_USER + bnezt0, 1f /* If kernel */ INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID/* else user */ 1: @@ -438,9 +440,11 @@ __kvm_mips_return_to_guest: mtc0t0, CP0_EPC /* Set the ASID for the Guest Kernel */ - INT_SLL t0, t0, 1 /* with kseg0 @ 0x4000, kernel */ - /* addresses shift to 0x8000 */ - bltzt0, 1f /* If kernel */ + PTR_L t0, VCPU_COP0(k1) + LONG_L t0, COP0_STATUS(t0) + andit0, KSU_USER | ST0_ERL | ST0_EXL + xorit0, KSU_USER + bnezt0, 1f /* If kernel */ INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID/* else user */ 1: -- 2.6.4 -- 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
Re: [PATCH backport v3.12..v3.14 2/4] MIPS: KVM: Fix ASID restoration logic
On 12/11/2015, 06:06 PM, James Hogan wrote: > commit 002374f371bd02df864cce1fe85d90dc5b292837 upstream. Applied 2/4 -- 4/4 to 3.12. Thanks. -- js suse labs -- 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 added to the 3.12 stable tree] MIPS: KVM: Do not sign extend on unsigned MMIO load
From: Nicholas Mc Guire hof...@osadl.org This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. === commit ed9244e6c534612d2b5ae47feab2f55a0d4b4ced upstream. Fix possible unintended sign extension in unsigned MMIO loads by casting to uint16_t in the case of mmio_needed != 2. Signed-off-by: Nicholas Mc Guire hof...@osadl.org Reviewed-by: James Hogan james.ho...@imgtec.com Tested-by: James Hogan james.ho...@imgtec.com Cc: Gleb Natapov g...@kernel.org Cc: Paolo Bonzini pbonz...@redhat.com Cc: kvm@vger.kernel.org Cc: linux-m...@linux-mips.org Cc: linux-ker...@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/9985/ Signed-off-by: Ralf Baechle r...@linux-mips.org Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/kvm_mips_emul.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c index e75ef8219caf..c76f297b7149 100644 --- a/arch/mips/kvm/kvm_mips_emul.c +++ b/arch/mips/kvm/kvm_mips_emul.c @@ -1626,7 +1626,7 @@ kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, struct kvm_run *run) if (vcpu-mmio_needed == 2) *gpr = *(int16_t *) run-mmio.data; else - *gpr = *(int16_t *) run-mmio.data; + *gpr = *(uint16_t *)run-mmio.data; break; case 1: -- 2.4.2 -- 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
Re: [PATCH] MIPS: KVM: do not sign extend on unsigned MMIO load
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 06/08/2015, 10:33 AM, James Hogan wrote: Hi stable folk, On 08/05/15 15:16, James Hogan wrote: On 07/05/15 13:47, Nicholas Mc Guire wrote: Fix possible unintended sign extension in unsigned MMIO loads by casting to uint16_t in the case of mmio_needed != 2. Signed-off-by: Nicholas Mc Guire hof...@osadl.org Looks good to me. I wrote an MMIO test to reproduce the issue, and this fixes it. Reviewed-by: James Hogan james.ho...@imgtec.com Tested-by: James Hogan james.ho...@imgtec.com It looks suitable for stable too (3.10+). This has reached mainline, commit ed9244e6c534612d2b5ae47feab2f55a0d4b4ced Please could it be added to stable (3.10+). Applied to 3.12. Thanks. - -- js suse labs -BEGIN PGP SIGNATURE- Version: GnuPG v2 iQIcBAEBCAAGBQJVeDQcAAoJEL0lsQQGtHBJ7q4P/3Q7y1FHwPKDhsdIdyyRypR6 OXaH/6eNzpBhvSngP1gnx9MiyESTYihFVlRJsV6hYYzRcippnU0BP88dx9ntYrc1 Accbhj/PPYcMqfCnYdL80Kxt9EomeuxEDcCdbp8twnReTt44xNAGHePiNh9GrhjG VKBMralyyjymtwyamCGb2W2aLNhxELIG3gXJTb7Q7E071LVeqQA6g+VNQ2QHwFYq FkJexePsLu/j3zVxH+rsQPJA6E1oKfUJb3jQHAtZHAH95Um0r8T4jUVSgFhyk3r6 9tlkazL3P8Iui6lxbrV1vNCPAhhucY7PmX99uGhdroKJOKDCDPsVOKyJbxeHrUBR 3zrMpB9x2uXd6WpDLDfL+bI8bCG6NVXZPGgSd7P+r/UbNuZ6VBNSVdqlWUeoMWGR ZS+HFMxVOiNplYudCTdLbJDLhm2XCWeW2lqszll/8Nk1c1FZkl8YbgpmdXfutKeU LQfUfS4tr0AQ7BqXf3bPUGrSGZO7e1V5R4gAa+Yqo6ZjDOj20AjYvs0oW4ubgLg8 OJrHcJDLkEKrMDIZ7qpRZxyz56yrOgcfVbYB1fudXaV+e38t+kO0sujdNSJnHK8h T3kfa96QW2gOi7Cys1o2OaQboY2wFxK3/YefX3Jn+N7tGedKUwF4IYHtj17YqX1/ 8BkHSZZ9HQsJqyRAXBux =qlvA -END PGP SIGNATURE- -- 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 3.12 108/111] MIPS: KVM: Do not sign extend on unsigned MMIO load
From: Nicholas Mc Guire hof...@osadl.org 3.12-stable review patch. If anyone has any objections, please let me know. === commit ed9244e6c534612d2b5ae47feab2f55a0d4b4ced upstream. Fix possible unintended sign extension in unsigned MMIO loads by casting to uint16_t in the case of mmio_needed != 2. Signed-off-by: Nicholas Mc Guire hof...@osadl.org Reviewed-by: James Hogan james.ho...@imgtec.com Tested-by: James Hogan james.ho...@imgtec.com Cc: Gleb Natapov g...@kernel.org Cc: Paolo Bonzini pbonz...@redhat.com Cc: kvm@vger.kernel.org Cc: linux-m...@linux-mips.org Cc: linux-ker...@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/9985/ Signed-off-by: Ralf Baechle r...@linux-mips.org Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/kvm_mips_emul.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c index e75ef8219caf..c76f297b7149 100644 --- a/arch/mips/kvm/kvm_mips_emul.c +++ b/arch/mips/kvm/kvm_mips_emul.c @@ -1626,7 +1626,7 @@ kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, struct kvm_run *run) if (vcpu-mmio_needed == 2) *gpr = *(int16_t *) run-mmio.data; else - *gpr = *(int16_t *) run-mmio.data; + *gpr = *(uint16_t *)run-mmio.data; break; case 1: -- 2.4.2 -- 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
Re: copy_huge_page: unable to handle kernel NULL pointer dereference at 0000000000000008
On 03/29/2015, 01:25 AM, Hugh Dickins wrote: But you are very appositely mistaken: copy_huge_page() used to make the same mistake, and Dave Hansen fixed it back in v3.13, but the fix never went to the stable trees. Your report was on an Ubuntu 3.11.0-15 kernel: I think Ubuntu have discontinued their 3.11-stable kernel series, but 3.10-longterm and 3.12-longterm would benefit from including this fix. I haven't tried patching and building and testing it there, but it looks reasonable. Hugh commit 30b0a105d9f7141e4cbf72ae5511832457d89788 Author: Dave Hansen dave.han...@linux.intel.com Date: Thu Nov 21 14:31:58 2013 -0800 mm: thp: give transparent hugepage code a separate copy_page Applied to 3.12. Thanks. -- js suse labs -- 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 3.12 110/175] KVM: MIPS: Fix trace event to save PC directly
From: James Hogan james.ho...@imgtec.com 3.12-stable review patch. If anyone has any objections, please let me know. === commit b3cffac04eca9af46e1e23560a8ee22b1bd36d43 upstream. Currently the guest exit trace event saves the VCPU pointer to the structure, and the guest PC is retrieved by dereferencing it when the event is printed rather than directly from the trace record. This isn't safe as the printing may occur long afterwards, after the PC has changed and potentially after the VCPU has been freed. Usually this results in the same (wrong) PC being printed for multiple trace events. It also isn't portable as userland has no way to access the VCPU data structure when interpreting the trace record itself. Lets save the actual PC in the structure so that the correct value is accessible later. Fixes: 669e846e6c4e (KVM/MIPS32: MIPS arch specific APIs for KVM) Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Ralf Baechle r...@linux-mips.org Cc: Marcelo Tosatti mtosa...@redhat.com Cc: Gleb Natapov g...@kernel.org Cc: Steven Rostedt rost...@goodmis.org Cc: Ingo Molnar mi...@redhat.com Cc: linux-m...@linux-mips.org Cc: kvm@vger.kernel.org Acked-by: Steven Rostedt rost...@goodmis.org Signed-off-by: Marcelo Tosatti mtosa...@redhat.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/trace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h index bc9e0f406c08..e51621e36152 100644 --- a/arch/mips/kvm/trace.h +++ b/arch/mips/kvm/trace.h @@ -26,18 +26,18 @@ TRACE_EVENT(kvm_exit, TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason), TP_ARGS(vcpu, reason), TP_STRUCT__entry( - __field(struct kvm_vcpu *, vcpu) + __field(unsigned long, pc) __field(unsigned int, reason) ), TP_fast_assign( - __entry-vcpu = vcpu; + __entry-pc = vcpu-arch.pc; __entry-reason = reason; ), TP_printk([%s]PC: 0x%08lx, kvm_mips_exit_types_str[__entry-reason], - __entry-vcpu-arch.pc) + __entry-pc) ); #endif /* _TRACE_KVM_H */ -- 2.3.0 -- 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 3.12 022/175] MIPS: KVM: Deliver guest interrupts after local_irq_disable()
From: James Hogan james.ho...@imgtec.com 3.12-stable review patch. If anyone has any objections, please let me know. === commit 044f0f03eca0110e1835b2ea038a484b93950328 upstream. When about to run the guest, deliver guest interrupts after disabling host interrupts. This should prevent an hrtimer interrupt from being handled after delivering guest interrupts, and therefore not delivering the guest timer interrupt until after the next guest exit. Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org Cc: Ralf Baechle r...@linux-mips.org Cc: linux-m...@linux-mips.org Cc: Sanjay Lal sanj...@kymasys.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/kvm_mips.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index 3f3e5b2b2f38..016f163b42da 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c @@ -417,11 +417,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) vcpu-mmio_needed = 0; } + local_irq_disable(); /* Check if we have any exceptions/interrupts pending */ kvm_mips_deliver_interrupts(vcpu, kvm_read_c0_guest_cause(vcpu-arch.cop0)); - local_irq_disable(); kvm_guest_enter(); r = __kvm_mips_vcpu_run(run, vcpu); -- 2.3.0 -- 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 3.12 070/175] MIPS: Export FP functions used by lose_fpu(1) for KVM
From: James Hogan james.ho...@imgtec.com 3.12-stable review patch. If anyone has any objections, please let me know. === commit 3ce465e04bfd8de9956d515d6e9587faac3375dc upstream. Export the _save_fp asm function used by the lose_fpu(1) macro to GPL modules so that KVM can make use of it when it is built as a module. This fixes the following build error when CONFIG_KVM=m due to commit f798217dfd03 (KVM: MIPS: Don't leak FPU/DSP to guest): ERROR: _save_fp [arch/mips/kvm/kvm.ko] undefined! Signed-off-by: James Hogan james.ho...@imgtec.com Fixes: f798217dfd03 (KVM: MIPS: Don't leak FPU/DSP to guest) Cc: Paolo Bonzini pbonz...@redhat.com Cc: Ralf Baechle r...@linux-mips.org Cc: Paul Burton paul.bur...@imgtec.com Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org Cc: linux-m...@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/9260/ Signed-off-by: Ralf Baechle r...@linux-mips.org [james.ho...@imgtec.com: Only export when CPU_R4K_FPU=y prior to v3.16, so as not to break the Octeon build which excludes FPU support. KVM depends on MIPS32r2 anyway.] Signed-off-by: James Hogan james.ho...@imgtec.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kernel/mips_ksyms.c | 8 1 file changed, 8 insertions(+) diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c index 6e58e97fcd39..cedeb5686eb5 100644 --- a/arch/mips/kernel/mips_ksyms.c +++ b/arch/mips/kernel/mips_ksyms.c @@ -14,6 +14,7 @@ #include linux/mm.h #include asm/uaccess.h #include asm/ftrace.h +#include asm/fpu.h extern void *__bzero(void *__s, size_t __count); extern long __strncpy_from_user_nocheck_asm(char *__to, @@ -26,6 +27,13 @@ extern long __strnlen_user_nocheck_asm(const char *s); extern long __strnlen_user_asm(const char *s); /* + * Core architecture code + */ +#ifdef CONFIG_CPU_R4K_FPU +EXPORT_SYMBOL_GPL(_save_fp); +#endif + +/* * String functions */ EXPORT_SYMBOL(memset); -- 2.3.0 -- 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 3.12 048/175] KVM: MIPS: Don't leak FPU/DSP to guest
From: James Hogan james.ho...@imgtec.com 3.12-stable review patch. If anyone has any objections, please let me know. === [ Upstream commit f798217dfd038af981a18bbe4bc57027a08bb182 ] The FPU and DSP are enabled via the CP0 Status CU1 and MX bits by kvm_mips_set_c0_status() on a guest exit, presumably in case there is active state that needs saving if pre-emption occurs. However neither of these bits are cleared again when returning to the guest. This effectively gives the guest access to the FPU/DSP hardware after the first guest exit even though it is not aware of its presence, allowing FP instructions in guest user code to intermittently actually execute instead of trapping into the guest OS for emulation. It will then read manipulate the hardware FP registers which technically belong to the user process (e.g. QEMU), or are stale from another user process. It can also crash the guest OS by causing an FP exception, for which a guest exception handler won't have been registered. First lets save and disable the FPU (and MSA) state with lose_fpu(1) before entering the guest. This simplifies the problem, especially for when guest FPU/MSA support is added in the future, and prevents FR=1 FPU state being live when the FR bit gets cleared for the guest, which according to the architecture causes the contents of the FPU and vector registers to become UNPREDICTABLE. We can then safely remove the enabling of the FPU in kvm_mips_set_c0_status(), since there should never be any active FPU or MSA state to save at pre-emption, which should plug the FPU leak. DSP state is always live rather than being lazily restored, so for that it is simpler to just clear the MX bit again when re-entering the guest. Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Ralf Baechle r...@linux-mips.org Cc: Sanjay Lal sanj...@kymasys.com Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org Cc: linux-m...@linux-mips.org Cc: sta...@vger.kernel.org # v3.10+: 044f0f03eca0: MIPS: KVM: Deliver guest interrupts Cc: sta...@vger.kernel.org # v3.10+: 3ce465e04bfd: MIPS: Export FP functions used by lose_fpu(1) for KVM Cc: sta...@vger.kernel.org # v3.10+ Signed-off-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: James Hogan james.ho...@imgtec.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/kvm_locore.S | 2 +- arch/mips/kvm/kvm_mips.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S index bbace092ad0a..03a2db58b22d 100644 --- a/arch/mips/kvm/kvm_locore.S +++ b/arch/mips/kvm/kvm_locore.S @@ -428,7 +428,7 @@ __kvm_mips_return_to_guest: /* Setup status register for running guest in UM */ .setat or v1, v1, (ST0_EXL | KSU_USER | ST0_IE) - and v1, v1, ~ST0_CU0 + and v1, v1, ~(ST0_CU0 | ST0_MX) .setnoat mtc0v1, CP0_STATUS ehb diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index 016f163b42da..2cb24788a8a6 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c @@ -15,6 +15,7 @@ #include linux/vmalloc.h #include linux/fs.h #include linux/bootmem.h +#include asm/fpu.h #include asm/page.h #include asm/cacheflush.h #include asm/mmu_context.h @@ -417,6 +418,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) vcpu-mmio_needed = 0; } + lose_fpu(1); + local_irq_disable(); /* Check if we have any exceptions/interrupts pending */ kvm_mips_deliver_interrupts(vcpu, @@ -1021,9 +1024,6 @@ void kvm_mips_set_c0_status(void) { uint32_t status = read_c0_status(); - if (cpu_has_fpu) - status |= (ST0_CU1); - if (cpu_has_dsp) status |= (ST0_MX); -- 2.3.0 -- 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 added to the 3.12 stable tree] KVM: MIPS: Fix trace event to save PC directly
From: James Hogan james.ho...@imgtec.com This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. === commit b3cffac04eca9af46e1e23560a8ee22b1bd36d43 upstream. Currently the guest exit trace event saves the VCPU pointer to the structure, and the guest PC is retrieved by dereferencing it when the event is printed rather than directly from the trace record. This isn't safe as the printing may occur long afterwards, after the PC has changed and potentially after the VCPU has been freed. Usually this results in the same (wrong) PC being printed for multiple trace events. It also isn't portable as userland has no way to access the VCPU data structure when interpreting the trace record itself. Lets save the actual PC in the structure so that the correct value is accessible later. Fixes: 669e846e6c4e (KVM/MIPS32: MIPS arch specific APIs for KVM) Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Ralf Baechle r...@linux-mips.org Cc: Marcelo Tosatti mtosa...@redhat.com Cc: Gleb Natapov g...@kernel.org Cc: Steven Rostedt rost...@goodmis.org Cc: Ingo Molnar mi...@redhat.com Cc: linux-m...@linux-mips.org Cc: kvm@vger.kernel.org Acked-by: Steven Rostedt rost...@goodmis.org Signed-off-by: Marcelo Tosatti mtosa...@redhat.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/trace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h index bc9e0f406c08..e51621e36152 100644 --- a/arch/mips/kvm/trace.h +++ b/arch/mips/kvm/trace.h @@ -26,18 +26,18 @@ TRACE_EVENT(kvm_exit, TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason), TP_ARGS(vcpu, reason), TP_STRUCT__entry( - __field(struct kvm_vcpu *, vcpu) + __field(unsigned long, pc) __field(unsigned int, reason) ), TP_fast_assign( - __entry-vcpu = vcpu; + __entry-pc = vcpu-arch.pc; __entry-reason = reason; ), TP_printk([%s]PC: 0x%08lx, kvm_mips_exit_types_str[__entry-reason], - __entry-vcpu-arch.pc) + __entry-pc) ); #endif /* _TRACE_KVM_H */ -- 2.3.0 -- 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
Re: [PATCH stable 3.10, 3.12, 3.14] MIPS: Export FP functions used by lose_fpu(1) for KVM
On 03/05/2015, 05:08 PM, James Hogan wrote: [ Upstream commit 3ce465e04bfd8de9956d515d6e9587faac3375dc ] Export the _save_fp asm function used by the lose_fpu(1) macro to GPL modules so that KVM can make use of it when it is built as a module. This fixes the following build error when CONFIG_KVM=m due to commit f798217dfd03 (KVM: MIPS: Don't leak FPU/DSP to guest): ERROR: _save_fp [arch/mips/kvm/kvm.ko] undefined! Signed-off-by: James Hogan james.ho...@imgtec.com Fixes: f798217dfd03 (KVM: MIPS: Don't leak FPU/DSP to guest) Cc: Paolo Bonzini pbonz...@redhat.com Cc: Ralf Baechle r...@linux-mips.org Cc: Paul Burton paul.bur...@imgtec.com Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org Cc: linux-m...@linux-mips.org Cc: sta...@vger.kernel.org # 3.10...3.15 Patchwork: https://patchwork.linux-mips.org/patch/9260/ Signed-off-by: Ralf Baechle r...@linux-mips.org [james.ho...@imgtec.com: Only export when CPU_R4K_FPU=y prior to v3.16, so as not to break the Octeon build which excludes FPU support. KVM depends on MIPS32r2 anyway.] Signed-off-by: James Hogan james.ho...@imgtec.com --- Appologies for the previous cavium_octeon_defconfig link breakage. Octeon has the symbol since 3.16, but not before. This backport should do the trick for stable 3.10, 3.12, and 3.14. Build tested with cavium_octeon_defconfig and malta_kvm_defconfig on those stable branches. Applied to 3.12 now. Thanks. -- js suse labs -- 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 added to the 3.12 stable tree] MIPS: Export FP functions used by lose_fpu(1) for KVM
From: James Hogan james.ho...@imgtec.com This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. === commit 3ce465e04bfd8de9956d515d6e9587faac3375dc upstream. Export the _save_fp asm function used by the lose_fpu(1) macro to GPL modules so that KVM can make use of it when it is built as a module. This fixes the following build error when CONFIG_KVM=m due to commit f798217dfd03 (KVM: MIPS: Don't leak FPU/DSP to guest): ERROR: _save_fp [arch/mips/kvm/kvm.ko] undefined! Signed-off-by: James Hogan james.ho...@imgtec.com Fixes: f798217dfd03 (KVM: MIPS: Don't leak FPU/DSP to guest) Cc: Paolo Bonzini pbonz...@redhat.com Cc: Ralf Baechle r...@linux-mips.org Cc: Paul Burton paul.bur...@imgtec.com Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org Cc: linux-m...@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/9260/ Signed-off-by: Ralf Baechle r...@linux-mips.org Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kernel/mips_ksyms.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c index 6e58e97fcd39..60adf7969337 100644 --- a/arch/mips/kernel/mips_ksyms.c +++ b/arch/mips/kernel/mips_ksyms.c @@ -14,6 +14,7 @@ #include linux/mm.h #include asm/uaccess.h #include asm/ftrace.h +#include asm/fpu.h extern void *__bzero(void *__s, size_t __count); extern long __strncpy_from_user_nocheck_asm(char *__to, @@ -26,6 +27,11 @@ extern long __strnlen_user_nocheck_asm(const char *s); extern long __strnlen_user_asm(const char *s); /* + * Core architecture code + */ +EXPORT_SYMBOL_GPL(_save_fp); + +/* * String functions */ EXPORT_SYMBOL(memset); -- 2.3.0 -- 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 added to the 3.12 stable tree] KVM: MIPS: Don't leak FPU/DSP to guest
From: James Hogan james.ho...@imgtec.com This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. === [ Upstream commit f798217dfd038af981a18bbe4bc57027a08bb182 ] The FPU and DSP are enabled via the CP0 Status CU1 and MX bits by kvm_mips_set_c0_status() on a guest exit, presumably in case there is active state that needs saving if pre-emption occurs. However neither of these bits are cleared again when returning to the guest. This effectively gives the guest access to the FPU/DSP hardware after the first guest exit even though it is not aware of its presence, allowing FP instructions in guest user code to intermittently actually execute instead of trapping into the guest OS for emulation. It will then read manipulate the hardware FP registers which technically belong to the user process (e.g. QEMU), or are stale from another user process. It can also crash the guest OS by causing an FP exception, for which a guest exception handler won't have been registered. First lets save and disable the FPU (and MSA) state with lose_fpu(1) before entering the guest. This simplifies the problem, especially for when guest FPU/MSA support is added in the future, and prevents FR=1 FPU state being live when the FR bit gets cleared for the guest, which according to the architecture causes the contents of the FPU and vector registers to become UNPREDICTABLE. We can then safely remove the enabling of the FPU in kvm_mips_set_c0_status(), since there should never be any active FPU or MSA state to save at pre-emption, which should plug the FPU leak. DSP state is always live rather than being lazily restored, so for that it is simpler to just clear the MX bit again when re-entering the guest. Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Ralf Baechle r...@linux-mips.org Cc: Sanjay Lal sanj...@kymasys.com Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org Cc: linux-m...@linux-mips.org Cc: sta...@vger.kernel.org # v3.10+: 044f0f03eca0: MIPS: KVM: Deliver guest interrupts Cc: sta...@vger.kernel.org # v3.10+: 3ce465e04bfd: MIPS: Export FP functions used by lose_fpu(1) for KVM Cc: sta...@vger.kernel.org # v3.10+ Signed-off-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: James Hogan james.ho...@imgtec.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/kvm_locore.S | 2 +- arch/mips/kvm/kvm_mips.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S index bbace092ad0a..03a2db58b22d 100644 --- a/arch/mips/kvm/kvm_locore.S +++ b/arch/mips/kvm/kvm_locore.S @@ -428,7 +428,7 @@ __kvm_mips_return_to_guest: /* Setup status register for running guest in UM */ .setat or v1, v1, (ST0_EXL | KSU_USER | ST0_IE) - and v1, v1, ~ST0_CU0 + and v1, v1, ~(ST0_CU0 | ST0_MX) .setnoat mtc0v1, CP0_STATUS ehb diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index 016f163b42da..2cb24788a8a6 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c @@ -15,6 +15,7 @@ #include linux/vmalloc.h #include linux/fs.h #include linux/bootmem.h +#include asm/fpu.h #include asm/page.h #include asm/cacheflush.h #include asm/mmu_context.h @@ -417,6 +418,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) vcpu-mmio_needed = 0; } + lose_fpu(1); + local_irq_disable(); /* Check if we have any exceptions/interrupts pending */ kvm_mips_deliver_interrupts(vcpu, @@ -1021,9 +1024,6 @@ void kvm_mips_set_c0_status(void) { uint32_t status = read_c0_status(); - if (cpu_has_fpu) - status |= (ST0_CU1); - if (cpu_has_dsp) status |= (ST0_MX); -- 2.3.0 -- 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 added to the 3.12 stable tree] MIPS: KVM: Deliver guest interrupts after local_irq_disable()
From: James Hogan james.ho...@imgtec.com This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. === commit 044f0f03eca0110e1835b2ea038a484b93950328 upstream. When about to run the guest, deliver guest interrupts after disabling host interrupts. This should prevent an hrtimer interrupt from being handled after delivering guest interrupts, and therefore not delivering the guest timer interrupt until after the next guest exit. Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org Cc: Ralf Baechle r...@linux-mips.org Cc: linux-m...@linux-mips.org Cc: Sanjay Lal sanj...@kymasys.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/kvm_mips.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index 3f3e5b2b2f38..016f163b42da 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c @@ -417,11 +417,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) vcpu-mmio_needed = 0; } + local_irq_disable(); /* Check if we have any exceptions/interrupts pending */ kvm_mips_deliver_interrupts(vcpu, kvm_read_c0_guest_cause(vcpu-arch.cop0)); - local_irq_disable(); kvm_guest_enter(); r = __kvm_mips_vcpu_run(run, vcpu); -- 2.3.0 -- 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 added to the 3.12 stable tree] MIPS: KVM: Remove redundant NULL checks before kfree()
From: James Hogan james.ho...@imgtec.com This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. === commit c6c0a6637f9da54f9472144d44f71cf847f92e20 upstream. The kfree() function already NULL checks the parameter so remove the redundant NULL checks before kfree() calls in arch/mips/kvm/. Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org Cc: Ralf Baechle r...@linux-mips.org Cc: linux-m...@linux-mips.org Cc: Sanjay Lal sanj...@kymasys.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/kvm_mips.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index b31153969946..8b900e987338 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c @@ -149,9 +149,7 @@ void kvm_mips_free_vcpus(struct kvm *kvm) if (kvm-arch.guest_pmap[i] != KVM_INVALID_PAGE) kvm_mips_release_pfn_clean(kvm-arch.guest_pmap[i]); } - - if (kvm-arch.guest_pmap) - kfree(kvm-arch.guest_pmap); + kfree(kvm-arch.guest_pmap); kvm_for_each_vcpu(i, vcpu, kvm) { kvm_arch_vcpu_free(vcpu); @@ -388,12 +386,8 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) kvm_mips_dump_stats(vcpu); - if (vcpu-arch.guest_ebase) - kfree(vcpu-arch.guest_ebase); - - if (vcpu-arch.kseg0_commpage) - kfree(vcpu-arch.kseg0_commpage); - + kfree(vcpu-arch.guest_ebase); + kfree(vcpu-arch.kseg0_commpage); } void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) -- 2.0.0 -- 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 3.12 050/170] MIPS: KVM: Remove redundant NULL checks before kfree()
From: James Hogan james.ho...@imgtec.com 3.12-stable review patch. If anyone has any objections, please let me know. === commit c6c0a6637f9da54f9472144d44f71cf847f92e20 upstream. The kfree() function already NULL checks the parameter so remove the redundant NULL checks before kfree() calls in arch/mips/kvm/. Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org Cc: Ralf Baechle r...@linux-mips.org Cc: linux-m...@linux-mips.org Cc: Sanjay Lal sanj...@kymasys.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/kvm_mips.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index b31153969946..8b900e987338 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c @@ -149,9 +149,7 @@ void kvm_mips_free_vcpus(struct kvm *kvm) if (kvm-arch.guest_pmap[i] != KVM_INVALID_PAGE) kvm_mips_release_pfn_clean(kvm-arch.guest_pmap[i]); } - - if (kvm-arch.guest_pmap) - kfree(kvm-arch.guest_pmap); + kfree(kvm-arch.guest_pmap); kvm_for_each_vcpu(i, vcpu, kvm) { kvm_arch_vcpu_free(vcpu); @@ -388,12 +386,8 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) kvm_mips_dump_stats(vcpu); - if (vcpu-arch.guest_ebase) - kfree(vcpu-arch.guest_ebase); - - if (vcpu-arch.kseg0_commpage) - kfree(vcpu-arch.kseg0_commpage); - + kfree(vcpu-arch.guest_ebase); + kfree(vcpu-arch.kseg0_commpage); } void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) -- 2.0.0 -- 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 3.12 057/181] MIPS: KVM: Allocate at least 16KB for exception handlers
From: James Hogan james.ho...@imgtec.com 3.12-stable review patch. If anyone has any objections, please let me know. === commit 7006e2dfda9adfa40251093604db76d7e44263b3 upstream. Each MIPS KVM guest has its own copy of the KVM exception vector. This contains the TLB refill exception handler at offset 0x000, the general exception handler at offset 0x180, and interrupt exception handlers at offset 0x200 in case Cause_IV=1. A common handler is copied to offset 0x2000 and offset 0x3000 is used for temporarily storing k1 during entry from guest. However the amount of memory allocated for this purpose is calculated as 0x200 rounded up to the next page boundary, which is insufficient if 4KB pages are in use. This can lead to the common handler at offset 0x2000 being overwritten and infinitely recursive exceptions on the next exit from the guest. Increase the minimum size from 0x200 to 0x4000 to cover the full use of the page. Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org Cc: Ralf Baechle r...@linux-mips.org Cc: linux-m...@linux-mips.org Cc: Sanjay Lal sanj...@kymasys.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/kvm_mips.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index a7b044536de4..b31153969946 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c @@ -303,7 +303,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) if (cpu_has_veic || cpu_has_vint) { size = 0x200 + VECTORSPACING * 64; } else { - size = 0x200; + size = 0x4000; } /* Save Linux EBASE */ -- 2.0.0 -- 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 added to the 3.12 stable tree] MIPS: KVM: Allocate at least 16KB for exception handlers
From: James Hogan james.ho...@imgtec.com This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. === commit 7006e2dfda9adfa40251093604db76d7e44263b3 upstream. Each MIPS KVM guest has its own copy of the KVM exception vector. This contains the TLB refill exception handler at offset 0x000, the general exception handler at offset 0x180, and interrupt exception handlers at offset 0x200 in case Cause_IV=1. A common handler is copied to offset 0x2000 and offset 0x3000 is used for temporarily storing k1 during entry from guest. However the amount of memory allocated for this purpose is calculated as 0x200 rounded up to the next page boundary, which is insufficient if 4KB pages are in use. This can lead to the common handler at offset 0x2000 being overwritten and infinitely recursive exceptions on the next exit from the guest. Increase the minimum size from 0x200 to 0x4000 to cover the full use of the page. Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Paolo Bonzini pbonz...@redhat.com Cc: Gleb Natapov g...@kernel.org Cc: kvm@vger.kernel.org Cc: Ralf Baechle r...@linux-mips.org Cc: linux-m...@linux-mips.org Cc: Sanjay Lal sanj...@kymasys.com Signed-off-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/kvm_mips.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index a7b044536de4..b31153969946 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c @@ -303,7 +303,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) if (cpu_has_veic || cpu_has_vint) { size = 0x200 + VECTORSPACING * 64; } else { - size = 0x200; + size = 0x4000; } /* Save Linux EBASE */ -- 2.0.0 -- 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 added to the 3.12 stable tree] MIPS: KVM: Pass reserved instruction exceptions to guest
From: James Hogan james.ho...@imgtec.com This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. === commit 15505679362270d02c449626385cb74af8905514 upstream. Previously a reserved instruction exception while in guest code would cause a KVM internal error if kvm_mips_handle_ri() didn't recognise the instruction (including a RDHWR from an unrecognised hardware register). However the guest OS should really have the opportunity to catch the exception so that it can take the appropriate actions such as sending a SIGILL to the guest user process or emulating the instruction itself. Therefore in these cases emulate a guest RI exception and only return EMULATE_FAIL if that fails, being careful to revert the PC first in case the exception occurred in a branch delay slot in which case the PC will already point to the branch target. Also turn the printk messages relating to these cases into kvm_debug messages so that they aren't usually visible. This allows crashme to run in the guest without killing the entire VM. Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Ralf Baechle r...@linux-mips.org Cc: Gleb Natapov g...@kernel.org Cc: Paolo Bonzini pbonz...@redhat.com Cc: Sanjay Lal sanj...@kymasys.com Cc: linux-m...@linux-mips.org Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/kvm_mips_emul.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c index 4b6274b47f33..e75ef8219caf 100644 --- a/arch/mips/kvm/kvm_mips_emul.c +++ b/arch/mips/kvm/kvm_mips_emul.c @@ -1571,17 +1571,17 @@ kvm_mips_handle_ri(unsigned long cause, uint32_t *opc, arch-gprs[rt] = kvm_read_c0_guest_userlocal(cop0); #else /* UserLocal not implemented */ - er = kvm_mips_emulate_ri_exc(cause, opc, run, vcpu); + er = EMULATE_FAIL; #endif break; default: - printk(RDHWR not supported\n); + kvm_debug(RDHWR %#x not supported @ %p\n, rd, opc); er = EMULATE_FAIL; break; } } else { - printk(Emulate RI not supported @ %p: %#x\n, opc, inst); + kvm_debug(Emulate RI not supported @ %p: %#x\n, opc, inst); er = EMULATE_FAIL; } @@ -1590,6 +1590,7 @@ kvm_mips_handle_ri(unsigned long cause, uint32_t *opc, */ if (er == EMULATE_FAIL) { vcpu-arch.pc = curr_pc; + er = kvm_mips_emulate_ri_exc(cause, opc, run, vcpu); } return er; } -- 1.9.3 -- 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 3.12 131/182] MIPS: KVM: Pass reserved instruction exceptions to guest
From: James Hogan james.ho...@imgtec.com 3.12-stable review patch. If anyone has any objections, please let me know. === commit 15505679362270d02c449626385cb74af8905514 upstream. Previously a reserved instruction exception while in guest code would cause a KVM internal error if kvm_mips_handle_ri() didn't recognise the instruction (including a RDHWR from an unrecognised hardware register). However the guest OS should really have the opportunity to catch the exception so that it can take the appropriate actions such as sending a SIGILL to the guest user process or emulating the instruction itself. Therefore in these cases emulate a guest RI exception and only return EMULATE_FAIL if that fails, being careful to revert the PC first in case the exception occurred in a branch delay slot in which case the PC will already point to the branch target. Also turn the printk messages relating to these cases into kvm_debug messages so that they aren't usually visible. This allows crashme to run in the guest without killing the entire VM. Signed-off-by: James Hogan james.ho...@imgtec.com Cc: Ralf Baechle r...@linux-mips.org Cc: Gleb Natapov g...@kernel.org Cc: Paolo Bonzini pbonz...@redhat.com Cc: Sanjay Lal sanj...@kymasys.com Cc: linux-m...@linux-mips.org Cc: kvm@vger.kernel.org Signed-off-by: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Jiri Slaby jsl...@suse.cz --- arch/mips/kvm/kvm_mips_emul.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c index 4b6274b47f33..e75ef8219caf 100644 --- a/arch/mips/kvm/kvm_mips_emul.c +++ b/arch/mips/kvm/kvm_mips_emul.c @@ -1571,17 +1571,17 @@ kvm_mips_handle_ri(unsigned long cause, uint32_t *opc, arch-gprs[rt] = kvm_read_c0_guest_userlocal(cop0); #else /* UserLocal not implemented */ - er = kvm_mips_emulate_ri_exc(cause, opc, run, vcpu); + er = EMULATE_FAIL; #endif break; default: - printk(RDHWR not supported\n); + kvm_debug(RDHWR %#x not supported @ %p\n, rd, opc); er = EMULATE_FAIL; break; } } else { - printk(Emulate RI not supported @ %p: %#x\n, opc, inst); + kvm_debug(Emulate RI not supported @ %p: %#x\n, opc, inst); er = EMULATE_FAIL; } @@ -1590,6 +1590,7 @@ kvm_mips_handle_ri(unsigned long cause, uint32_t *opc, */ if (er == EMULATE_FAIL) { vcpu-arch.pc = curr_pc; + er = kvm_mips_emulate_ri_exc(cause, opc, run, vcpu); } return er; } -- 1.9.3 -- 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
KVM: WARNING: at .. kvm_release_pfn_clean
Hi, I'm getting this warning while running qemu-kvm 1.2.rc1 on the top of 3.6.0-next-20121001: WARNING: at virt/kvm/kvm_main.c:1325 kvm_release_pfn_clean+0x70/0x80() Hardware name: To Be Filled By O.E.M. Modules linked in: nls_cp437 vfat fat dvb_usb_dib0700 dib0090 dib7000p dib7000m dib0070 dib8000 dib3000mc dibx000_common microcode Pid: 11848, comm: qemu-kvm Tainted: GW 3.6.0-next-20121001_64+ #70 Call Trace: [8107f19f] warn_slowpath_common+0x7f/0xc0 [8107f1fa] warn_slowpath_null+0x1a/0x20 [81004cd0] kvm_release_pfn_clean+0x70/0x80 [81027ac6] paging64_page_fault+0x686/0x830 [81024745] ? paging64_gva_to_gpa+0x35/0x80 [81021121] kvm_mmu_page_fault+0x31/0x100 [81040e81] handle_exception+0x231/0x3d0 [81041fbc] vmx_handle_exit+0xcc/0x780 [8101be44] kvm_arch_vcpu_ioctl_run+0x444/0xf60 [81017117] ? kvm_arch_vcpu_load+0x57/0x1b0 [81005302] kvm_vcpu_ioctl+0x472/0x610 [811aa36b] ? fsnotify+0x24b/0x340 [8117d609] do_vfs_ioctl+0x99/0x580 [810b620b] ? pick_next_task_fair+0x13b/0x1a0 [810b4f68] ? __enqueue_entity+0x78/0x80 [81010114] ? kvm_on_user_return+0x64/0x70 [8117db40] sys_ioctl+0x50/0x90 [816a46e2] system_call_fastpath+0x16/0x1b I.e. is_error_pfn(pfn) is true. regards, -- js suse labs -- 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
Re: qemu-kvm loops after kernel udpate
On 09/13/2012 11:59 AM, Avi Kivity wrote: On 09/12/2012 09:11 PM, Jiri Slaby wrote: On 09/12/2012 10:18 AM, Avi Kivity wrote: On 09/12/2012 11:13 AM, Jiri Slaby wrote: Please provide the output of vmxcap (http://goo.gl/c5lUO), Unrestricted guest no The big real mode fixes. and a snapshot of kvm_stat while the guest is hung. kvm statistics exits 6778198 615942 host_state_reload 1988 187 irq_exits 1523 138 mmu_cache_miss 4 0 fpu_reload 1 0 Please run this as root so we get the tracepoint based output; and press 'x' when it's running so we get more detailed output. kvm statistics kvm_exit 13798699 330708 kvm_entry 13799110 330708 kvm_page_fault13793650 330604 kvm_exit(EXCEPTION_NMI)6188458 330604 kvm_exit(EXTERNAL_INTERRUPT) 2169 105 kvm_exit(TPR_BELOW_THRESHOLD) 82 0 kvm_exit(IO_INSTRUCTION) 6 0 Strange, it's unable to fault in the very first page. I bisected that. Note the bisection log. I have never seen something like that :D: git bisect start git bisect bad 3de9d1a1500472bc80478bd75e33fa9c1eba1422 git bisect good fea7a08acb13524b47711625eebea40a0ede69a0 git bisect good 95a2fe4baa1ad444df5f94bfc9416fc6b4b34cef git bisect good f42c0d57a5a60da03c705bdea9fbba381112dd60 git bisect good 31a2e241a9e37a133278959044960c229acc5714 git bisect good f15fb01c5593fa1b58cc7a8a9c59913e2625bf2e git bisect good 16d21ff46f5d50e311d07406c31f96916e5e8e1a git bisect good 0b84592f458b4e8567aa7d803aff382c1d3b64fd git bisect bad b955428e7f14cd29fe9d8059efa3ea4be679c83d git bisect bad 20c4da4f68fcade05eda9c9b7dbad0a78cc5efe8 git bisect bad 31b90ed2a90f80fb528ac55ee357a815e1dedc36 git bisect bad b273fe14ee5b38cecc7bce94ff35a0bf9ee4 git bisect bad de426dbe9a60706b91b40397f69f819a39a06b6b git bisect bad 6b998094ec50248e72b9f251d0607b58b18dba38 git bisect bad cf9b81d47a89f5d404a0cd8013b461617751e520 === 8 === Reverting cf9b81d47a89 (mm: wrap calls to set_pte_at_notify with invalidate_range_start and invalidate_range_end) on the top of today's -next fixes the issue. thanks, -- js suse labs -- 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
Re: qemu-kvm loops after kernel udpate
On 09/13/2012 11:59 AM, Avi Kivity wrote: On 09/12/2012 09:11 PM, Jiri Slaby wrote: On 09/12/2012 10:18 AM, Avi Kivity wrote: On 09/12/2012 11:13 AM, Jiri Slaby wrote: Please provide the output of vmxcap (http://goo.gl/c5lUO), Unrestricted guest no The big real mode fixes. and a snapshot of kvm_stat while the guest is hung. kvm statistics exits 6778198 615942 host_state_reload 1988 187 irq_exits 1523 138 mmu_cache_miss 4 0 fpu_reload 1 0 Please run this as root so we get the tracepoint based output; and press 'x' when it's running so we get more detailed output. kvm statistics kvm_exit 13798699 330708 kvm_entry 13799110 330708 kvm_page_fault13793650 330604 kvm_exit(EXCEPTION_NMI)6188458 330604 kvm_exit(EXTERNAL_INTERRUPT) 2169 105 kvm_exit(TPR_BELOW_THRESHOLD) 82 0 kvm_exit(IO_INSTRUCTION) 6 0 Strange, it's unable to fault in the very first page. Please provide a trace as per http://www.linux-kvm.org/page/Tracing (but append -e kvmmmu to the command line). Attached. Does it make sense? It wrote things like: failed to read event print fmt for kvm_mmu_unsync_page to the stderr. thanks, -- js suse labs version = 6 CPU 0 is empty cpus=2 qemu-kvm-6170 [001] 457.811896: kvm_mmu_get_page: [FAILED TO PARSE] gfn=0 role=122882 root_count=0 unsync=0 created=1 qemu-kvm-6170 [001] 457.811899: kvm_mmu_get_page: [FAILED TO PARSE] gfn=262144 role=122882 root_count=0 unsync=0 created=1 qemu-kvm-6170 [001] 457.811900: kvm_mmu_get_page: [FAILED TO PARSE] gfn=524288 role=122882 root_count=0 unsync=0 created=1 qemu-kvm-6170 [001] 457.811902: kvm_mmu_get_page: [FAILED TO PARSE] gfn=786432 role=122882 root_count=0 unsync=0 created=1 qemu-kvm-6171 [001] 462.416705: kvm_mmu_prepare_zap_page: [FAILED TO PARSE] gfn=786432 role=122882 root_count=1 unsync=0 qemu-kvm-6171 [001] 462.416712: kvm_mmu_prepare_zap_page: [FAILED TO PARSE] gfn=524288 role=122882 root_count=1 unsync=0 qemu-kvm-6171 [001] 462.416715: kvm_mmu_prepare_zap_page: [FAILED TO PARSE] gfn=262144 role=122882 root_count=1 unsync=0 qemu-kvm-6171 [001] 462.416717: kvm_mmu_prepare_zap_page: [FAILED TO PARSE] gfn=0 role=122882 root_count=1 unsync=0 qemu-kvm-6171 [001] 462.485197: kvm_mmu_prepare_zap_page: [FAILED TO PARSE] gfn=0 role=253954 root_count=0 unsync=0 qemu-kvm-6171 [001] 462.485202: kvm_mmu_prepare_zap_page: [FAILED TO PARSE] gfn=262144 role=253954 root_count=0 unsync=0 qemu-kvm-6171 [001] 462.485205: kvm_mmu_prepare_zap_page: [FAILED TO PARSE] gfn=524288 role=253954 root_count=0 unsync=0 qemu-kvm-6171 [001] 462.485209: kvm_mmu_prepare_zap_page: [FAILED TO PARSE] gfn=786432 role=253954 root_count=0 unsync=0
Re: qemu-kvm loops after kernel udpate
On 09/12/2012 10:06 AM, Avi Kivity wrote: On 09/11/2012 10:41 PM, Jiri Slaby wrote: On 09/11/2012 09:03 PM, Marcelo Tosatti wrote: On Tue, Sep 11, 2012 at 08:11:36PM +0200, Jiri Slaby wrote: Hi, it looks like an update from next-20120824 to next-20120910 makes kvm defunct. When I try to run qemu, it loops forever without printing anything on the monitor. -no-kvm makes it indeed work. Cmdline I use: qemu-kvm -k en-us -usbdevice tablet -balloon virtio -hda IMAGE -smp 2 -m 1000M -net user -net nic,model=e1000 -usb -serial pty Before I start investigating further, like biscection, is this a known issue already and fix available somewhere? Its not a known issue. 'info registers' (for both vcpus) and 'x /20i $eip' might help track it down. I don't think it's in a state with something loaded. (qemu) cpu 0 (qemu) info registers EAX= EBX= ECX= EDX=0623 ESI= EDI= EBP= ESP= EIP=fff0 EFL=00010002 [---] CPL=3 II=0 A20=1 SMM=0 HLT=0 ES = 9300 CS =f000 000f f300 This is before the first instruction is executed. You're on an Intel host, yes? Yes. processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Core(TM)2 Duo CPU E6850 @ 3.00GHz stepping: 11 microcode : 0xba ... flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts nopl aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm lahf_lm dtherm tpr_shadow vnmi flexpriority Please provide the output of vmxcap (http://goo.gl/c5lUO), pin-based controls External interrupt exiting yes NMI exiting yes Virtual NMIs yes Activate VMX-preemption timerno primary processor-based controls Interrupt window exiting yes Use TSC offsetting yes HLT exiting yes INVLPG exiting yes MWAIT exitingyes RDPMC exitingyes RDTSC exitingyes CR3-load exiting forced CR3-store exitingforced CR8-load exiting yes CR8-store exitingyes Use TPR shadow yes NMI-window exiting yes MOV-DR exiting yes Unconditional I/O exitingyes Use I/O bitmaps yes Monitor trap flagno Use MSR bitmaps yes MONITOR exiting yes PAUSE exitingyes Activate secondary control yes secondary processor-based controls Virtualize APIC accesses yes Enable EPT no Descriptor-table exiting no Virtualize x2APIC mode no Enable VPID no WBINVD exiting no Unrestricted guest no PAUSE-loop exiting no RDRAND exiting no Enable INVPCID no Enable VM functions no VM-Exit controls Save debug controls forced Host address-space size yes Load IA32_PERF_GLOBAL_CTRL no Acknowledge interrupt on exityes Save IA32_PATno Load IA32_PATno Save IA32_EFER no Load IA32_EFER no Save VMX-preemption timer value no VM-Entry controls Load debug controls forced IA-64 mode guest yes Entry to SMM yes Deactivate dual-monitor treatmentyes Load IA32_PERF_GLOBAL_CTRL no Load IA32_PATno Load IA32_EFER no Miscellaneous data VMX-preemption timer scale (log2)0 Store EFER.LMA into IA-32e mode guest control no HLT activity state yes Shutdown activity state yes Wait-for-SIPI activity state yes Number of CR3-target values 4 MSR-load/store count recommenation 0 IA32_SMM_MONITOR_CTL[2] can be set to 1 no MSEG revision identifier 0 VPID and EPT capabilities Execute-only EPT translationsno Page-walk length 4 no Paging-structure memory type UC no Paging-structure memory type WB no 2MB EPT pages
Re: qemu-kvm loops after kernel udpate
On 09/12/2012 10:18 AM, Avi Kivity wrote: On 09/12/2012 11:13 AM, Jiri Slaby wrote: kvm statistics exits 6778198 615942 host_state_reload 1988 187 irq_exits 1523 138 mmu_cache_miss 4 0 fpu_reload 1 0 Please run this as root so we get the tracepoint based output; and press 'x' when it's running so we get more detailed output. I need to build a kernel with trace points enabled first... I will return later today. thanks, -- js suse labs -- 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
Re: qemu-kvm loops after kernel udpate
On 09/12/2012 10:18 AM, Avi Kivity wrote: On 09/12/2012 11:13 AM, Jiri Slaby wrote: Please provide the output of vmxcap (http://goo.gl/c5lUO), Unrestricted guest no The big real mode fixes. and a snapshot of kvm_stat while the guest is hung. kvm statistics exits 6778198 615942 host_state_reload 1988 187 irq_exits 1523 138 mmu_cache_miss 4 0 fpu_reload 1 0 Please run this as root so we get the tracepoint based output; and press 'x' when it's running so we get more detailed output. kvm statistics kvm_exit 13798699 330708 kvm_entry 13799110 330708 kvm_page_fault13793650 330604 kvm_exit(EXCEPTION_NMI)6188458 330604 kvm_exit(EXTERNAL_INTERRUPT) 2169 105 kvm_exit(TPR_BELOW_THRESHOLD) 82 0 kvm_exit(IO_INSTRUCTION) 6 0 kvm_exit(PAUSE_INSTRUCTION) 5 0 kvm_exit(MCE_DURING_VMENTRY) 5 0 kvm_exit(DR_ACCESS) 5 0 kvm_exit(VMPTRLD)5 0 kvm_exit(VMLAUNCH) 5 0 kvm_exit(INVLPG) 5 0 kvm_exit(VMCALL) 5 0 kvm_exit(WBINVD) 5 0 kvm_exit(MONITOR_INSTRUCTION)5 0 kvm_exit(MWAIT_INSTRUCTION) 4 0 kvm_exit(NMI_WINDOW) 4 0 kvm_exit(VMREAD) 4 0 kvm_exit(XSETBV) 4 0 kvm_exit(RDPMC) 4 0 kvm_exit(CPUID) 4 0 kvm_exit(VMCLEAR)4 0 kvm_exit(PENDING_INTERRUPT) 4 0 kvm_exit(VMRESUME) 4 0 kvm_exit(APIC_ACCESS)4 0 kvm_exit(INVALID_STATE) 4 0 kvm_exit(MSR_READ) 4 0 kvm_exit(VMOFF) 4 0 kvm_exit(RDTSC) 4 0 kvm_exit(MSR_WRITE) 4 0 kvm_exit(VMPTRST)4 0 kvm_exit(VMWRITE)4 0 kvm_exit(HLT)3 0 kvm_exit(EPT_VIOLATION) 3 0 kvm_exit(TASK_SWITCH)3 0 kvm_exit(CR_ACCESS) 3 0 kvm_exit(TRIPLE_FAULT) 3 0 kvm_exit(VMON) 3 0 kvm_exit(EPT_MISCONFIG) 3 0 thanks, -- js suse labs -- 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
Re: qemu-kvm loops after kernel udpate
On 09/11/2012 09:03 PM, Marcelo Tosatti wrote: On Tue, Sep 11, 2012 at 08:11:36PM +0200, Jiri Slaby wrote: Hi, it looks like an update from next-20120824 to next-20120910 makes kvm defunct. When I try to run qemu, it loops forever without printing anything on the monitor. -no-kvm makes it indeed work. Cmdline I use: qemu-kvm -k en-us -usbdevice tablet -balloon virtio -hda IMAGE -smp 2 -m 1000M -net user -net nic,model=e1000 -usb -serial pty Before I start investigating further, like biscection, is this a known issue already and fix available somewhere? Its not a known issue. 'info registers' (for both vcpus) and 'x /20i $eip' might help track it down. I don't think it's in a state with something loaded. (qemu) cpu 0 (qemu) info registers EAX= EBX= ECX= EDX=0623 ESI= EDI= EBP= ESP= EIP=fff0 EFL=00010002 [---] CPL=3 II=0 A20=1 SMM=0 HLT=0 ES = 9300 CS =f000 000f f300 SS = f300 DS = 9300 FS = 9300 GS = 9300 LDT= 8200 TR = 8b00 GDT= IDT= CR0=6010 CR2= CR3= CR4= DR0= DR1= DR2= DR3= DR6=0ff0 DR7=0400 EFER= FCW=037f FSW= [ST=0] FTW=00 MXCSR=1f80 FPR0= FPR1= FPR2= FPR3= FPR4= FPR5= FPR6= FPR7= XMM00= XMM01= XMM02= XMM03= XMM04= XMM05= XMM06= XMM07= (qemu) cpu 1 (qemu) info registers EAX= EBX= ECX= EDX=0623 ESI= EDI= EBP= ESP= EIP=fff0 EFL=0002 [---] CPL=3 II=0 A20=1 SMM=0 HLT=0 ES = 9300 CS =f000 000f f300 SS = f300 DS = 9300 FS = 9300 GS = 9300 LDT= 8200 TR = 8b00 GDT= IDT= CR0=6010 CR2= CR3= CR4= DR0= DR1= DR2= DR3= DR6=0ff0 DR7=0400 EFER= FCW=037f FSW= [ST=0] FTW=00 MXCSR=1f80 FPR0= FPR1= FPR2= FPR3= FPR4= FPR5= FPR6= FPR7= XMM00= XMM01= XMM02= XMM03= XMM04= XMM05= XMM06= XMM07= (qemu) x /20i $eip 0xfff0: add%al,(%bx,%si) 0xfff2: add%al,(%bx,%si) 0xfff4: add%al,(%bx,%si) 0xfff6: add%al,(%bx,%si) 0xfff8: add%al,(%bx,%si) 0xfffa: add%al,(%bx,%si) 0xfffc: add%al,(%bx,%si) 0xfffe: add%al,(%bx,%si) 0x0001: add%al,(%bx,%si) 0x00010002: add%al,(%bx,%si) 0x00010004: add%al,(%bx,%si) 0x00010006: add%al,(%bx,%si) 0x00010008: add%al,(%bx,%si) 0x0001000a: add%al,(%bx,%si) 0x0001000c: add%al,(%bx,%si) 0x0001000e: add%al,(%bx,%si) 0x00010010: add%al,(%bx,%si) 0x00010012: add%al,(%bx,%si) 0x00010014: add%al,(%bx,%si) 0x00010016: add%al,(%bx,%si) thanks, -- js suse labs -- 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
qemu-kvm defunct due to THP [was: mmotm 2011-01-06-15-41 uploaded]
On 01/07/2011 12:41 AM, a...@linux-foundation.org wrote: The mm-of-the-moment snapshot 2011-01-06-15-41 has been uploaded to Hi, something of the following breaks qemu-kvm: thp-add-pmd-mangling-generic-functions.patch thp-add-pmd-mangling-generic-functions-fix-pgtableh-build-for-um.patch thp-add-pmd-mangling-functions-to-x86.patch thp-bail-out-gup_fast-on-splitting-pmd.patch thp-pte-alloc-trans-splitting.patch thp-pte-alloc-trans-splitting-fix.patch thp-pte-alloc-trans-splitting-fix-checkpatch-fixes.patch thp-add-pmd-mmu_notifier-helpers.patch thp-clear-page-compound.patch thp-add-pmd_huge_pte-to-mm_struct.patch thp-split_huge_page_mm-vma.patch thp-split_huge_page-paging.patch thp-clear_copy_huge_page.patch thp-kvm-mmu-transparent-hugepage-support.patch thp-_gfp_no_kswapd.patch thp-dont-alloc-harder-for-gfp-nomemalloc-even-if-nowait.patch thp-transparent-hugepage-core.patch thp-split_huge_page-anon_vma-ordering-dependency.patch thp-verify-pmd_trans_huge-isnt-leaking.patch thp-madvisemadv_hugepage.patch thp-add-pagetranscompound.patch thp-pmd_trans_huge-migrate-bugcheck.patch thp-memcg-compound.patch thp-transhuge-memcg-commit-tail-pages-at-charge.patch thp-memcg-huge-memory.patch thp-transparent-hugepage-vmstat.patch thp-khugepaged.patch thp-khugepaged-vma-merge.patch thp-skip-transhuge-pages-in-ksm-for-now.patch thp-remove-pg_buddy.patch thp-add-x86-32bit-support.patch thp-mincore-transparent-hugepage-support.patch thp-add-pmd_modify.patch thp-mprotect-pass-vma-down-to-page-table-walkers.patch thp-mprotect-transparent-huge-page-support.patch thp-set-recommended-min-free-kbytes.patch thp-enable-direct-defrag.patch thp-add-numa-awareness-to-hugepage-allocations.patch thp-allocate-memory-in-khugepaged-outside-of-mmap_sem-write-mode.patch thp-allocate-memory-in-khugepaged-outside-of-mmap_sem-write-mode-fix.patch thp-transparent-hugepage-config-choice.patch thp-select-config_compaction-if-transparent_hugepage-enabled.patch thp-transhuge-isolate_migratepages.patch thp-avoid-breaking-huge-pmd-invariants-in-case-of-vma_adjust-failures.patch thp-dont-allow-transparent-hugepage-support-without-pse.patch thp-mmu_notifier_test_young.patch thp-freeze-khugepaged-and-ksmd.patch thp-use-compaction-in-kswapd-for-gfp_atomic-order-0.patch thp-use-compaction-for-all-allocation-orders.patch thp-disable-transparent-hugepages-by-default-on-small-systems.patch thp-fix-anon-memory-statistics-with-transparent-hugepages.patch thp-scale-nr_rotated-to-balance-memory-pressure.patch thp-transparent-hugepage-sysfs-meminfo.patch thp-add-debug-checks-for-mapcount-related-invariants.patch thp-fix-memory-failure-hugetlbfs-vs-thp-collision.patch thp-compound_trans_order.patch thp-compound_trans_order-fix.patch thp-mm-define-madv_nohugepage.patch thp-madvisemadv_nohugepage.patch thp-khugepaged-make-khugepaged-aware-of-madvise.patch thp-khugepaged-make-khugepaged-aware-of-madvise-fix.patch The series is unbisectable, build errors occur. It needs to be fixed too. The kernel complains: BUG: Bad page state in process qemu-kvm pfn:1bec05 page:ea00061ba118 count:1883770 mapcount:0 mapping: (null) index:0x0 page flags: 0x80008000(tail) Pid: 4221, comm: qemu-kvm Not tainted 2.6.37-mm1_64 #2 Call Trace: [810cefcb] ? bad_page+0xab/0x120 [810cf4a1] ? free_pages_prepare+0xa1/0xd0 [810cfebd] ? __free_pages_ok+0x2d/0xc0 [810cff66] ? free_compound_page+0x16/0x20 [810d44f7] ? __put_compound_page+0x17/0x20 [810d4578] ? put_compound_page+0x48/0x170 [810d49ae] ? release_pages+0x24e/0x260 [810f757d] ? free_pages_and_swap_cache+0x8d/0xb0 [81108b30] ? zap_huge_pmd+0x130/0x1b0 [810e9877] ? unmap_vmas+0x877/0xbb0 [810ec14a] ? exit_mmap+0xda/0x170 [810697fa] ? mmput+0x4a/0x110 [8106e11b] ? exit_mm+0x12b/0x170 [81070299] ? do_exit+0x6d9/0x820 [810973cc] ? futex_wake+0x10c/0x130 [81070423] ? do_group_exit+0x43/0xb0 [8107c59a] ? get_signal_to_deliver+0x1ba/0x390 [8103028f] ? do_notify_resume+0xef/0x850 [8107aae3] ? dequeue_signal+0x93/0x160 [8107add7] ? sys_rt_sigtimedwait+0x227/0x230 [81099cce] ? sys_futex+0x7e/0x150 [8103101b] ? int_signal+0x12/0x17 regards, -- js -- 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
Re: qemu-kvm defunct due to THP [was: mmotm 2011-01-06-15-41 uploaded]
On 01/10/2011 04:01 PM, Andrea Arcangeli wrote: On Mon, Jan 10, 2011 at 03:37:57PM +0100, Jiri Slaby wrote: On 01/07/2011 12:41 AM, a...@linux-foundation.org wrote: The mm-of-the-moment snapshot 2011-01-06-15-41 has been uploaded to Hi, something of the following breaks qemu-kvm: Thanks for the report. It's already fixed and I posted this a few days ago to linux-mm. I had to rewrite the KVM THP support when merging THP in -mm, because the kvm code in -mm has async page faults and doing so I eliminated one gfn_to_page lookup for each kvm secondary mmu page fault. But first new attempt wasn't entirely successful ;), the below incremental fix should work. Please test it and let me know if any trouble is left. Also note again on linux-mm I posted two more patches, I recommend to apply the other two as well. The second adds KSM THP support, the third cleanup some code but I like to have it tested. Thanks a lot, Andrea Subject: thp: fix for KVM THP support From: Andrea Arcangeli aarca...@redhat.com There were several bugs: dirty_bitmap ignored (migration shutoff largepages), has_wrprotect_page(directory_level) ignored, refcount taken on tail page and refcount released on pfn head page post-adjustment (now it's being transferred during the adjustment, that's where KSM over THP tripped inside split_huge_page, the rest I found it by code review). Signed-off-by: Andrea Arcangeli aarca...@redhat.com --- arch/x86/kvm/mmu.c | 97 - arch/x86/kvm/paging_tmpl.h | 10 +++- 2 files changed, 79 insertions(+), 28 deletions(-) Yup, this works for me. If you point me to the other 2, I will test them too... thanks, -- js -- 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] x86: KVM, fix lock imbalance
Stanse found that there is an omitted unlock in kvm_create_pit in one fail path. Add proper unlock there. Signed-off-by: Jiri Slaby jirisl...@gmail.com Cc: Avi Kivity a...@redhat.com Cc: Marcelo Tosatti mtosa...@redhat.com Cc: Thomas Gleixner t...@linutronix.de Cc: Ingo Molnar mi...@redhat.com Cc: H. Peter Anvin h...@zytor.com Cc: x...@kernel.org Cc: Gleb Natapov g...@redhat.com Cc: Michael S. Tsirkin m...@redhat.com Cc: Gregory Haskins ghask...@novell.com Cc: kvm@vger.kernel.org --- arch/x86/kvm/i8254.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 467cc47..70db4d4 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c @@ -696,6 +696,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags) pit-wq = create_singlethread_workqueue(kvm-pit-wq); if (!pit-wq) { + mutex_unlock(pit-pit_state.lock); kfree(pit); return NULL; } -- 1.7.1 -- 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
Re: [PATCH] x86: KVM, fix lock imbalance
On 07/07/2010 03:05 PM, Ingo Molnar wrote: * Jiri Slaby jirisl...@gmail.com wrote: Stanse found that there is an omitted unlock in kvm_create_pit in one fail path. Add proper unlock there. Signed-off-by: Jiri Slaby jirisl...@gmail.com Cc: Avi Kivity a...@redhat.com Cc: Marcelo Tosatti mtosa...@redhat.com Cc: Thomas Gleixner t...@linutronix.de Cc: Ingo Molnar mi...@redhat.com Cc: H. Peter Anvin h...@zytor.com Cc: x...@kernel.org Cc: Gleb Natapov g...@redhat.com Cc: Michael S. Tsirkin m...@redhat.com Cc: Gregory Haskins ghask...@novell.com Cc: kvm@vger.kernel.org --- arch/x86/kvm/i8254.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 467cc47..70db4d4 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c @@ -696,6 +696,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags) pit-wq = create_singlethread_workqueue(kvm-pit-wq); if (!pit-wq) { +mutex_unlock(pit-pit_state.lock); kfree(pit); return NULL; } A cleanliness comment: why is that tear-down/dealloc sequence open-coded? It should be at the end of the function, with goto labels, like we do it in similar cases. Because the lock is around a block only. I usually don't create a goto fail-paths in these cases. Do you want one? thanks, -- js -- 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
Re: [PATCH] x86: KVM, fix lock imbalance
On 07/07/2010 03:07 PM, Jiri Slaby wrote: --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c @@ -696,6 +696,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags) pit-wq = create_singlethread_workqueue(kvm-pit-wq); if (!pit-wq) { + mutex_unlock(pit-pit_state.lock); kfree(pit); return NULL; } A cleanliness comment: why is that tear-down/dealloc sequence open-coded? It should be at the end of the function, with goto labels, like we do it in similar cases. Because the lock is around a block only. I usually don't create a goto fail-paths in these cases. To be more precise what I mean by that: if () return; lock(); ... if () { [single if inside the crit section] unlock(); return; } ... unlock() ... if () return; ... if () return; -- js -- 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
WARNING: kernel/smp.c:292 smp_call_function_single [Was: mmotm 2009-11-24-16-47 uploaded]
On 11/25/2009 01:47 AM, a...@linux-foundation.org wrote: The mm-of-the-moment snapshot 2009-11-24-16-47 has been uploaded to Hi, when executing qemu-kvm I often get following warning and a hard lockup. WARNING: at kernel/smp.c:292 smp_call_function_single+0xbd/0x140() Hardware name: To Be Filled By O.E.M. Modules linked in: kvm_intel kvm fuse ath5k ath Pid: 3265, comm: qemu-kvm Not tainted 2.6.32-rc8-mm1_64 #912 Call Trace: [81039678] warn_slowpath_common+0x78/0xb0 [a007fd50] ? __vcpu_clear+0x0/0xd0 [kvm_intel] [810396bf] warn_slowpath_null+0xf/0x20 [8106410d] smp_call_function_single+0xbd/0x140 [a0080af6] vmx_vcpu_load+0x46/0x170 [kvm_intel] [a004dd94] kvm_arch_vcpu_load+0x24/0x60 [kvm] [a0047a8d] kvm_sched_in+0xd/0x10 [kvm] [8102de37] finish_task_switch+0x67/0xc0 [814699f8] schedule+0x2f8/0x9c0 [a0063538] ? kvm_apic_has_interrupt+0x48/0x90 [kvm] [a0062a58] ? kvm_cpu_has_interrupt+0x58/0x70 [kvm] [a0047c9d] kvm_vcpu_block+0x6d/0xb0 [kvm] [81050f60] ? autoremove_wake_function+0x0/0x40 [a0055a5a] kvm_arch_vcpu_ioctl_run+0x3fa/0xb80 [kvm] [a0049955] kvm_vcpu_ioctl+0x435/0x590 [kvm] [8102f4ce] ? enqueue_entity+0x6e/0xe0 [8102f5eb] ? enqueue_task_fair+0x3b/0x80 [8102f6c3] ? task_new_fair+0x93/0x120 [810cd848] vfs_ioctl+0x38/0xd0 [810cdd8a] do_vfs_ioctl+0x8a/0x5a0 [81062926] ? sys_futex+0xc6/0x170 [810ce2ea] sys_ioctl+0x4a/0x80 [81002eeb] system_call_fastpath+0x16/0x1b ---[ end trace ced05997e63d4d13 ]--- It is a regression against 2009-11-13-19-59. Any ideas? thanks, -- js -- 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
vga_arb warning [was: mmotm 2009-11-01-10-01 uploaded]
On 11/01/2009 07:07 PM, a...@linux-foundation.org wrote: The mm-of-the-moment snapshot 2009-11-01-10-01 has been uploaded to Hi, I got the following warning while booting an image in qemu-kvm: WARNING: at fs/attr.c:158 notify_change+0x2da/0x310() Hardware name: Modules linked in: Pid: 1, comm: swapper Not tainted 2.6.32-rc5-mm1_64 #862 Call Trace: [81038008] warn_slowpath_common+0x78/0xb0 [8103804f] warn_slowpath_null+0xf/0x20 [810d32ba] notify_change+0x2da/0x310 [810c5b88] ? fsnotify_create+0x48/0x60 [810c6d2b] ? vfs_mknod+0xbb/0xe0 [812487b6] devtmpfs_create_node+0x1e6/0x270 [811170d0] ? sysfs_addrm_finish+0x20/0x280 [811175d6] ? __sysfs_add_one+0x26/0xf0 [81117b6c] ? sysfs_do_create_link+0xcc/0x160 [81241cf0] device_add+0x1e0/0x5b0 [8124adb1] ? pm_runtime_init+0xa1/0xb0 [81248f05] ? device_pm_init+0x65/0x70 [812420d9] device_register+0x19/0x20 [81242290] device_create_vargs+0xf0/0x120 [812422ec] device_create+0x2c/0x30 [810c0516] ? __register_chrdev+0x86/0xf0 [81245599] ? __class_create+0x69/0xa0 [814326e9] ? mutex_lock+0x19/0x50 [811d4e23] misc_register+0x93/0x170 [818994a0] ? vga_arb_device_init+0x0/0x77 [818994b3] vga_arb_device_init+0x13/0x77 [818994a0] ? vga_arb_device_init+0x0/0x77 [810001e7] do_one_initcall+0x37/0x190 [8187d6ce] kernel_init+0x172/0x1c8 [81003c7a] child_rip+0xa/0x20 [8187d55c] ? kernel_init+0x0/0x1c8 [81003c70] ? child_rip+0x0/0x20 ---[ end trace 4eaa2a86a8e2da22 ]--- -- 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
[was: mmotm 2009-10-09-01-07 uploaded]
On 10/09/2009 10:07 AM, a...@linux-foundation.org wrote: The mm-of-the-moment snapshot 2009-10-09-01-07 has been uploaded to Hi, build fails with: ERROR: cpufreq_get [arch/x86/kvm/kvm.ko] undefined! because of CONFIG_KVM=m ... # CONFIG_CPU_FREQ is not set Should cpufreq_get be defined as inline return 0 the same as cpufreq_quick_get on !CONFIG_CPU_FREQ? -- 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
Re: kvm build failure [was: mmotm 2009-10-09-01-07 uploaded]
On 10/09/2009 05:30 PM, Randy Dunlap wrote: I submitted a patch for that several days ago, against linux-next-20091006. (below again) Thanks! -- 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/1] KVM: fix lock imbalance
Stanse found 2 lock imbalances in kvm_request_irq_source_id and kvm_free_irq_source_id. They omit to unlock kvm-irq_lock on fail paths. Fix that by adding unlock labels at the end of the functions and jump there from the fail paths. Signed-off-by: Jiri Slaby jirisl...@gmail.com Cc: Avi Kivity a...@redhat.com Cc: Marcelo Tosatti mtosa...@redhat.com --- virt/kvm/irq_comm.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c index 15a83b9..00c68d2 100644 --- a/virt/kvm/irq_comm.c +++ b/virt/kvm/irq_comm.c @@ -220,11 +220,13 @@ int kvm_request_irq_source_id(struct kvm *kvm) if (irq_source_id = sizeof(kvm-arch.irq_sources_bitmap)) { printk(KERN_WARNING kvm: exhaust allocatable IRQ sources!\n); - return -EFAULT; + irq_source_id = -EFAULT; + goto unlock; } ASSERT(irq_source_id != KVM_USERSPACE_IRQ_SOURCE_ID); set_bit(irq_source_id, bitmap); +unlock: mutex_unlock(kvm-irq_lock); return irq_source_id; @@ -240,7 +242,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id) if (irq_source_id 0 || irq_source_id = sizeof(kvm-arch.irq_sources_bitmap)) { printk(KERN_ERR kvm: IRQ source ID out of range!\n); - return; + goto unlock; } for (i = 0; i KVM_IOAPIC_NUM_PINS; i++) { clear_bit(irq_source_id, kvm-arch.vioapic-irq_states[i]); @@ -251,6 +253,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id) #endif } clear_bit(irq_source_id, kvm-arch.irq_sources_bitmap); +unlock: mutex_unlock(kvm-irq_lock); } -- 1.6.4.2 -- 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] KVM: fix lock imbalance
There is a missing unlock on one fail path in ioapic_mmio_write, fix that. Signed-off-by: Jiri Slaby jirisl...@gmail.com --- virt/kvm/ioapic.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index d8b2eca..2b3307b 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c @@ -290,7 +290,7 @@ static void ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len, data = *(u32 *) val; else { printk(KERN_WARNING ioapic: Unsupported size %d\n, len); - return; + goto unlock; } addr = 0xff; @@ -311,6 +311,7 @@ static void ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len, default: break; } +unlock: mutex_unlock(ioapic-kvm-irq_lock); } -- 1.6.3.2 -- 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
Re: [PATCH] virtio: make PCI devices take a virtio_pci module ref
Michael Tokarev napsal(a): Jiri Slaby wrote: On 12/04/2008 01:44 PM, Mark McLoughlin wrote: Nothing takes a ref on virtio_pci, so even if you have devices in use, rmmod will attempt to unload the module. It unbinds the device properly as any other driver. So what's the problem here? Here's what we get when rmmod'ing (a zero-refcounted but in use) virtio_pci (I did it by a chance, cut-n-pasted the wrong line): WARNING: at drivers/base/core.c:122 device_release+0x5f/0x70() Device 'virtio1' does not have a release() function, it is broken and must be fixed. Modules linked in: ext3 jbd mbcache acpiphp dock pci_hotplug virtio_net virtio_blk virtio_pci(-) virtio_ring virtio Pid: 361, comm: rmmod Tainted: G S2.6.27-i686smp #2.6.27.7 [c012b81f] warn_slowpath+0x6f/0xa0 [c0110030] prepare_set+0x30/0x80 [c012067e] __wake_up+0x3e/0x60 [c01d1d25] release_sysfs_dirent+0x45/0xb0 ... So why don't you fix the root cause and add such a crap into the probe function (not even counting probe can fail later)? Fix the virtio bus instead. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] virtio: make PCI devices take a virtio_pci module ref
Mark McLoughlin wrote: Fix the virtio bus instead. Yeah, the patch I posted wasn't meant as a fix for this traceback. So what's the module_get patch needed for? Here's one that does fix it. ... From: Mark McLoughlin [EMAIL PROTECTED] Subject: [PATCH] virtio: add device release() function Add a release() function for virtio_pci devices so as to avoid: Device 'virtio0' does not have a release() function, it is broken and must be fixed The struct device is embedded in the struct virtio_pci_device which is freed by virtio_pci_remove(), so virtio_pci_release_dev() need not actually do anything. Signed-off-by: Mark McLoughlin [EMAIL PROTECTED] --- drivers/virtio/virtio_pci.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index c7dc37c..7d4899c 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c @@ -70,12 +70,17 @@ static struct pci_device_id virtio_pci_id_table[] = { MODULE_DEVICE_TABLE(pci, virtio_pci_id_table); +static void virtio_pci_release_dev(struct device *dev) +{ +} You have to have a strong reason to have empty release. This is not the case, you should do the free here, not in remove, I suppose. @@ -328,6 +333,7 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev, return -ENOMEM; vp_dev-vdev.dev.parent = virtio_pci_root; + vp_dev-vdev.dev.release = virtio_pci_release_dev; This should rather be in register_virtio_device -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] virtio: make PCI devices take a virtio_pci module ref
Anthony Liguori napsal(a): Actually, we should be able to delete this virtio_pci_root entirely. The device is a dummy one anyway. But the bus is still to be fixed... -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] virtio: make PCI devices take a virtio_pci module ref
On 12/04/2008 01:44 PM, Mark McLoughlin wrote: Nothing takes a ref on virtio_pci, so even if you have devices in use, rmmod will attempt to unload the module. It unbinds the device properly as any other driver. So what's the problem here? Fix by simply making each device take a ref on the module. Signed-off-by: Mark McLoughlin [EMAIL PROTECTED] Reported-by: Michael Tokarev [EMAIL PROTECTED] --- drivers/virtio/virtio_pci.c |4 1 files changed, 4 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html