Re: [PATCH v2 0/4] VPHN parsing fixes

2015-02-03 Thread Michael Ellerman
On Tue, 2015-02-03 at 08:46 +0100, Greg Kurz wrote:
> On Tue, 03 Feb 2015 13:47:35 +1100
> Michael Ellerman  wrote:
> 
> > On Thu, 2015-01-29 at 19:03 +0100, Greg Kurz wrote:
> > > On Wed, 17 Dec 2014 10:40:46 +0100
> > > Greg Kurz  wrote:
> > > > Hi,
> > > > 
> > > > This series addresses remarks from Ben and Michael (see individual 
> > > > patches).
> > > > The most notable changes are:
> > > > - the parsing code being pull out into a separate file in patch 3/4. 
> > > > This
> > > >   allows to write userland tests like the one below.
> > > > - a full rewrite of the parsing logic in patch 4/4
> > > > 
> > > 
> > > Ping ?
> > 
> > Sorry, lots of patches needing review.
> 
> Heh, no problem. :) Since this isn't bugfix, I can even repost later, when
> the review pressure is lower.

Yeah if you can repost in ~2 weeks that would be perfect.
 
> > This looks pretty good at a glance, but did you actually write a userspace 
> > test
> > for it? If so please send it. I'm happy to rework it into something that 
> > can go
> > in selftests.
> > 
> 
> Yes, I wrote the premise of a test program. You can find it in the cover mail 
> of
> this series:
> 
> https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-December/123601.html
> 
> I'll have a look at selftests.

Thanks. That test looks like a good start, there might be some more cases to
test though?

If you just copy the tools/testing/selftests/powerpc/tm directory and rename to
vhpn, you can probably work out the rest.

cheers


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

Re: [PATCH v2 0/4] VPHN parsing fixes

2015-02-02 Thread Greg Kurz
On Tue, 03 Feb 2015 13:47:35 +1100
Michael Ellerman  wrote:

> On Thu, 2015-01-29 at 19:03 +0100, Greg Kurz wrote:
> > On Wed, 17 Dec 2014 10:40:46 +0100
> > Greg Kurz  wrote:
> > > Hi,
> > > 
> > > This series addresses remarks from Ben and Michael (see individual 
> > > patches).
> > > The most notable changes are:
> > > - the parsing code being pull out into a separate file in patch 3/4. This
> > >   allows to write userland tests like the one below.
> > > - a full rewrite of the parsing logic in patch 4/4
> > > 
> > 
> > Ping ?
> 
> Sorry, lots of patches needing review.
> 

Heh, no problem. :) Since this isn't bugfix, I can even repost later, when
the review pressure is lower.

> This looks pretty good at a glance, but did you actually write a userspace 
> test
> for it? If so please send it. I'm happy to rework it into something that can 
> go
> in selftests.
> 

Yes, I wrote the premise of a test program. You can find it in the cover mail of
this series:

https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-December/123601.html

I'll have a look at selftests.

> cheers
> 
> 

Thanks.

--
Greg

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

Re: [PATCH v2 0/4] VPHN parsing fixes

2015-02-02 Thread Michael Ellerman
On Thu, 2015-01-29 at 19:03 +0100, Greg Kurz wrote:
> On Wed, 17 Dec 2014 10:40:46 +0100
> Greg Kurz  wrote:
> > Hi,
> > 
> > This series addresses remarks from Ben and Michael (see individual patches).
> > The most notable changes are:
> > - the parsing code being pull out into a separate file in patch 3/4. This
> >   allows to write userland tests like the one below.
> > - a full rewrite of the parsing logic in patch 4/4
> > 
> 
> Ping ?

Sorry, lots of patches needing review.

This looks pretty good at a glance, but did you actually write a userspace test
for it? If so please send it. I'm happy to rework it into something that can go
in selftests.

cheers


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

Re: [PATCH v2 0/4] VPHN parsing fixes

