* [Qemu-devel] [PATCH] target-ppc: gen_pause for instructions: yield, mdoio, mdoom, miso
@ 2016-06-24 20:18 Aaron Larson
2016-06-27 1:29 ` David Gibson
2016-06-29 12:00 ` [Qemu-devel] [Qemu-ppc] " Benjamin Herrenschmidt
0 siblings, 2 replies; 4+ messages in thread
From: Aaron Larson @ 2016-06-24 20:18 UTC (permalink / raw)
To: agraf, alarson, david, qemu-devel, qemu-ppc
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>
---
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
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] target-ppc: gen_pause for instructions: yield, mdoio, mdoom, miso
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 ` [Qemu-devel] [Qemu-ppc] " Benjamin Herrenschmidt
1 sibling, 0 replies; 4+ messages in thread
From: David Gibson @ 2016-06-27 1:29 UTC (permalink / raw)
To: Aaron Larson; +Cc: agraf, qemu-devel, qemu-ppc
[-- Attachment #1: Type: text/plain, Size: 2397 bytes --]
On Fri, Jun 24, 2016 at 01:18:28PM -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>
As far as I can tell, this is ok. However, I'd like to get a second
opinion from agraf or BenH before I apply it.
> ---
> 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
> }
> }
--
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: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] target-ppc: gen_pause for instructions: yield, mdoio, mdoom, miso
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
2016-06-30 0:44 ` David Gibson
1 sibling, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2016-06-29 12:00 UTC (permalink / raw)
To: Aaron Larson, agraf, david, qemu-devel, qemu-ppc
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
> }
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] target-ppc: gen_pause for instructions: yield, mdoio, mdoom, miso
2016-06-29 12:00 ` [Qemu-devel] [Qemu-ppc] " Benjamin Herrenschmidt
@ 2016-06-30 0:44 ` David Gibson
0 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2016-06-30 0:44 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Aaron Larson, agraf, qemu-devel, qemu-ppc
[-- Attachment #1: Type: text/plain, Size: 2575 bytes --]
On Wed, Jun 29, 2016 at 10:00:57PM +1000, Benjamin Herrenschmidt wrote:
> 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>
Applied to ppc-for-2.7, thanks.
> > ---
> > 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
> > }
> > }
>
--
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: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-30 1:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [Qemu-devel] [Qemu-ppc] " Benjamin Herrenschmidt
2016-06-30 0:44 ` 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.