lkml.org 
[lkml]   [2015]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: KVM: x86: question about kvm_ioapic_destroy


On 27/04/2015 12:05, Michael S. Tsirkin wrote:
> On Sun, Apr 26, 2015 at 07:19:58PM +0200, Julia Lawall wrote:
>> The function kvm_ioapic_destroy is defined as follows:
>>
>> void kvm_ioapic_destroy(struct kvm *kvm)
>> {
>> struct kvm_ioapic *ioapic = kvm->arch.vioapic;
>>
>> cancel_delayed_work_sync(&ioapic->eoi_inject);
>> if (ioapic) {
>> kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, &ioapic->dev);
>> kvm->arch.vioapic = NULL;
>> kfree(ioapic);
>> }
>> }
>>
>> Is there any way that cancel_delayed_work_sync can work if ioapic is NULL?
>> Should the call be moved down under the NULL test? Or is the NULL test
>> not needed? The NULL test has been there longer than the call to
>> cancel_delayed_work_sync, which was introduced in 184564ef.
>
> I think the NULL test is not needed.
> kvm_ioapic_destroy is only called if kvm_ioapic_init
> completed successfully, and that sets kvm->arch.vioapic.

Agreed. By the way, in that case the cancel_delayed_work_sync is really
a nop.

Paolo


\
 
 \ /
  Last update: 2015-04-27 14:41    [W:0.073 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site