From: Peter Xu <peterx@redhat.com>
To: kvm@vger.kernel.org
Cc: "David Hildenbrand" <david@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
peterx@redhat.com, "Radim Krčmář" <rkrcmar@redhat.com>
Subject: [PATCH v2 2/3] KVM: x86: check existance before destroy
Date: Wed, 15 Mar 2017 16:01:18 +0800 [thread overview]
Message-ID: <1489564879-6097-3-git-send-email-peterx@redhat.com> (raw)
In-Reply-To: <1489564879-6097-1-git-send-email-peterx@redhat.com>
Mostly used for split irqchip mode. In that case, these two things are
not inited at all, so no need to release.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
arch/x86/kvm/i8259.c | 3 +++
arch/x86/kvm/ioapic.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 73ea24d..047b17a 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -657,6 +657,9 @@ void kvm_pic_destroy(struct kvm *kvm)
{
struct kvm_pic *vpic = kvm->arch.vpic;
+ if (!vpic)
+ return;
+
kvm_io_bus_unregister_dev(vpic->kvm, KVM_PIO_BUS, &vpic->dev_master);
kvm_io_bus_unregister_dev(vpic->kvm, KVM_PIO_BUS, &vpic->dev_slave);
kvm_io_bus_unregister_dev(vpic->kvm, KVM_PIO_BUS, &vpic->dev_eclr);
diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c
index 6e219e5..289270a 100644
--- a/arch/x86/kvm/ioapic.c
+++ b/arch/x86/kvm/ioapic.c
@@ -635,6 +635,9 @@ void kvm_ioapic_destroy(struct kvm *kvm)
{
struct kvm_ioapic *ioapic = kvm->arch.vioapic;
+ if (!ioapic)
+ return;
+
cancel_delayed_work_sync(&ioapic->eoi_inject);
kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, &ioapic->dev);
kvm->arch.vioapic = NULL;
--
2.7.4
next prev parent reply other threads:[~2017-03-15 8:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-15 8:01 [PATCH v2 0/3] KVM: x86: use pic/ioapic destructor when proper Peter Xu
2017-03-15 8:01 ` [PATCH v2 1/3] KVM: x86: clear bus pointer when destroyed Peter Xu
2017-03-21 9:24 ` David Hildenbrand
2017-03-15 8:01 ` Peter Xu [this message]
2017-03-21 9:24 ` [PATCH v2 2/3] KVM: x86: check existance before destroy David Hildenbrand
2017-03-15 8:01 ` [PATCH v2 3/3] KVM: x86: use pic/ioapic destructor when destroy vm Peter Xu
2017-03-21 9:25 ` David Hildenbrand
2017-03-15 8:47 ` [PATCH v2 0/3] KVM: x86: use pic/ioapic destructor when proper David Hildenbrand
2017-03-15 8:59 ` Peter Xu
2017-03-15 9:04 ` David Hildenbrand
2017-03-15 11:15 ` David Hildenbrand
2017-03-16 6:04 ` Peter Xu
2017-03-16 19:32 ` Radim Krčmář
2017-03-17 6:05 ` Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1489564879-6097-3-git-send-email-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=david@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.