Commit 37cd8ed90fc5b11941110d2d0cea6807f86d4787

Authored by Gerhard Stenzel
Committed by Benjamin Herrenschmidt
1 parent 49a8496525

powerpc/cell: Make ptcal more reliable

There have been a series of checkstops on QS21 related to
ptcal being set up incorrectly. On systems that only
have memory on a single node, ptcal fails when it gets
a pointer to memory on the remote node.

Moreover, agressive prefetching in memcpy and other
functions may accidentally touch the first cache line
of the page that we reserve for ptcal, which causes
an ECC checkstop.

We now allocate pages only from the specified node, moves the
ptcal area into the middle of the allocated page to avoid
potential prefetch problems and prints the address of the
ptcal area to facilitate diagnostics.

Signed-off-by: Gerhard Stenzel <gerhard.stenzel@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Showing 1 changed file with 14 additions and 3 deletions Side-by-side Diff

arch/powerpc/platforms/cell/ras.c
... ... @@ -122,12 +122,23 @@
122 122  
123 123 area->nid = nid;
124 124 area->order = order;
125   - area->pages = alloc_pages_node(area->nid, GFP_KERNEL, area->order);
  125 + area->pages = alloc_pages_node(area->nid, GFP_KERNEL | GFP_THISNODE,
  126 + area->order);
126 127  
127   - if (!area->pages)
  128 + if (!area->pages) {
  129 + printk(KERN_WARNING "%s: no page on node %d\n",
  130 + __func__, area->nid);
128 131 goto out_free_area;
  132 + }
129 133  
130   - addr = __pa(page_address(area->pages));
  134 + /*
  135 + * We move the ptcal area to the middle of the allocated
  136 + * page, in order to avoid prefetches in memcpy and similar
  137 + * functions stepping on it.
  138 + */
  139 + addr = __pa(page_address(area->pages)) + (PAGE_SIZE >> 1);
  140 + printk(KERN_DEBUG "%s: enabling PTCAL on node %d address=0x%016lx\n",
  141 + __func__, area->nid, addr);
131 142  
132 143 ret = -EIO;
133 144 if (rtas_call(ptcal_start_tok, 3, 1, NULL, area->nid,