qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCH 3/3] tcg: signal-free qemu_cpu_kick
Date: Mon, 17 Aug 2015 11:31:30 -0700	[thread overview]
Message-ID: <55D22882.1000200@twiddle.net> (raw)
In-Reply-To: <1439558129-466-4-git-send-email-pbonzini@redhat.com>

On 08/14/2015 06:15 AM, Paolo Bonzini wrote:
> +    atomic_mb_set(&current_cpu, cpu);
...
> +        cpu_exit(atomic_rcu_read(&current_cpu));

Mixing java and rcu style sync to the same data structure?

> +                         * ensure tcg_exit_req is read before exit_request
> +                         * or interrupt_request.
>                           */
> +                        smp_rmb();
>                          next_tb = 0;

This I don't understand, since we've just read exit_request above, and you're
putting the barrier here?

> +        /* Ensure whatever caused the exit has reached the CPU threads before
> +         * writing exit_request.
> +         */
> +        smp_wmb();
> +        exit_request = 1;
> +        /* Ignore the CPU argument since all CPUs run in the same thread;
> +         * preempt the currently running one.  The memory barriers ensures
> +         * that other CPUs will see the request if the current CPU is
> +         * preempted.
> +         */
> +        smp_wmb();
> +        cpu_exit(atomic_rcu_read(&current_cpu));

...

> +    /* Pairs with smp_wmb in qemu_cpu_kick.  */
> +    atomic_mb_set(&exit_request, 0);
>  }

Bare barriers and java style sync to the same data structure?

>      cpu->exit_request = 1;
> +    /* Ensure cpu_exec will see the exit request after TCG has exited.  */
> +    smp_wmb();
>      cpu->tcg_exit_req = 1;
>  }

Likewise.

I find this mixing highly confusing.  I see no way to prove that it's going to
be right for non-x86.


r~

  reply	other threads:[~2015-08-17 18:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14 13:15 [Qemu-devel] [PATCH 0/3] Signal-free qemu_cpu_kick for TCG Paolo Bonzini
2015-08-14 13:15 ` [Qemu-devel] [PATCH 1/3] i8257: rewrite DMA_schedule to avoid hooking into the CPU loop Paolo Bonzini
2015-08-14 13:15 ` [Qemu-devel] [PATCH 2/3] i8257: remove cpu_request_exit irq Paolo Bonzini
2015-08-14 13:15 ` [Qemu-devel] [PATCH 3/3] tcg: signal-free qemu_cpu_kick Paolo Bonzini
2015-08-17 18:31   ` Richard Henderson [this message]
2015-08-17 20:47     ` Paolo Bonzini

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=55D22882.1000200@twiddle.net \
    --to=rth@twiddle.net \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).