From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [RFC PATCH] KVM: optimize apic interrupt delivery Date: Tue, 11 Sep 2012 14:20:49 +0300 Message-ID: <20120911112049.GI20907@redhat.com> References: <20120910130915.GB20907@redhat.com> <20120910144438.GA19741@redhat.com> <20120910161754.GB25827@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, avi@redhat.com, mtosatti@redhat.com To: "Michael S. Tsirkin" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:56398 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757783Ab2IKLUv (ORCPT ); Tue, 11 Sep 2012 07:20:51 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8BBKp2Z008022 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 11 Sep 2012 07:20:51 -0400 Content-Disposition: inline In-Reply-To: <20120910161754.GB25827@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Sep 10, 2012 at 07:17:54PM +0300, Gleb Natapov wrote: > > > > > + rcu_assign_pointer(kvm->arch.apic_map, new); > > > + mutex_unlock(&kvm->arch.apic_map_lock); > > > + > > > + if (old) > > > + call_rcu(&old->rcu, rcu_free_apic_map); > > > > What guarantees rcu_free_apic_map is called before module goes away? > Why do we care? > Ugh. We do not care that apic_map memory will stick after module unload, but we obviously care since rcu_free_apic_map() code itself will go away. Looks like general problem for all modular users of call_rcu(). Is there general solution in module unload code somewhere? Calling rcu_barrier() before unloading module should be enough. -- Gleb.