From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yqqwz-0002zQ-SF for qemu-devel@nongnu.org; Fri, 08 May 2015 18:40:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yqqwu-000893-J3 for qemu-devel@nongnu.org; Fri, 08 May 2015 18:40:57 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:40543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yqqwu-00087D-9R for qemu-devel@nongnu.org; Fri, 08 May 2015 18:40:52 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id C9F2F20924 for ; Fri, 8 May 2015 18:40:51 -0400 (EDT) Date: Fri, 8 May 2015 18:41:35 -0400 From: "Emilio G. Cota" Message-ID: <20150508224135.GA25762@flamenco> References: <1431118934-20900-1-git-send-email-cota@braap.org> <1431118934-20900-6-git-send-email-cota@braap.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1431118934-20900-6-git-send-email-cota@braap.org> Subject: Re: [Qemu-devel] [RFC 5/8] aie: add module for Atomic Instruction Emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mttcg@listserver.greensocs.com, Peter Maydell , Alvise Rigo , Paolo Bonzini , Richard Henderson , alex.bennee@linaro.org, Frederic Konrad On Fri, May 08, 2015 at 17:02:11 -0400, Emilio G. Cota wrote: > +++ b/aie.c (snip) > +static inline void *aie_entry_init(unsigned long index) > +{ > + AIEEntry *entry; > + > + entry = qemu_memalign(64, sizeof(*entry)); > + tiny_set_init(&entry->ts); > + qemu_mutex_init(&entry->lock); > + return entry; > +} > + > +AIEEntry *aie_entry_get_lock(hwaddr addr) > +{ > + aie_addr_t laddr = to_aie(addr); > + AIEEntry *e; > + > + e = qemu_radix_tree_find_alloc(&aie_rtree, laddr, aie_entry_init, g_free); s/g_free/qemu_vfree/, since the allocation is done (above) with qemu_memalign. The tree doesn't support deletions, but still.. Emilio