Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753986AbdCIWWH (ORCPT ); Thu, 9 Mar 2017 17:22:07 -0500 Received: from mail-oi0-f48.google.com ([209.85.218.48]:36777 "EHLO mail-oi0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753788AbdCIWWF (ORCPT ); Thu, 9 Mar 2017 17:22:05 -0500 Subject: Re: Regression in 4.11 - PowerPC crashes on boot, bisected to commit 5657933dbb6e To: Benjamin Herrenschmidt , Bart Van Assche , "regressions@leemhuis.info" References: <5bc9c08f-58aa-ef26-8891-4837e2d4184b@lwfinger.net> <1488431644.2870.64.camel@kernel.crashing.org> <1488823339.3125.3.camel@sandisk.com> <1f134650-adcf-ef11-21aa-fad9d1dc3c29@lwfinger.net> <1488836928.2870.142.camel@kernel.crashing.org> Cc: "linux-kernel@vger.kernel.org" From: Larry Finger Message-ID: <7914f595-6c77-a0f3-e44a-5441ad29151e@lwfinger.net> Date: Thu, 9 Mar 2017 16:22:01 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <1488836928.2870.142.camel@kernel.crashing.org> Content-Type: multipart/mixed; boundary="------------9AA996529E7C6DD7EFB133F9" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3523 Lines: 93 This is a multi-part message in MIME format. --------------9AA996529E7C6DD7EFB133F9 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 03/06/2017 03:48 PM, Benjamin Herrenschmidt wrote: > On Mon, 2017-03-06 at 13:46 -0600, Larry Finger wrote: >> I was able to create a PPC emulation with debian-8.7.1-powerpc-CD-1.iso >>> following the instructions in https://gmplib.org/~tege/qemu.html. My only >> problem was that "-net tap" fails and I did not find any way to get networking >> working. >> >> After looking at the screen through a number of crashes, I have determined that >> the top entry in the traceback comes from dmam_alloc_coherent(). I have not been >> able to see the offset to determine which BUG_ON call in that routine is being >> triggered. >> >> I tried to modify panic() to see if I could keep the screen on longer after the >> failure, but no joy so far. > > I think the problem is this code in drivers/macintosh/macio_asic.c: > > #ifdef CONFIG_PCI > /* Set the DMA ops to the ones from the PCI device, this could be > * fishy if we didn't know that on PowerMac it's always direct ops > * or iommu ops that will work fine > * > * To get all the fields, copy all archdata > */ > dev->ofdev.dev.archdata = chip->lbus.pdev->dev.archdata; > #endif /* CONFIG_PCI */ > > This is definitely bad. A quick fix is to copy the new dev->dma_ops field > (as well, there is still stuff in archdata that we need too). > > A better long term fix is to have a set of macio_dma_ops wrappers that do > "the right thing". Ben, Attached is a patch that fixes the crash. At the moment, it has my s-o-b, but I do not feel it right to claim authorship. My role should be a Reported-and-tested-by. Please advise. Larry --------------9AA996529E7C6DD7EFB133F9 Content-Type: text/x-patch; name="0001-powerpc-Fix-crash-introduced-with-commit-5657933dbb6.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-powerpc-Fix-crash-introduced-with-commit-5657933dbb6.pa"; filename*1="tch" >From fe51bd0233e10d0eed64cfe177f5d43ca95642a7 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Thu, 9 Mar 2017 16:06:21 -0600 Subject: [PATCH] powerpc: Fix crash introduced with commit 5657933dbb6e Code inserted during the git merges before kernel 4.11-rc1 caused an early panic quickly followed by a complete shutdown. The traceback was not displayed long enough to read or photograph. The problem was bisected to commit 5657933dbb6e ("treewide: Move dma_ops from struct dev_archdata into struct device"). The problem was a missing copy of critical information from struct dev_archdata into struct device, leading to the dereference of a null pointer. Fixes: commit 5657933dbb6e ("treewide: Move dma_ops from struct dev_archdata into struct device") Signed-off-by: Larry Finger --- drivers/macintosh/macio_asic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 3f041b1..f757cef2 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -392,6 +392,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, * To get all the fields, copy all archdata */ dev->ofdev.dev.archdata = chip->lbus.pdev->dev.archdata; + dev->ofdev.dev.dma_ops = chip->lbus.pdev->dev.dma_ops; #endif /* CONFIG_PCI */ #ifdef DEBUG -- 2.10.2 --------------9AA996529E7C6DD7EFB133F9--