[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 3/4] QemuMutex: support --enable-debug-mutex
From: |
Peter Xu |
Subject: |
Re: [Qemu-devel] [PATCH v4 3/4] QemuMutex: support --enable-debug-mutex |
Date: |
Tue, 24 Apr 2018 12:53:47 +0800 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
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 <address@hidden>
> > ---
> (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 <address@hidden>
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