Branch record attributes 'mispred' and 'predicted' are single bit
fields as defined in the perf ABI. Hence the data type of the field
'pred' used during BHRB processing should be changed from integer
to bool. This patch also changes the name of the variable from 'pred'
to 'mispred' making the logical inversion process more meaningful
and readable.

Reported-by: Daniel Axtens <d...@axtens.net>
Signed-off-by: Anshuman Khandual <khand...@linux.vnet.ibm.com>
---
 arch/powerpc/perf/core-book3s.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index d1e65ce..a158923 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -426,7 +426,8 @@ static void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw)
 {
        u64 val;
        u64 addr;
-       int r_index, u_index, pred;
+       int r_index, u_index;
+       bool mispred;
 
        r_index = 0;
        u_index = 0;
@@ -438,7 +439,7 @@ static void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw)
                        break;
                else {
                        addr = val & BHRB_EA;
-                       pred = val & BHRB_PREDICTION;
+                       mispred = val & BHRB_PREDICTION;
 
                        if (!addr)
                                /* invalid entry */
@@ -467,8 +468,9 @@ static void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw)
                                 * (ie. computed gotos/XL form)
                                 */
                                cpuhw->bhrb_entries[u_index].to = addr;
-                               cpuhw->bhrb_entries[u_index].mispred = pred;
-                               cpuhw->bhrb_entries[u_index].predicted = ~pred;
+                               cpuhw->bhrb_entries[u_index].mispred = mispred;
+                               cpuhw->bhrb_entries[u_index].predicted =
+                                                               ~mispred;
 
                                /* Get from address in next entry */
                                val = read_bhrb(r_index++);
@@ -486,8 +488,9 @@ static void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw)
                                cpuhw->bhrb_entries[u_index].from = addr;
                                cpuhw->bhrb_entries[u_index].to =
                                        power_pmu_bhrb_to(addr);
-                               cpuhw->bhrb_entries[u_index].mispred = pred;
-                               cpuhw->bhrb_entries[u_index].predicted = ~pred;
+                               cpuhw->bhrb_entries[u_index].mispred = mispred;
+                               cpuhw->bhrb_entries[u_index].predicted =
+                                                               ~mispred;
                        }
                        u_index++;
 
-- 
2.1.0

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to