2015-01-29 Thread Greg Kurz
On Wed, 17 Dec 2014 10:40:46 +0100
Greg Kurz  wrote:
> Hi,
> 
> This series addresses remarks from Ben and Michael (see individual patches).
> The most notable changes are:
> - the parsing code being pull out into a separate file in patch 3/4. This
>   allows to write userland tests like the one below.
> - a full rewrite of the parsing logic in patch 4/4
> 

Ping ?

> --
> #include 
> #include 
> 
> typedef unsigned long u64;
> typedef unsigned int u32;
> typedef unsigned short u16;
> typedef enum { false = 0, true } bool;
> 
> #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> #define cpu_to_be32(x)bswap_32(x)
> #define be32_to_cpu(x)bswap_32(x)
> #define be16_to_cpup(x)   bswap_16(*x)
> #define cpu_to_be64(x)bswap_64(x)
> #else
> #define cpu_to_be32(x)(x)
> #define be32_to_cpu(x)(x)
> #define be16_to_cpup(x)   (*x)
> #define cpu_to_be64(x)(x)
> #endif
> 
> #define pr_debug(...) printf(__VA_ARGS__)
> 
> #include "vphn.c"
> 
> void print_packed(const long *packed)
> {
>   char *p = (char*) packed;
>   int i;
> 
>   printf("\nRegisters:\n");
>   for (i = 0; i < VPHN_REGISTER_COUNT; i++)
>   printf("0x%016lx\n", packed[i]);
> 
>   printf("\nMemory layout:\n");
>   for (i = 0; i < 6; i++) {
>   printf("0x %02hhx %02hhx %02hhx %02hhx"
>  " %02hhx %02hhx %02hhx %02hhx\n",
>  *(p + 0), *(p + 1), *(p + 2), *(p + 3),
>  *(p + 4), *(p + 5), *(p + 6), *(p + 7));
>   p += 8;
>   }
> 
>   putchar('\n');
> }
> 
> void print_unpacked(const __be32 *unpacked)
> {
>   int i;
> 
>   printf("\nVPHN associativity:\n");
>   for (i = 0; i <= be32_to_cpu(unpacked[0]); i++)
>   printf("0x%08x\n", be32_to_cpu(unpacked[i]));
> 
>   putchar('\n');
> }
> 
> int main(int argc, char **argv)
> {
>   int i;
>   struct {
>   const char *descr;
>   long packed[VPHN_REGISTER_COUNT];
>   } data[] = {
>   {
>   "16-bit and 32-bit",
>   0x8001800280038004,
>   0x8005800680078008,
>   0x0009000a,
>   0x000b000c,
>   0x,
>   0x
>   },
>   {
>   "filled with 16-bit",
>   0x8001800280038004,
>   0x8005800680078008,
>   0x8009800a800b800c,
>   0x800d800e800f8010,
>   0x8011801280138014,
>   0x8015801680178018,
>   },
>   {
>   "filled with 32-bit",
>   0x00010002,
>   0x00030004,
>   0x00050006,
>   0x00070008,
>   0x0009000a,
>   0x000b000c,
>   },
>   {
>   "32-bit has all ones in 16 lower bits",
>   0x000180028003,
>   0x,
>   0x,
>   0x,
>   0x,
>   0x,
>   },
>   {
>   "32-bit accross two 64-bit registers",
>   0x80010002,
>   0x000300048005,
>   0x,
>   0x,
>   0x,
>   0x,
>   },
>   {
>   "Truncated last 32-bit",
>   0x00010002,
>   0x00030004,
>   0x00050006,
>   0x00070008,
>   0x0009000a,
>   0x000b800c0bad,
>   },
>   };
> 
>   for (i = 0; i < sizeof(data) / sizeof(data[0]); i++) {
>   __be32 unpacked[VPHN_ASSOC_BUFSIZE] = { 0 };
>   
> printf("\n==\n");
>   printf("\nSet #%d: %s\n", i, data[i].descr);
>   
> printf("\n==\n");
>   print_packed(data[i].packed);
>   vphn_unpack_associativity(data[i].packed, unpacked);
>   print_unpacked(unpacked);
>   }
> 
>   return 0;
> }
> 
> ---
> 
> Greg Kurz (4):
>   powerpc/vphn: clarify the H_HOME_NODE_ASSOCIATIVITY API
>   powerpc/vphn: move endianness fixing to vphn_unpack_associativity()
>   powerpc/vphn: move VPHN parsing logic 

