Skip to contentSkip to conversation

target/ppc: Test CF_NO_GOTO_PTR in cflags, not in TB flags

PATCH In review Philippe Mathieu-Daudé 3 participants 5 messages Nov 17 – Nov 18

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/ppc: Test CF_NO_GOTO_PTR in cflags, not in TB flags

CF_NO_GOTO_PTR is a TB cflags bit, but it was tested against tb->flags, where bit 10 is HFLAGS_SE. Use tb_cflags().

Fixes 46d396bde988 ("target/ppc: enable PMU instruction count")
---
 target/ppc/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/ppc/translate.c +2 -2
index 467b8f3d4ec2..dccae25bb4ec 100644
@@ -2645,7 +2645,7 @@ static void gen_lookup_and_goto_ptr(DisasContext *ctx)
          * tcg_gen_lookup_and_goto_ptr will exit the TB if
          * CF_NO_GOTO_PTR is set. Count insns now.
          */
-        if (ctx->base.tb->flags & CF_NO_GOTO_PTR) {
+        if (tb_cflags(ctx->base.tb) & CF_NO_GOTO_PTR) {
             pmu_count_insns(ctx);
         }
 
@@ -5160,7 +5160,7 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
          * tcg_gen_lookup_and_goto_ptr will exit the TB if
          * CF_NO_GOTO_PTR is set. Count insns now.
          */
-        if (ctx->base.tb->flags & CF_NO_GOTO_PTR) {
+        if (tb_cflags(ctx->base.tb) & CF_NO_GOTO_PTR) {
             pmu_count_insns(ctx);
         }
 
Signature · 1 line
2.55.0
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 23 lines · Philippe Mathieu-Daudé

CF_NO_GOTO_PTR is a TB cflags bit, but it was tested against tb->flags, where bit 10 is HFLAGS_SE. Use tb_cflags().

Fixes 46d396bde988 ("target/ppc: enable PMU instruction count")
---
  target/ppc/translate.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
target/ppc/translate.c +1 -1
index 467b8f3d4ec2..dccae25bb4ec 100644
@@ -2645,7 +2645,7 @@ static void gen_lookup_and_goto_ptr(DisasContext *ctx)
           * tcg_gen_lookup_and_goto_ptr will exit the TB if
           * CF_NO_GOTO_PTR is set. Count insns now.
           */
-        if (ctx->base.tb->flags & CF_NO_GOTO_PTR) {
+        if (tb_cflags(ctx->base.tb) & CF_NO_GOTO_PTR) {
              pmu_count_insns(ctx);
          }
 

target/ppc/translate.c static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) · line 5165

Quoted 7 lines
target/ppc/translate.c +1 -1
@@ -5160,7 +5160,7 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
           * tcg_gen_lookup_and_goto_ptr will exit the TB if
           * CF_NO_GOTO_PTR is set. Count insns now.
           */
-        if (ctx->base.tb->flags & CF_NO_GOTO_PTR) {
+        if (tb_cflags(ctx->base.tb) & CF_NO_GOTO_PTR) {
              pmu_count_insns(ctx);
          }

Hi Philippe,
Thanks for addressing the review comments brought up by Anton and Matt on the original patch :
https://lore.kernel.org/qemu-devel/[email protected]/

I think it'd be correct to include the original "Reported-by" and "Reviewed-by"s from the above mentioned patch as well.

+cc : Matt and Anton

Regards,
Chinmay

Quoted 1 line
#3 lore raw
Quoted 28 lines · Chinmay Rath
Quoted 26 lines · Philippe Mathieu-Daudé

CF_NO_GOTO_PTR is a TB cflags bit, but it was tested against tb->flags, where bit 10 is HFLAGS_SE. Use tb_cflags().

Fixes 46d396bde988 ("target/ppc: enable PMU instruction count")

---
  target/ppc/translate.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
target/ppc/translate.c +1 -1
index 467b8f3d4ec2..dccae25bb4ec 100644
@@ -2645,7 +2645,7 @@ static void gen_lookup_and_goto_ptr(DisasContext 
 *ctx)
            * tcg_gen_lookup_and_goto_ptr will exit the TB if
            * CF_NO_GOTO_PTR is set. Count insns now.
            */
-        if (ctx->base.tb->flags & CF_NO_GOTO_PTR) {
+        if (tb_cflags(ctx->base.tb) & CF_NO_GOTO_PTR) {
               pmu_count_insns(ctx);
           }
@@ -5160,7 +5160,7 @@ static void ppc_tr_tb_stop(DisasContextBase 
 *dcbase, CPUState *cs)
            * tcg_gen_lookup_and_goto_ptr will exit the TB if
            * CF_NO_GOTO_PTR is set. Count insns now.
Quoted 8 lines

target/ppc/translate.c static void gen_lookup_and_goto_ptr(DisasContext *ctx) · line 2650

Quoted 5 lines
target/ppc/translate.c +1 -1
            */
-        if (ctx->base.tb->flags & CF_NO_GOTO_PTR) {
+        if (tb_cflags(ctx->base.tb) & CF_NO_GOTO_PTR) {
               pmu_count_insns(ctx);
           }

Hi Philippe,
Thanks for addressing the review comments brought up by Anton and Matt on the original patch :
https://lore.kernel.org/qemu-devel/20261104163854.87398-1- [email protected]/

Amusing, I was not aware of this patch, we figured it within a 2 week interval :) The ppc_tr_tb_stop() path is not updated however. Richard, do you rather respin your patch with the ppc_tr_tb_stop() change or keep this one?

Quoted 2 lines

I think it'd be correct to include the original "Reported-by" and "Reviewed-by"s from the above mentioned patch as well.

Sure.

Quoted 6 lines

+cc : Matt and Anton

Regards,
Chinmay

#4 lore raw
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 3 lines

Hi Philippe,
Thanks for addressing the review comments brought up by Anton and Matt on the original patch :
https://lore.kernel.org/qemu-devel/20261104163854.87398-1- [email protected]/

Amusing, I was not aware of this patch, we figured it within a 2 week interval :) The ppc_tr_tb_stop() path is not updated however. Richard, do you rather respin your patch with the ppc_tr_tb_stop() change or keep this one?

Keep this one, Phil.

r~