OSDN Git Service

powerpc/vphn: NUMA node code expects big-endian
authorGreg Kurz <gkurz@linux.vnet.ibm.com>
Wed, 15 Oct 2014 10:42:58 +0000 (12:42 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 16 Oct 2014 01:43:21 +0000 (12:43 +1100)
commit5c9fb1899400096c6818181c525897a31d57e488
treef41ea0f282134fb9cc9588307ea9980cc11b1f0f
parent4a77f2bdbdef289a02bd02fac483a9350e039705
powerpc/vphn: NUMA node code expects big-endian

The associativity domain numbers are obtained from the hypervisor through
registers and written into memory by the guest: the packed array passed to
vphn_unpack_associativity() is then native-endian, unlike what was assumed
in the following commit:

commit b08a2a12e44eaec5024b2b969f4fcb98169d1ca3
Author: Alistair Popple <alistair@popple.id.au>
Date:   Wed Aug 7 02:01:44 2013 +1000

    powerpc: Make NUMA device node code endian safe

This issue fills the topology with bogus data and makes it unusable. It may
lead to severe performance breakdowns.

We should ideally patch the vphn_unpack_associativity() function to do the
64-bit loads, but this requires some more brain storming.

In the meantime, let's go for a suboptimal and temporary bug fix: this patch
converts each 64-bit value of the packed array to big endian, as expected by
the current parsing code in vphn_unpack_associativity().

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/numa.c