qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: branches are expensive


From: Avi Kivity
Subject: Re: [Qemu-devel] Re: branches are expensive
Date: Tue, 17 Mar 2009 15:24:34 +0200
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]