qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>,
	"Emilio G. Cota" <cota@braap.org>
Cc: mttcg@listserver.greensocs.com, peter.maydell@linaro.org,
	claudio.fontana@huawei.com,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>,
	jan.kiszka@siemens.com, mark.burton@greensocs.com,
	a.rigo@virtualopensystems.com, qemu-devel@nongnu.org,
	serge.fdrv@gmail.com, bobby.prani@gmail.com, rth@twiddle.net,
	fred.konrad@greensocs.com
Subject: Re: [Qemu-devel] [PATCH 2/2] cpu-exec: remove tb_lock from the hot-path
Date: Tue, 5 Jul 2016 14:47:45 +0200	[thread overview]
Message-ID: <38496c08-3c5a-a8a7-dfb2-a81db29c4592@redhat.com> (raw)
In-Reply-To: <87inwkmj5d.fsf@linaro.org>



On 05/07/2016 13:14, Alex Bennée wrote:
> /*
>  * Patch the last TB with a jump to the current TB.
>  *
>  * Modification of the TB has to be protected with tb_lock which can
>  * either be already held or taken here.
>  */
> static inline void maybe_patch_last_tb(CPUState *cpu,
>                                        TranslationBlock *tb,
>                                        TranslationBlock **last_tb,
>                                        int tb_exit,
>                                        bool locked)
> {
>     if (cpu->tb_flushed) {
>         /* Ensure that no TB jump will be modified as the
>          * translation buffer has been flushed.
>          */
>         *last_tb = NULL;
>         cpu->tb_flushed = false;
>     }
> #ifndef CONFIG_USER_ONLY
>     /* We don't take care of direct jumps when address mapping changes in
>      * system emulation. So it's not safe to make a direct jump to a TB
>      * spanning two pages because the mapping for the second page can change.
>      */
>     if (tb->page_addr[1] != -1) {
>         *last_tb = NULL;
>     }
> #endif
>     /* See if we can patch the calling TB. */
>     if (*last_tb && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
>         if (!locked) {
>             tb_lock();
>         }
>         tb_add_jump(*last_tb, tb_exit, tb);
>         if (!locked) {
>             tb_unlock();
>         }
>     }
> }

Why not add tb_lock_recursive() and tb_lock_reset()?

Paolo

  reply	other threads:[~2016-07-05 12:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01 16:16 [Qemu-devel] [PATCH 0/2] Reduce lock contention on TCG hot-path Alex Bennée
2016-07-01 16:16 ` [Qemu-devel] [PATCH 1/2] tcg: Ensure safe tb_jmp_cache lookup out of 'tb_lock' Alex Bennée
2016-07-01 23:14   ` Richard Henderson
2016-07-02  0:17   ` Emilio G. Cota
2016-07-02  0:32     ` Richard Henderson
2016-07-04 22:33       ` Emilio G. Cota
2016-07-02  7:09     ` Alex Bennée
2016-07-04 22:31       ` Emilio G. Cota
2016-07-05 12:49         ` Paolo Bonzini
2016-07-01 16:16 ` [Qemu-devel] [PATCH 2/2] cpu-exec: remove tb_lock from the hot-path Alex Bennée
2016-07-01 23:19   ` Richard Henderson
2016-07-02  0:39   ` Emilio G. Cota
2016-07-04 11:45     ` Alex Bennée
2016-07-04 22:30       ` Emilio G. Cota
2016-07-05 11:14         ` Alex Bennée
2016-07-05 12:47           ` Paolo Bonzini [this message]
2016-07-05 13:11             ` Alex Bennée
2016-07-05 13:42               ` Paolo Bonzini
2016-07-05 15:34                 ` Sergey Fedorov
2016-07-05 16:00                   ` Alex Bennée
2016-07-05 16:04                     ` Sergey Fedorov
2016-07-02  0:52 ` [Qemu-devel] [PATCH 0/2] Reduce lock contention on TCG hot-path Emilio G. Cota
2016-07-02  7:08   ` Alex Bennée
2016-07-02 16:03     ` 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=38496c08-3c5a-a8a7-dfb2-a81db29c4592@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=a.rigo@virtualopensystems.com \
    --cc=alex.bennee@linaro.org \
    --cc=bobby.prani@gmail.com \
    --cc=claudio.fontana@huawei.com \
    --cc=cota@braap.org \
    --cc=crosthwaite.peter@gmail.com \
    --cc=fred.konrad@greensocs.com \
    --cc=jan.kiszka@siemens.com \
    --cc=mark.burton@greensocs.com \
    --cc=mttcg@listserver.greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=serge.fdrv@gmail.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).