From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fApxm-0003Yq-2X for qemu-devel@nongnu.org; Tue, 24 Apr 2018 00:53:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fApxh-0007Dk-F2 for qemu-devel@nongnu.org; Tue, 24 Apr 2018 00:53:58 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:32950 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fApxh-0007DS-Aw for qemu-devel@nongnu.org; Tue, 24 Apr 2018 00:53:53 -0400 Date: Tue, 24 Apr 2018 12:53:47 +0800 From: Peter Xu Message-ID: <20180424045347.GB9036@xz-mi> References: <20180423053927.13715-1-peterx@redhat.com> <20180423053927.13715-4-peterx@redhat.com> <20180423181107.GB27690@flamenco> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180423181107.GB27690@flamenco> Subject: Re: [Qemu-devel] [PATCH v4 3/4] QemuMutex: support --enable-debug-mutex List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" Cc: qemu-devel@nongnu.org, Paolo Bonzini , Fam Zheng , Stefan Hajnoczi On Mon, Apr 23, 2018 at 02:11:07PM -0400, Emilio G. Cota wrote: > On Mon, Apr 23, 2018 at 13:39:26 +0800, Peter Xu wrote: > > We have had some tracing tools for mutex but it's not easy to use them > > for e.g. dead locks. Let's provide "--enable-debug-mutex" parameter > > when configure to allow QemuMutex to store the last owner that took > > specific lock. It will be easy to use this tool to debug deadlocks > > since we can directly know who took the lock then as long as we can have > > a debugger attached to the process. > > > > Signed-off-by: Peter Xu > > --- > (snip) > > static inline void qemu_mutex_pre_unlock(QemuMutex *mutex, > > const char *file, int line) > > { > > +#ifdef CONFIG_DEBUG_MUTEX > > + mutex->file = NULL; > > + mutex->line = 0; > > +#endif > > trace_qemu_mutex_unlock(mutex, file, line); > > } > > I'd also initialize to NULL/0 the file/line pair at > qemu_mutex_init time for both posix and win32. Other than that: > > Reviewed-by: Emilio G. Cota I did the same trick for mutex init in patch 2 & 3 and reposted, while I picked up your r-b for patch 4 only. Please have a look. Thanks, -- Peter Xu