aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2010-07-10 05:37:56 -0400
committerAvi Kivity <avi@redhat.com>2010-08-01 23:40:35 -0400
commitaea924f606c309feead37ab5c43f410a08ff3826 (patch)
tree6d409eb035985ebcec3d16b0410706d3e8fcf184 /arch/x86
parenta6f177efaa5856e22ed0d3c1e81e65b41654d083 (diff)
KVM: PIT: stop vpit before freeing irq_routing
Fix: general protection fault: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC ...... Call Trace: [<ffffffffa0159bd1>] ? kvm_set_irq+0xdd/0x24b [kvm] [<ffffffff8106ea8b>] ? trace_hardirqs_off_caller+0x1f/0x10e [<ffffffff813ad17f>] ? sub_preempt_count+0xe/0xb6 [<ffffffff8106d273>] ? put_lock_stats+0xe/0x27 ... RIP [<ffffffffa0159c72>] kvm_set_irq+0x17e/0x24b [kvm] This bug is triggered when guest is shutdown, is because we freed irq_routing before pit thread stopped Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/i8254.c3
-rw-r--r--arch/x86/kvm/x86.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 70db4d435393..0fd6378981f4 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -752,6 +752,9 @@ void kvm_free_pit(struct kvm *kvm)
752 struct hrtimer *timer; 752 struct hrtimer *timer;
753 753
754 if (kvm->arch.vpit) { 754 if (kvm->arch.vpit) {
755 kvm_io_bus_unregister_dev(kvm, KVM_PIO_BUS, &kvm->arch.vpit->dev);
756 kvm_io_bus_unregister_dev(kvm, KVM_PIO_BUS,
757 &kvm->arch.vpit->speaker_dev);
755 kvm_unregister_irq_mask_notifier(kvm, 0, 758 kvm_unregister_irq_mask_notifier(kvm, 0,
756 &kvm->arch.vpit->mask_notifier); 759 &kvm->arch.vpit->mask_notifier);
757 kvm_unregister_irq_ack_notifier(kvm, 760 kvm_unregister_irq_ack_notifier(kvm,
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index d51eed239b47..d721e2d81a53 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5523,12 +5523,12 @@ static void kvm_free_vcpus(struct kvm *kvm)
5523void kvm_arch_sync_events(struct kvm *kvm) 5523void kvm_arch_sync_events(struct kvm *kvm)
5524{ 5524{
5525 kvm_free_all_assigned_devices(kvm); 5525 kvm_free_all_assigned_devices(kvm);
5526 kvm_free_pit(kvm);
5526} 5527}
5527 5528
5528void kvm_arch_destroy_vm(struct kvm *kvm) 5529void kvm_arch_destroy_vm(struct kvm *kvm)
5529{ 5530{
5530 kvm_iommu_unmap_guest(kvm); 5531 kvm_iommu_unmap_guest(kvm);
5531 kvm_free_pit(kvm);
5532 kfree(kvm->arch.vpic); 5532 kfree(kvm->arch.vpic);
5533 kfree(kvm->arch.vioapic); 5533 kfree(kvm->arch.vioapic);
5534 kvm_free_vcpus(kvm); 5534 kvm_free_vcpus(kvm);