[PATCH v2 0/4] VPHN parsing fixes

2014-12-17 Thread Greg Kurz
Hi,

This series addresses remarks from Ben and Michael (see individual patches).
The most notable changes are:
- the parsing code being pull out into a separate file in patch 3/4. This
  allows to write userland tests like the one below.
- a full rewrite of the parsing logic in patch 4/4

--
#include 
#include 

typedef unsigned long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef enum { false = 0, true } bool;

#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define cpu_to_be32(x)  bswap_32(x)
#define be32_to_cpu(x)  bswap_32(x)
#define be16_to_cpup(x) bswap_16(*x)
#define cpu_to_be64(x)  bswap_64(x)
#else
#define cpu_to_be32(x)  (x)
#define be32_to_cpu(x)  (x)
#define be16_to_cpup(x) (*x)
#define cpu_to_be64(x)  (x)
#endif

#define pr_debug(...) printf(__VA_ARGS__)

#include "vphn.c"

void print_packed(const long *packed)
{
char *p = (char*) packed;
int i;

printf("\nRegisters:\n");
for (i = 0; i < VPHN_REGISTER_COUNT; i++)
printf("0x%016lx\n", packed[i]);

printf("\nMemory layout:\n");
for (i = 0; i < 6; i++) {
printf("0x %02hhx %02hhx %02hhx %02hhx"
   " %02hhx %02hhx %02hhx %02hhx\n",
   *(p + 0), *(p + 1), *(p + 2), *(p + 3),
   *(p + 4), *(p + 5), *(p + 6), *(p + 7));
p += 8;
}

putchar('\n');
}

void print_unpacked(const __be32 *unpacked)
{
int i;

printf("\nVPHN associativity:\n");
for (i = 0; i <= be32_to_cpu(unpacked[0]); i++)
printf("0x%08x\n", be32_to_cpu(unpacked[i]));

putchar('\n');
}

int main(int argc, char **argv)
{
int i;
struct {
const char *descr;
long packed[VPHN_REGISTER_COUNT];
} data[] = {
{
"16-bit and 32-bit",
0x8001800280038004,
0x8005800680078008,
0x0009000a,
0x000b000c,
0x,
0x
},
{
"filled with 16-bit",
0x8001800280038004,
0x8005800680078008,
0x8009800a800b800c,
0x800d800e800f8010,
0x8011801280138014,
0x8015801680178018,
},
{
"filled with 32-bit",
0x00010002,
0x00030004,
0x00050006,
0x00070008,
0x0009000a,
0x000b000c,
},
{
"32-bit has all ones in 16 lower bits",
0x000180028003,
0x,
0x,
0x,
0x,
0x,
},
{
"32-bit accross two 64-bit registers",
0x80010002,
0x000300048005,
0x,
0x,
0x,
0x,
},
{
"Truncated last 32-bit",
0x00010002,
0x00030004,
0x00050006,
0x00070008,
0x0009000a,
0x000b800c0bad,
},
};

for (i = 0; i < sizeof(data) / sizeof(data[0]); i++) {
__be32 unpacked[VPHN_ASSOC_BUFSIZE] = { 0 };

printf("\n==\n");
printf("\nSet #%d: %s\n", i, data[i].descr);

printf("\n==\n");
print_packed(data[i].packed);
vphn_unpack_associativity(data[i].packed, unpacked);
print_unpacked(unpacked);
}

return 0;
}

---

Greg Kurz (4):
  powerpc/vphn: clarify the H_HOME_NODE_ASSOCIATIVITY API
  powerpc/vphn: move endianness fixing to vphn_unpack_associativity()
  powerpc/vphn: move VPHN parsing logic to a separate file
  powerpc/vphn: parsing code rewrite


 arch/powerpc/mm/Makefile |1 +
 arch/powerpc/mm/numa.c   |   55 ++--
 arch/powerpc/mm/vphn.c   |   70 ++