From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAlrc-0007Wb-Fl for qemu-devel@nongnu.org; Mon, 23 Apr 2018 20:31:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fAlrY-0005SP-I0 for qemu-devel@nongnu.org; Mon, 23 Apr 2018 20:31:20 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:56045) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fAlrY-0005Rj-EB for qemu-devel@nongnu.org; Mon, 23 Apr 2018 20:31:16 -0400 Date: Mon, 23 Apr 2018 20:31:15 -0400 From: "Emilio G. Cota" Message-ID: <20180424003115.GD8651@flamenco> References: <1522980788-1252-1-git-send-email-cota@braap.org> <1522980788-1252-13-git-send-email-cota@braap.org> <565c5fac-2494-c30a-84c2-3bb1bb9c11b3@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <565c5fac-2494-c30a-84c2-3bb1bb9c11b3@linaro.org> Subject: Re: [Qemu-devel] [PATCH v2 12/17] translate-all: add page_collection assertions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org, Alex =?iso-8859-1?Q?Benn=E9e?= , Paolo Bonzini On Fri, Apr 13, 2018 at 17:42:45 -1000, Richard Henderson wrote: > On 04/05/2018 04:13 PM, Emilio G. Cota wrote: > > +static __thread bool page_collection_locked; > > + > > +void assert_page_collection_locked(bool val) > > +{ > > + tcg_debug_assert(page_collection_locked == val); > > +} > > + > > +static inline void set_page_collection_locked(bool val) > > +{ > > + page_collection_locked = val; > > +} > > + > > This seems fairly fragile to me. > > (1) Do you ever do assert_page_collection_locked(true)? No. > You don't appear to do so, and it's somewhat confusing. You're right. I think in testing I was using it, but now it might make more sense to not take any arguments. > (2) Why does do_page_entry_lock set "locked" and not page_collection_lock? page_collection_lock calls page_entry_lock and page_trylock_add, both of which end up calling do_page_entry_lock. Thanks, Emilio