qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@au1.ibm.com>
To: Aaron Larson <alarson@ddci.com>,
	agraf@suse.de, david@gibson.dropbear.id.au,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH] target-ppc: gen_pause for instructions: yield, mdoio, mdoom, miso
Date: Wed, 29 Jun 2016 22:00:57 +1000	[thread overview]
Message-ID: <1467201657.20278.231.camel@au1.ibm.com> (raw)
In-Reply-To: <201606242018.u5OKISiY007160@linux03a.ddci.com>

On Fri, 2016-06-24 at 13:18 -0700, Aaron Larson wrote:
> Call gen_pause for all "or rx,rx,rx" encodings other nop.  This
> provides a reasonable implementation for yield, and a better
> approximation for mdoio, mdoom, and miso.  The choice to pause for
> all
> encodings !=0 leverages the PowerISA admonition that the reserved
> encodings might change program priority, providing a slight "future
> proofing".
> 
> Signed-off-by: Aaron Larson <alarson@ddci.com>

Acked-by: Benjamin Herrenschmidt <benh@kerne.crashing.org>

> ---
>  target-ppc/translate.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/target-ppc/translate.c b/target-ppc/translate.c
> index 2f1c591..c4559b6 100644
> --- a/target-ppc/translate.c
> +++ b/target-ppc/translate.c
> @@ -1471,7 +1471,7 @@ static void gen_or(DisasContext *ctx)
>      } else if (unlikely(Rc(ctx->opcode) != 0)) {
>          gen_set_Rc0(ctx, cpu_gpr[rs]);
>  #if defined(TARGET_PPC64)
> -    } else {
> +    } else if (rs != 0) { /* 0 is nop */
>          int prio = 0;
>  
>          switch (rs) {
> @@ -1514,7 +1514,6 @@ static void gen_or(DisasContext *ctx)
>              break;
>  #endif
>          default:
> -            /* nop */
>              break;
>          }
>          if (prio) {
> @@ -1524,13 +1523,15 @@ static void gen_or(DisasContext *ctx)
>              tcg_gen_ori_tl(t0, t0, ((uint64_t)prio) << 50);
>              gen_store_spr(SPR_PPR, t0);
>              tcg_temp_free(t0);
> -            /* Pause us out of TCG otherwise spin loops with smt_low
> -             * eat too much CPU and the kernel hangs
> -             */
> +        }
>  #if !defined(CONFIG_USER_ONLY)
> -            gen_pause(ctx);
> +        /* Pause out of TCG otherwise spin loops with smt_low eat
> too much
> +         * CPU and the kernel hangs.  This applies to all encodings
> other
> +         * than no-op, e.g., miso(rs=26), yield(27), mdoio(29),
> mdoom(30),
> +         * and all currently undefined.
> +         */
> +        gen_pause(ctx);
>  #endif
> -        }
>  #endif
>      }
>  }


  parent reply	other threads:[~2016-06-29 12:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-24 20:18 [Qemu-devel] [PATCH] target-ppc: gen_pause for instructions: yield, mdoio, mdoom, miso Aaron Larson
2016-06-27  1:29 ` David Gibson
2016-06-29 12:00 ` Benjamin Herrenschmidt [this message]
2016-06-30  0:44   ` [Qemu-devel] [Qemu-ppc] " David Gibson

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=1467201657.20278.231.camel@au1.ibm.com \
    --to=benh@au1.ibm.com \
    --cc=agraf@suse.de \
    --cc=alarson@ddci.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).