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 v3 1/3] qemu-thread: introduce qemu-thread-common.[ch]
Date: Fri, 20 Apr 2018 13:07:34 -0400 [thread overview]
Message-ID: <20180420170734.GA8811@flamenco> (raw)
In-Reply-To: <20180420044212.28765-2-peterx@redhat.com>
On Fri, Apr 20, 2018 at 12:42:10 +0800, Peter Xu wrote:
> Put all the shared qemu-thread implementations into these files. The
> header should be internal to qemu-thread but not for qemu-thread users.
>
> Introduce some hooks correspondingly for the shared part. Note that in
> qemu_mutex_unlock_impl() we moved the call before unlock operation which
> should make more sense. And we don't need qemu_mutex_post_unlock() hook.
>
> Currently the hooks only calls the tracepoints.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
(snip)
> - trace_qemu_mutex_lock(mutex, file, line);
> -
> + qemu_mutex_pre_lock(mutex, file, line);
> err = pthread_mutex_lock(&mutex->lock);
> if (err)
> error_exit(err, __func__);
> -
> - trace_qemu_mutex_locked(mutex, file, line);
> + qemu_mutex_post_lock(mutex, file, line);
> }
I see the value in consolidating these calls. However, having a separate
object means that this adds two function calls to mutex_lock. This
significantly reduces performance, even without --enable-debug-mutex:
- Before:
$ taskset -c 0 tests/atomic_add-bench -n 1 -m
Parameters:
# of threads: 1
duration: 1
ops' range: 1024
Results:
Duration: 1 s
Throughput: 57.24 Mops/s
Throughput/thread: 57.24 Mops/s/thread
- After:
$ taskset -c 0 tests/atomic_add-bench -n 1 -m
Parameters:
# of threads: 1
duration: 1
ops' range: 1024
Results:
Duration: 1 s
Throughput: 49.22 Mops/s
Throughput/thread: 49.22 Mops/s/thread
So either inlines/macros should be used instead -- I'd prefer
inlines but I'm not sure they'll work with the tracing calls.
I think you should cherry-pick this patch[1] and add it to the
series -- it'll let you make sure the series does not affect
performance.
Cheers,
Emilio
[1] https://github.com/cota/qemu/commit/f04f34df
next prev parent reply other threads:[~2018-04-20 17:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-20 4:42 [Qemu-devel] [PATCH v3 0/3] qemu-thread: support --enable-debug-mutex Peter Xu
2018-04-20 4:42 ` [Qemu-devel] [PATCH v3 1/3] qemu-thread: introduce qemu-thread-common.[ch] Peter Xu
2018-04-20 17:07 ` Emilio G. Cota [this message]
2018-04-23 5:19 ` Peter Xu
2018-04-20 4:42 ` [Qemu-devel] [PATCH v3 2/3] QemuMutex: support --enable-debug-mutex Peter Xu
2018-04-20 4:42 ` [Qemu-devel] [PATCH v3 3/3] configure: enable debug-mutex if debug enabled Peter Xu
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=20180420170734.GA8811@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.