From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 15/15] KVM: Fix racy in kvm_free_assigned_irq Date: Sun, 28 Dec 2008 14:57:29 +0200 Message-ID: <495777B9.1030706@redhat.com> References: <20081225115609.GA10087@syang10-desktop> <1230258607-15208-1-git-send-email-sheng@linux.intel.com> <20081227200626.GA4095@amt.cnet> <20081228112402.GB2610@syang10-desktop> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org, Amit Shah , "Han, Weidong" To: Sheng Yang Return-path: Received: from mx2.redhat.com ([66.187.237.31]:49386 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754075AbYL1M5d (ORCPT ); Sun, 28 Dec 2008 07:57:33 -0500 In-Reply-To: <20081228112402.GB2610@syang10-desktop> Sender: kvm-owner@vger.kernel.org List-ID: Sheng Yang wrote: >>> if (cancel_work_sync(&assigned_dev->interrupt_work)) >>> kvm_put_kvm(kvm); >>> >>> In fact, cancel_work_sync() would return true either work struct is only >>> scheduled or the callback of work struct is executed. This code only >>> consider the former situation. >>> >> Why not simply drop the reference inc / dec from irq handler/work >> function? >> > > Sorry, I don't know the answer. After checking the code, I also think it's a > little strange to increase refernce count here, and I think we won't suppose > work_handler can release the kvm struct. > > Maybe Avi knows? Or Amit and Weidong? > Not sure what the reasoning was, but it does seem like reference counting can be safely dropped from interrupt_work. -- error compiling committee.c: too many arguments to function