From patchwork Mon May 4 19:32:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stenzel@de.ibm.com X-Patchwork-Id: 26855 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id C2FD5B7066 for ; Tue, 5 May 2009 05:33:05 +1000 (EST) Received: by ozlabs.org (Postfix) id 752BCDE0E9; Tue, 5 May 2009 05:32:44 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 733ACDE0B6 for ; Tue, 5 May 2009 05:32:44 +1000 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from mtagate2.de.ibm.com (mtagate2.de.ibm.com [195.212.17.162]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mtagate2.de.ibm.com", Issuer "Equifax" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 6D574DDDA9 for ; Tue, 5 May 2009 05:32:11 +1000 (EST) Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.1/8.13.1) with ESMTP id n44JW6Bt013939 for ; Mon, 4 May 2009 19:32:06 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n44JW6793580154 for ; Mon, 4 May 2009 21:32:06 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n44JW69x022448 for ; Mon, 4 May 2009 21:32:06 +0200 Received: from stenzel-desktop (sig-9-145-69-38.uk.ibm.com [9.145.69.38]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n44JW40q022436 for ; Mon, 4 May 2009 21:32:05 +0200 From: stenzel@de.ibm.com Date: Mon, 04 May 2009 21:32:01 +0200 Message-Id: <87iqkgd5qm.fsf@de.ibm.com> To: linuxppc-dev@ozlabs.org Subject: [Patch] powerpc/cell: make ptcal more reliable X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org This is for QS21. The following patch allocates 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 =================================================================== Best regards, Gerhard Stenzel, Linux on Cell Development, LTC ------------------------------------------------------------------------------------- IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter | Geschaeftsfuehrung: Erich Baier Sitz der Gesellschaft: Boeblingen | Registergericht: Amtsgericht Stuttgart, HRB 243294 Index: linux-2.6/arch/powerpc/platforms/cell/ras.c =================================================================== --- linux-2.6.orig/arch/powerpc/platforms/cell/ras.c +++ linux-2.6/arch/powerpc/platforms/cell/ras.c @@ -122,12 +122,22 @@ static int __init cbe_ptcal_enable_on_no area->nid = nid; area->order = order; - area->pages = alloc_pages_node(area->nid, GFP_KERNEL, area->order); + area->pages = alloc_pages_node(area->nid, GFP_KERNEL | GFP_THISNODE, area->order); - if (!area->pages) + if (!area->pages) { + printk(KERN_INFO "%s: no page on node %d\n", + __FUNCTION__, area->nid); goto out_free_area; + } - addr = __pa(page_address(area->pages)); + /* + * We move the ptcal area to the middle of the allocated + * page, in order to avoid prefetches in memcpy and similar + * functions stepping on it. + */ + addr = __pa(page_address(area->pages)) + (PAGE_SIZE >> 1); + printk(KERN_INFO "%s: enabling PTCAL on node %d address=0x%016lx PAGE_SIZE>>1=0x%016lx \n", + __FUNCTION__, area->nid, addr, PAGE_SIZE>>1); ret = -EIO; if (rtas_call(ptcal_start_tok, 3, 1, NULL, area->nid,