From: Paolo Bonzini <pbonzini@redhat.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>, linux-kernel@vger.kernel.org
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: cancel delayed EOI work on vm shutdown
Date: Tue, 28 Apr 2015 16:13:33 +0200 [thread overview]
Message-ID: <553F958D.40509@redhat.com> (raw)
In-Reply-To: <1430229615-19990-1-git-send-email-rkrcmar@redhat.com>
On 28/04/2015 16:00, Radim Krčmář wrote:
> kvm_ioapic_eoi_inject_work() can be called after ioapic has been freed,
> fix it by cancelling its delayed work via a slightly better freeing.
> (Could have been a one-liner.)
>
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
> I noticed it while reviewing the "KVM: x86: drop unneeded null test",
> so it applies after.
>
> arch/x86/kvm/ioapic.c | 6 ++++++
> arch/x86/kvm/ioapic.h | 1 +
> arch/x86/kvm/x86.c | 2 +-
> 3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c
> index 09828e2cacfb..88de47ba4058 100644
> --- a/arch/x86/kvm/ioapic.c
> +++ b/arch/x86/kvm/ioapic.c
> @@ -642,6 +642,12 @@ void kvm_ioapic_destroy(struct kvm *kvm)
> kfree(ioapic);
> }
>
> +void kvm_free_ioapic(struct kvm *kvm)
> +{
> + if (kvm->arch.vioapic)
> + kvm_ioapic_destroy(kvm);
> +}
> +
> int kvm_get_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state)
> {
> struct kvm_ioapic *ioapic = ioapic_irqchip(kvm);
> diff --git a/arch/x86/kvm/ioapic.h b/arch/x86/kvm/ioapic.h
> index ca0b0b4e6256..7c5579c24fc8 100644
> --- a/arch/x86/kvm/ioapic.h
> +++ b/arch/x86/kvm/ioapic.h
> @@ -122,5 +122,6 @@ int kvm_get_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state);
> int kvm_set_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state);
> void kvm_ioapic_scan_entry(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap,
> u32 *tmr);
> +void kvm_free_ioapic(struct kvm *kvm);
>
> #endif
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index c73efcd03e29..bb7f1b5881d5 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -7468,6 +7468,7 @@ void kvm_arch_sync_events(struct kvm *kvm)
> cancel_delayed_work_sync(&kvm->arch.kvmclock_update_work);
> kvm_free_all_assigned_devices(kvm);
> kvm_free_pit(kvm);
> + kvm_free_ioapic(kvm);
> }
>
> void kvm_arch_destroy_vm(struct kvm *kvm)
> @@ -7491,7 +7492,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
> }
> kvm_iommu_unmap_guest(kvm);
> kfree(kvm->arch.vpic);
> - kfree(kvm->arch.vioapic);
> kvm_free_vcpus(kvm);
> kfree(rcu_dereference_check(kvm->arch.apic_map, 1));
> }
>
You beat me. :)
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
and will apply it too.
Paolo
prev parent reply other threads:[~2015-04-28 14:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-28 14:00 Radim Krčmář
2015-04-28 14:13 ` Paolo Bonzini [this message]
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=553F958D.40509@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome