All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target/ppc: Use tcg_gen_lookup_and_goto_ptr
@ 2017-06-30 18:37 Richard Henderson
  2017-07-01  0:04 ` Emilio G. Cota
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Richard Henderson @ 2017-06-30 18:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc

Cc: qemu-ppc@nongnu.org
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target/ppc/translate.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index c0cd64d..9aa66f5 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -3419,7 +3419,7 @@ static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
 }
 
 /***                                Branch                                 ***/
-static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
+static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
 {
     if (NARROW_MODE(ctx)) {
         dest = (uint32_t) dest;
@@ -3441,7 +3441,7 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
                 gen_debug_exception(ctx);
             }
         }
-        tcg_gen_exit_tb(0);
+        tcg_gen_lookup_and_goto_ptr(cpu_nip);
     }
 }
 
@@ -3479,7 +3479,7 @@ static void gen_b(DisasContext *ctx)
 #define BCOND_CTR 2
 #define BCOND_TAR 3
 
-static inline void gen_bcond(DisasContext *ctx, int type)
+static void gen_bcond(DisasContext *ctx, int type)
 {
     uint32_t bo = BO(ctx->opcode);
     TCGLabel *l1;
@@ -3543,26 +3543,19 @@ static inline void gen_bcond(DisasContext *ctx, int type)
         } else {
             gen_goto_tb(ctx, 0, li);
         }
-        if ((bo & 0x14) != 0x14) {
-            gen_set_label(l1);
-            gen_goto_tb(ctx, 1, ctx->nip);
-        }
     } else {
         if (NARROW_MODE(ctx)) {
             tcg_gen_andi_tl(cpu_nip, target, (uint32_t)~3);
         } else {
             tcg_gen_andi_tl(cpu_nip, target, ~3);
         }
-        tcg_gen_exit_tb(0);
-        if ((bo & 0x14) != 0x14) {
-            gen_set_label(l1);
-            gen_update_nip(ctx, ctx->nip);
-            tcg_gen_exit_tb(0);
-        }
-    }
-    if (type == BCOND_LR || type == BCOND_CTR || type == BCOND_TAR) {
+        tcg_gen_lookup_and_goto_ptr(cpu_nip);
         tcg_temp_free(target);
     }
+    if ((bo & 0x14) != 0x14) {
+        gen_set_label(l1);
+        gen_goto_tb(ctx, 1, ctx->nip);
+    }
 }
 
 static void gen_bc(DisasContext *ctx)
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] target/ppc: Use tcg_gen_lookup_and_goto_ptr
  2017-06-30 18:37 [Qemu-devel] [PATCH] target/ppc: Use tcg_gen_lookup_and_goto_ptr Richard Henderson
@ 2017-07-01  0:04 ` Emilio G. Cota
  2017-09-22 14:33 ` Thomas Huth
  2017-10-26 12:22 ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
  2 siblings, 0 replies; 8+ messages in thread
From: Emilio G. Cota @ 2017-07-01  0:04 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, qemu-ppc

On Fri, Jun 30, 2017 at 11:37:36 -0700, Richard Henderson wrote:
> Cc: qemu-ppc@nongnu.org
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  target/ppc/translate.c | 23 ++++++++---------------
>  1 file changed, 8 insertions(+), 15 deletions(-)

Tested-by: Emilio G. Cota <cota@braap.org>

Just measured the speedup for linux-user:

                                     SPECint06 (test set), ppc64le-linux-user. Host: IBM POWER8 @ 3.42 GHz                                  
                                                                                                                                            
  1.6 +-+------+---------+--------+--------+--------+---------+--------+--------+---------+--------+--------+--------+---------+------+-+   
      |                                                                                   |                                             |   
      |                                                                                   |                               after         |   
  1.5 +-+.................................................................................|...........................................+-+   
      |                                                                                   |                                             |   
      |                                                                                ******                                           |   
  1.4 +-+.....+++.....................................................+++..............*..|.*.....+++.................................+-+   
      |        |                                   +++                 |               *  | *      |                                    |   
      |        |                                    |                  |               *  | *    *****                                  |   
  1.3 +-+......|....................................|..................|...............*..|.*....*.|.*................................+-+   
      |        |                 +++              ******             *****             * +++*    * | *             ******               |   
      |      ******               |               * |  *             * | *             *    *    *+++*             *+++ *               |   
  1.2 +-+....*.|..*...............|...............*.|..*.....+++.....*.|.*.............*....*....*...*.............*....*.............+-+   
      |      * |  *               |               * |  *      |      *+++*             *    *    *   *             *    *   ******      |   
      |      * |  *             *****             *+++ *   ******    *   *             *    *    *   *             *    *   * +++*      |   
  1.1 +-+....*+++.*.............*.|.*.............*....*...*.+++*....*...*.............*....*....*...*.....+++.....*....*...*....*....+-+   
      |      *    *             * | *             *    *   *    *    *   *             *    *    *   *      |      *    *   *    *      |   
      |      *    *             * | *             *    *   *    *    *   *    ******   *    *    *   *      |      *    *   *    *      |   
    1 +-+....*....*.....+++.....*+++*.....+++.....*....*...*....*....*...*....*....*...*....*....*...*....*****....*....*...*....*....+-+   
      |      *    *      |      *   *      |      *    *   *    *    *   *    *    *   *    *    *   *    * | *    *    *   *    *      |   
      |      *    *      |      *   *    *****    *    *   *    *    *   *    *    *   *    *    *   *    * | *    *    *   *    *      |   
  0.9 +-+....*....*...******....*...*....*.|.*....*....*...*....*....*...*....*....*...*....*....*...*....*.|.*....*....*...*....*....+-+   
      |      *    *   *  | *    *   *    * | *    *    *   *    *    *   *    *    *   *    *    *   *    *+++*    *    *   *    *      |   
      |      *    *   * +++*    *   *    *+++*    *    *   *    *    *   *    *    *   *    *    *   *    *   *    *    *   *    *      |   
  0.8 +-+----******---******----*****----*****----******---******----*****----******---******----*****----*****----******---******----+-+   
  400.perlbench 401.bzip2  403.gcc  429.mcf445.gobmk 456.hmmer458.462.libquantu464.h264r471.omnetpp473.a483.xalancbmk     gmean             
png: http://imgur.com/a/twj6V

Thanks,

		Emilio

PS. If you have spec06, you can very easily generate these plots. See
  https://github.com/cota/runspec-simple/commit/14211b927

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] target/ppc: Use tcg_gen_lookup_and_goto_ptr
  2017-06-30 18:37 [Qemu-devel] [PATCH] target/ppc: Use tcg_gen_lookup_and_goto_ptr Richard Henderson
  2017-07-01  0:04 ` Emilio G. Cota
@ 2017-09-22 14:33 ` Thomas Huth
  2017-10-26 12:22 ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
  2 siblings, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2017-09-22 14:33 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-ppc, David Gibson

On 30.06.2017 20:37, Richard Henderson wrote:
> Cc: qemu-ppc@nongnu.org
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  target/ppc/translate.c | 23 ++++++++---------------
>  1 file changed, 8 insertions(+), 15 deletions(-)
> 
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index c0cd64d..9aa66f5 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -3419,7 +3419,7 @@ static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
>  }
>  
>  /***                                Branch                                 ***/
> -static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
> +static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
>  {
>      if (NARROW_MODE(ctx)) {
>          dest = (uint32_t) dest;
> @@ -3441,7 +3441,7 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
>                  gen_debug_exception(ctx);
>              }
>          }
> -        tcg_gen_exit_tb(0);
> +        tcg_gen_lookup_and_goto_ptr(cpu_nip);
>      }
>  }
>  
> @@ -3479,7 +3479,7 @@ static void gen_b(DisasContext *ctx)
>  #define BCOND_CTR 2
>  #define BCOND_TAR 3
>  
> -static inline void gen_bcond(DisasContext *ctx, int type)
> +static void gen_bcond(DisasContext *ctx, int type)
>  {
>      uint32_t bo = BO(ctx->opcode);
>      TCGLabel *l1;
> @@ -3543,26 +3543,19 @@ static inline void gen_bcond(DisasContext *ctx, int type)
>          } else {
>              gen_goto_tb(ctx, 0, li);
>          }
> -        if ((bo & 0x14) != 0x14) {
> -            gen_set_label(l1);
> -            gen_goto_tb(ctx, 1, ctx->nip);
> -        }
>      } else {
>          if (NARROW_MODE(ctx)) {
>              tcg_gen_andi_tl(cpu_nip, target, (uint32_t)~3);
>          } else {
>              tcg_gen_andi_tl(cpu_nip, target, ~3);
>          }
> -        tcg_gen_exit_tb(0);
> -        if ((bo & 0x14) != 0x14) {
> -            gen_set_label(l1);
> -            gen_update_nip(ctx, ctx->nip);
> -            tcg_gen_exit_tb(0);
> -        }
> -    }
> -    if (type == BCOND_LR || type == BCOND_CTR || type == BCOND_TAR) {
> +        tcg_gen_lookup_and_goto_ptr(cpu_nip);
>          tcg_temp_free(target);
>      }
> +    if ((bo & 0x14) != 0x14) {
> +        gen_set_label(l1);
> +        gen_goto_tb(ctx, 1, ctx->nip);
> +    }
>  }
>  
>  static void gen_bc(DisasContext *ctx)
> 

Using this patch increases the speed of the SLOF firmware boot quite a
bit! The following simple test finishes at least 4 seconds faster when
I've got this patch applied:

time ppc64-softmmu/qemu-system-ppc64 -nographic -vga none \
 -prom-env 'boot-command=power-off'

I also can still run my big endian and my little endian pseries guest
images successfully, so feel free to add my:

Tested-by: Thomas Huth <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] target/ppc: Use tcg_gen_lookup_and_goto_ptr
  2017-06-30 18:37 [Qemu-devel] [PATCH] target/ppc: Use tcg_gen_lookup_and_goto_ptr Richard Henderson
  2017-07-01  0:04 ` Emilio G. Cota
  2017-09-22 14:33 ` Thomas Huth
@ 2017-10-26 12:22 ` Thomas Huth
  2017-10-26 13:44   ` Philippe Mathieu-Daudé
  2017-10-26 21:12   ` David Gibson
  2 siblings, 2 replies; 8+ messages in thread
From: Thomas Huth @ 2017-10-26 12:22 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel, David Gibson; +Cc: qemu-ppc

On 30.06.2017 20:37, Richard Henderson wrote:
> Cc: qemu-ppc@nongnu.org
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  target/ppc/translate.c | 23 ++++++++---------------
>  1 file changed, 8 insertions(+), 15 deletions(-)

*ping*

Richard, David, any chance that we can still get this in for 2.11? I
think this would be quite a nice performance improvement for PPC TCG...

 Thomas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] target/ppc: Use tcg_gen_lookup_and_goto_ptr
  2017-10-26 12:22 ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
@ 2017-10-26 13:44   ` Philippe Mathieu-Daudé
  2017-10-26 21:12   ` David Gibson
  1 sibling, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-10-26 13:44 UTC (permalink / raw)
  To: Thomas Huth, Richard Henderson, qemu-devel, David Gibson; +Cc: qemu-ppc

>> Signed-off-by: Richard Henderson <rth@twiddle.net>
>> ---
>>  target/ppc/translate.c | 23 ++++++++---------------
>>  1 file changed, 8 insertions(+), 15 deletions(-)
> 
> *ping*
> 
> Richard, David, any chance that we can still get this in for 2.11? I
> think this would be quite a nice performance improvement for PPC TCG...

This still miss a Reviewed-by tag ;)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] target/ppc: Use tcg_gen_lookup_and_goto_ptr
  2017-10-26 12:22 ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
  2017-10-26 13:44   ` Philippe Mathieu-Daudé
@ 2017-10-26 21:12   ` David Gibson
  2017-10-27 13:44     ` David Gibson
  1 sibling, 1 reply; 8+ messages in thread
From: David Gibson @ 2017-10-26 21:12 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Richard Henderson, qemu-devel, qemu-ppc

[-- Attachment #1: Type: text/plain, Size: 728 bytes --]

On Thu, Oct 26, 2017 at 02:22:57PM +0200, Thomas Huth wrote:
> On 30.06.2017 20:37, Richard Henderson wrote:
> > Cc: qemu-ppc@nongnu.org
> > Signed-off-by: Richard Henderson <rth@twiddle.net>
> > ---
> >  target/ppc/translate.c | 23 ++++++++---------------
> >  1 file changed, 8 insertions(+), 15 deletions(-)
> 
> *ping*
> 
> Richard, David, any chance that we can still get this in for 2.11? I
> think this would be quite a nice performance improvement for PPC TCG...

Uh.. sorry, I don't even remember this patch.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] target/ppc: Use tcg_gen_lookup_and_goto_ptr
  2017-10-26 21:12   ` David Gibson
@ 2017-10-27 13:44     ` David Gibson
  2017-10-27 13:55       ` David Gibson
  0 siblings, 1 reply; 8+ messages in thread
From: David Gibson @ 2017-10-27 13:44 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Richard Henderson, qemu-devel, qemu-ppc

[-- Attachment #1: Type: text/plain, Size: 1076 bytes --]

On Thu, Oct 26, 2017 at 11:12:00PM +0200, David Gibson wrote:
> On Thu, Oct 26, 2017 at 02:22:57PM +0200, Thomas Huth wrote:
> > On 30.06.2017 20:37, Richard Henderson wrote:
> > > Cc: qemu-ppc@nongnu.org
> > > Signed-off-by: Richard Henderson <rth@twiddle.net>
> > > ---
> > >  target/ppc/translate.c | 23 ++++++++---------------
> > >  1 file changed, 8 insertions(+), 15 deletions(-)
> > 
> > *ping*
> > 
> > Richard, David, any chance that we can still get this in for 2.11? I
> > think this would be quite a nice performance improvement for PPC TCG...
> 
> Uh.. sorry, I don't even remember this patch.

Managed to dig it out of my archives.  Looks like the problem was it
was just sent to the lists, not CCed to me.  I'm not generally able to
keep up with the lists, and I must have missed it on my periodic scans
through the list.  I've applied it now.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] target/ppc: Use tcg_gen_lookup_and_goto_ptr
  2017-10-27 13:44     ` David Gibson
@ 2017-10-27 13:55       ` David Gibson
  0 siblings, 0 replies; 8+ messages in thread
From: David Gibson @ 2017-10-27 13:55 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Richard Henderson, qemu-devel, qemu-ppc

[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]

On Fri, Oct 27, 2017 at 03:44:22PM +0200, David Gibson wrote:
> On Thu, Oct 26, 2017 at 11:12:00PM +0200, David Gibson wrote:
> > On Thu, Oct 26, 2017 at 02:22:57PM +0200, Thomas Huth wrote:
> > > On 30.06.2017 20:37, Richard Henderson wrote:
> > > > Cc: qemu-ppc@nongnu.org
> > > > Signed-off-by: Richard Henderson <rth@twiddle.net>
> > > > ---
> > > >  target/ppc/translate.c | 23 ++++++++---------------
> > > >  1 file changed, 8 insertions(+), 15 deletions(-)
> > > 
> > > *ping*
> > > 
> > > Richard, David, any chance that we can still get this in for 2.11? I
> > > think this would be quite a nice performance improvement for PPC TCG...
> > 
> > Uh.. sorry, I don't even remember this patch.
> 
> Managed to dig it out of my archives.  Looks like the problem was it
> was just sent to the lists, not CCed to me.  I'm not generally able to
> keep up with the lists, and I must have missed it on my periodic scans
> through the list.  I've applied it now.

.. and now I've unapplied it, because it doesn't compile.  Richard,
can you resend a current version?

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-10-27 13:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-30 18:37 [Qemu-devel] [PATCH] target/ppc: Use tcg_gen_lookup_and_goto_ptr Richard Henderson
2017-07-01  0:04 ` Emilio G. Cota
2017-09-22 14:33 ` Thomas Huth
2017-10-26 12:22 ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
2017-10-26 13:44   ` Philippe Mathieu-Daudé
2017-10-26 21:12   ` David Gibson
2017-10-27 13:44     ` David Gibson
2017-10-27 13:55       ` David Gibson

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.