From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/3] KVM: Use kvm_free_assigned_irq() for free irq Date: Tue, 30 Dec 2008 13:16:27 +0200 Message-ID: <495A030B.1040302@redhat.com> References: <1230616173-17723-1-git-send-email-sheng@linux.intel.com> <1230616173-17723-3-git-send-email-sheng@linux.intel.com> <4959F7C5.101@redhat.com> <200812301911.10975.sheng@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Sheng Yang Return-path: Received: from mx2.redhat.com ([66.187.237.31]:56140 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751810AbYL3LQa (ORCPT ); Tue, 30 Dec 2008 06:16:30 -0500 In-Reply-To: <200812301911.10975.sheng@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Sheng Yang wrote: >> This will call cancel_work_sync(), which may wait upon kvm->lock, which >> I think we hold here -> deadlock. >> >> I think that the current code has even bigger problems (races), since a >> scheduled work can arrive after the interrupt has been freed and >> reallocated. >> > > For the race problem, how about put a cancel_work_sync() for all devices at > the beginning of kvm_destroy_vm? Something named kvm_arch_cancel_work_sync... > There is no race at destroy time since the work_struct has a reference on struct kvm. So destruction is only triggered after the last interrupt. (but what if we get another interrupt immediately afterwards?!) -- error compiling committee.c: too many arguments to function