qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Emilio G. Cota" <cota@braap.org>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Fam Zheng <famz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 3/4] QemuMutex: support --enable-debug-mutex
Date: Mon, 23 Apr 2018 14:11:07 -0400	[thread overview]
Message-ID: <20180423181107.GB27690@flamenco> (raw)
In-Reply-To: <20180423053927.13715-4-peterx@redhat.com>

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 <peterx@redhat.com>
> ---
(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 <cota@braap.org>

Thanks,

		E.

  reply	other threads:[~2018-04-23 18:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-23  5:39 [Qemu-devel] [PATCH v4 0/4] qemu-thread: support --enable-debug-mutex Peter Xu
2018-04-23  5:39 ` [Qemu-devel] [PATCH v4 1/4] tests/atomic_add-bench: add -m option to use mutexes Peter Xu
2018-04-23  5:39 ` [Qemu-devel] [PATCH v4 2/4] qemu-thread: introduce qemu-thread-common.h Peter Xu
2018-04-23 18:08   ` Emilio G. Cota
2018-04-23  5:39 ` [Qemu-devel] [PATCH v4 3/4] QemuMutex: support --enable-debug-mutex Peter Xu
2018-04-23 18:11   ` Emilio G. Cota [this message]
2018-04-24  4:53     ` Peter Xu
2018-04-23  5:39 ` [Qemu-devel] [PATCH v4 4/4] configure: enable debug-mutex if debug enabled Peter Xu
2018-04-23 18:11   ` Emilio G. Cota

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180423181107.GB27690@flamenco \
    --to=cota@braap.org \
    --cc=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).