powerpc/pseries: Fix how we iterate over the DTL entries
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Thu, 27 Sep 2018 08:10:58 +0000 (13:40 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 3 Oct 2018 05:40:02 +0000 (15:40 +1000)
When CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not set, we look up dtl_idx in
the lppaca to determine the number of entries in the buffer. Since
lppaca is in big endian, we need to do an endian conversion before using
this in our calculation to determine the number of entries in the
buffer. Without this, we do not iterate over the existing entries in the
DTL buffer properly.

Fixes: 7c105b63bd98 ("powerpc: Add CONFIG_CPU_LITTLE_ENDIAN kernel config option.")
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/pseries/dtl.c

index c762689e0eb33e69b30ff41c03ee8f75f0a2ed66..ef6595153642e3af4b5f52b300cbb3dd7d6b6d1f 100644 (file)
@@ -184,7 +184,7 @@ static void dtl_stop(struct dtl *dtl)
 
 static u64 dtl_current_index(struct dtl *dtl)
 {
-       return lppaca_of(dtl->cpu).dtl_idx;
+       return be64_to_cpu(lppaca_of(dtl->cpu).dtl_idx);
 }
 #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */