From: "Alex Bennée" <alex.bennee@linaro.org>
To: Pranith Kumar <bobby.prani@gmail.com>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH] mttcg: Handle EXCP_ATOMIC exception
Date: Wed, 02 Nov 2016 16:22:52 +0000 [thread overview]
Message-ID: <8737j9vokj.fsf@linaro.org> (raw)
In-Reply-To: <20161102142559.23395-1-bobby.prani@gmail.com>
Pranith Kumar <bobby.prani@gmail.com> writes:
> The patch enables handling atomic code in the guest. This should be
> preferably done in cpu_handle_exception(), but the current assumptions
> regarding when we can execute atomic sections cause a deadlock.
>
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> ---
> cpus.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/cpus.c b/cpus.c
> index 8f98060..c4ba7d8 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -1315,6 +1315,9 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg)
> if (r == EXCP_DEBUG) {
> cpu_handle_guest_debug(cpu);
> break;
> + } else if (r == EXCP_ATOMIC) {
> + cpu_exec_step_atomic(cpu);
> + break;
Hmm don't we need to unlock the iothread here as well? I suspect you
never see a deadlock because the rr thread can't by definition race with
itself but the locking practice should be the same for both cases.
> }
> } else if (cpu->stop) {
> if (cpu->unplug) {
> @@ -1385,6 +1388,10 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
> */
> g_assert(cpu->halted);
> break;
> + case EXCP_ATOMIC:
> + qemu_mutex_unlock_iothread();
> + cpu_exec_step_atomic(cpu);
> + qemu_mutex_lock_iothread();
> default:
> /* Ignore everything else? */
> break;
--
Alex Bennée
next prev parent reply other threads:[~2016-11-02 16:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-02 14:25 [Qemu-devel] [PATCH] mttcg: Handle EXCP_ATOMIC exception Pranith Kumar
2016-11-02 16:22 ` Alex Bennée [this message]
2016-11-02 16:30 ` Pranith Kumar
2016-11-02 16:40 ` [Qemu-devel] [PATCH v2] " Pranith Kumar
2016-11-02 16:49 ` Paolo Bonzini
2016-11-02 18:17 ` Alex Bennée
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=8737j9vokj.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=bobby.prani@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).