From: Avi Kivity <avi@redhat.com>
To: qemu-devel@nongnu.org
Cc: Steffen Liebergeld <usenet@gmx.eu>
Subject: Re: [Qemu-devel] Re: branches are expensive
Date: Tue, 17 Mar 2009 15:24:34 +0200 [thread overview]
Message-ID: <49BFA492.2010400@redhat.com> (raw)
In-Reply-To: <200903171251.41148.paul@codesourcery.com>
Paul Brook wrote:
>> The ratio is quite bad. Do you have any documentation on when Qemu does the
>> chaining and more important, when it does not. For example are
>> unconditional jumps always chained, or only in one direction (forward or
>> backward).
>>
>
> Direct jumps[1] within the same page are chained (including ). Indirect
> jumps[2] and direct jumps to a different page are not chained. Chaining jumps
> between pages would require breaking TB chains every time a TLB flush occurs.
>
You could optimize interpage direct jumps as follows:
if (tb->tlb_generation != global_tlb_generation)
revalidate_interpage_branch();
asm ("B target_address")
A tlb flush (or switching execution to a different cpu) increments
global_tlb_generation; revalidate_interpage_branch() sets target_address
to the slow path which does the tb lookup, and sets tlb_generation =
global_tlb_generation. Should compile an unconditional branch to 5
instructions.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2009-03-17 13:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-17 11:05 [Qemu-devel] branches are expensive Steffen Liebergeld
2009-03-17 11:18 ` Avi Kivity
2009-03-17 11:32 ` [Qemu-devel] " Jan Kiszka
2009-03-17 12:31 ` Steffen Liebergeld
2009-03-17 12:51 ` Paul Brook
2009-03-17 13:24 ` Avi Kivity [this message]
2009-03-19 10:07 ` Steffen Liebergeld
2009-03-19 10:30 ` Laurent Desnogues
2009-03-19 10:39 ` Steffen Liebergeld
2009-03-19 11:06 ` Laurent Desnogues
2009-03-19 10:52 ` Avi Kivity
2009-03-19 11:34 ` Paul Brook
2009-03-17 11:36 ` Steffen Liebergeld
2009-03-17 13:30 ` [Qemu-devel] " Laurent Desnogues
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=49BFA492.2010400@redhat.com \
--to=avi@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=usenet@gmx.eu \
/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.