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:49:17 +0300 Message-ID: <20120911114917.GJ20907@redhat.com> References: <20120910130915.GB20907@redhat.com> <20120910144438.GA19741@redhat.com> <20120910161754.GB25827@redhat.com> <20120911112049.GI20907@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]:2156 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758564Ab2IKLtS (ORCPT ); Tue, 11 Sep 2012 07:49:18 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8BBnIQw012707 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 11 Sep 2012 07:49:18 -0400 Content-Disposition: inline In-Reply-To: <20120911112049.GI20907@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Sep 11, 2012 at 02:20:49PM +0300, Gleb Natapov wrote: > 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. > If nothing changed for the past 3 years each module should call rcu_barrier() by itself: http://paulmck.livejournal.com/7314.html Looking at the code I see that it calls synchronize_rcu() on module delete, but this is not enough. :( -- Gleb.