From patchwork Fri Apr 28 11:56:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan Ramabadhran X-Patchwork-Id: 9704513 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7C77F602B7 for ; Fri, 28 Apr 2017 11:57:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 675252866B for ; Fri, 28 Apr 2017 11:57:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A9CC2867A; Fri, 28 Apr 2017 11:57:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C32EF2866B for ; Fri, 28 Apr 2017 11:56:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969101AbdD1L45 (ORCPT ); Fri, 28 Apr 2017 07:56:57 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:50746 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966205AbdD1L4u (ORCPT ); Fri, 28 Apr 2017 07:56:50 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4F5DF61581; Fri, 28 Apr 2017 11:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1493380608; bh=TYlD+nXr0O9gJzmeF7wGwS0Z3S/+5FRuib8Oe+F5Y2Y=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=jsfBLBwheetjngqQ3uXw5hYpmsA+tql5x5GNFc/sy4ADca9Sk78X4i3m6m4/MYPOR uTJCvRAZcpYTp1gaVQlCzXFnLycoR/P5suQrfOR6L8F48i+Zi4UkDNP5pb0f5TiOdO NJURMeimzmJ2d99kqS4POuGohRdzLKoSxT2Z3Ngg= Received: from [10.201.3.39] (unknown [202.46.23.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sricharan@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 40204614BF; Fri, 28 Apr 2017 11:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1493380607; bh=TYlD+nXr0O9gJzmeF7wGwS0Z3S/+5FRuib8Oe+F5Y2Y=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=fehMPKmjAq8RkIoepShQ04xwMjVrzV7zRCzTVw5lURx+X04uVfmmcF+KinFdneBfb 9Sj5xrfIvYYKDbOs/TTKfaTtT2hhCJY/2nR+7LpAY0VBuB7DB33zwyVPGjZUE/wW/3 EEmNdDyFJI0o327g9fPb5jNuP8daWt5m5+24RdGA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 40204614BF Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sricharan@codeaurora.org Subject: Re: [REGRESSION next-20170426] Commit 09515ef5ddad ("of/acpi: Configure dma operations at probe time for platform/amba/pci bus devices") causes oops in mvneta To: Ralph Sennhauser Cc: "Rafael J. Wysocki" , Joerg Roedel , Bjorn Helgaas , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Thomas Petazzoni , netdev@vger.kernel.org References: <20170426181508.687b52af@gmail.com> <2fb57b9b-3944-d9cc-1fac-8dcccaa0c37a@codeaurora.org> <20170427164014.422a124c@gmail.com> <524b7fc8-1eca-a7d8-7bc7-6743be17c208@codeaurora.org> <20170428081919.21bb569d@gmail.com> From: Sricharan R Message-ID: Date: Fri, 28 Apr 2017 17:26:41 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: <20170428081919.21bb569d@gmail.com> Content-Language: en-US Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Ralph, >>>>> >>>>> Commit 09515ef5ddad ("of/acpi: Configure dma operations at probe >>>>> time for platform/amba/pci bus devices") causes a kernel panic as >>>>> in the log below on an armada-385. Reverting the commit fixes the >>>>> issue. >>>>> >>>>> Regards >>>>> Ralph >>>> >>>> Somehow not getting a obvious clue on whats going wrong with the >>>> logs below. From the log and looking in to dts, the drivers seems >>>> to the one for "marvell,armada-370-neta". >>> >>> Correct. >>> >>>> Issue looks the data from the dma >>>> has gone bad and subsequently referring the wrong data has resulted >>>> in the crash. Looks like the dma_masks is the one going wrong. >>>> Can i get some logs from mvneta_probe, about dev->dma_mask, >>>> dev->coherent_dma_mask and dev->dma_ops with and without the patch >>>> to see whats the difference ? >>> >>> Not sure I understood what exactly you are after. Might be faster to >>> just send me a patch with all debug print statements you like to >>> see. >> >> Attached the patch with debug prints. >> >> Regards, >> Sricharan >> > > Hi Sricharan > > With commit 09515ef5ddad > > [ 1.288962] mvneta f1070000.ethernet: dev->dma_mask 0xffffffff > [ 1.294827] mvneta f1070000.ethernet: dev->coherent_dma_mask 0xffffffff > [ 1.301472] mvneta f1070000.ethernet: dev->dma_ops 0x40b00c0601460 > > [ 1.322047] mvneta f1034000.ethernet: dev->dma_mask 0xffffffff > [ 1.327904] mvneta f1034000.ethernet: dev->coherent_dma_mask 0xffffffff > [ 1.334549] mvneta f1034000.ethernet: dev->dma_ops 0x40b00c0601460 > > > With the patch reverted, the build that works > > [ 1.289001] mvneta f1070000.ethernet: dev->dma_mask 0xffffffff > [ 1.294866] mvneta f1070000.ethernet: dev->coherent_dma_mask 0xffffffff > [ 1.301511] mvneta f1070000.ethernet: dev->dma_ops 0x40b00c06014a8 > > [ 1.317005] mvneta f1034000.ethernet: dev->dma_mask 0xffffffff > [ 1.322867] mvneta f1034000.ethernet: dev->coherent_dma_mask 0xffffffff > [ 1.329508] mvneta f1034000.ethernet: dev->dma_ops 0x40b00c06014a8 > My bad, i think it is this patch missing [1], attached it as well. Infact, this was in the series initially and got acked to get merged separately well before the series. I should have sent this to Russell. I will do this now. If this fixes up the issue, i will take this patch separately, while this series gets tested on -next. [1] https://patchwork.kernel.org/patch/9362113/ diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 0268584..c742dfd 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -2408,6 +2408,15 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, const struct dma_map_ops *dma_ops; dev->archdata.dma_coherent = coherent; + + /* + * Don't override the dma_ops if they have already been set. Ideally + * this should be the only location where dma_ops are set, remove this + * check when all other callers of set_dma_ops will have disappeared. + */ + if (dev->dma_ops) + return; + if (arm_setup_iommu_dma_ops(dev, dma_base, size, iommu)) dma_ops = arm_get_iommu_dma_map_ops(coherent); else