From patchwork Mon Jul 7 23:37:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 4498631 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0CF74BEEAA for ; Mon, 7 Jul 2014 23:41:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 33C0B202FF for ; Mon, 7 Jul 2014 23:41:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 495D92012F for ; Mon, 7 Jul 2014 23:41:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4IV7-0006EW-A6; Mon, 07 Jul 2014 23:39:13 +0000 Received: from top.free-electrons.com ([176.31.233.9] helo=mail.free-electrons.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4IV4-0006Ad-9y for linux-arm-kernel@lists.infradead.org; Mon, 07 Jul 2014 23:39:11 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id 70F9A7C6; Tue, 8 Jul 2014 01:38:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost (unknown [190.2.108.81]) by mail.free-electrons.com (Postfix) with ESMTPSA id 774AE159; Tue, 8 Jul 2014 01:38:49 +0200 (CEST) Date: Mon, 7 Jul 2014 20:37:58 -0300 From: Ezequiel Garcia To: Greg Kroah-Hartman , Paolo Pisati Subject: Re: 3.16rc3 multiplatform, Armada 370 and IOMMU: unbootable kernel Message-ID: <20140707233758.GA1456@arch.cereza> References: <20140703135146.GA6898@luxor.wired.org> <53B5C61D.2060308@free-electrons.com> <53B5CA26.7050405@free-electrons.com> <1936558.QaAG1bYMuD@avalon> <20140705150308.GA28791@arch.cereza> <20140705205951.GB3678@kroah.com> <20140707105818.GA1101@arch.cereza> <20140707183002.GA5947@kroah.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140707183002.GA5947@kroah.com> User-Agent: Mutt/1.5.22 (2013-10-16) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140707_163910_649398_6B9F6304 X-CRM114-Status: GOOD ( 19.42 ) X-Spam-Score: 0.3 (/) Cc: Thomas Petazzoni , Andrew Lunn , Jason Cooper , linux-arm-kernel@lists.infradead.org, Joerg Roedel , Hiroshi.DOYU@nokia.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Laurent Pinchart , Gregory CLEMENT , Florian Vaussard , Sebastian Hesselbarth X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On 07 Jul 11:30 AM, Greg Kroah-Hartman wrote: > On Mon, Jul 07, 2014 at 07:58:18AM -0300, Ezequiel Garcia wrote: [..] > > > > I guess I snipped the thread and lost most of the information about the panic. > > Here's the original bug report: > > > > http://www.spinics.net/lists/arm-kernel/msg344059.html > > > > The problem reported involves enabling OMAP IOMMU driver and not any other IOMMU > > driver. Doing some tracing and adding a few prints, we found that > > omap_iommu_init() sets a bus notifier for the platform bus type: > > > > omap_iommu_init -> bus_set_iommu -> iommu_bus_init: > > > > static void iommu_bus_init(struct bus_type *bus, struct iommu_ops *ops) > > { > > bus_register_notifier(bus, &iommu_bus_nb); > > bus_for_each_dev(bus, NULL, ops, add_iommu_group); > > } > > > > But the iommu bus notifier gets called for the 'pci' bus type, which > > has the iommu_ops field NULL (since it hasn't been set for iommu). > > So this is what needs to be figured out, how is the notifier being > called with a PCI device? Who else called iommu_bus_init() for the PCI > bus? > Nobody. The only caller of iommu_bus_init() the above OMAP IOMMU. However, I found something interesting. Tried to bisect this without much luck; I did two bisects and ended up in the same merge commit: # good: [0f16aa3c24a216d14d7f0587e1cbd2c1b51a38f3] Merge tag 'samsung-dt-3' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung into next/dt # first bad commit: [755a9ba7bf24a45b6dbf8bb15a5a56c8ed12461a] Merge tag 'dt-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc into next So, after doing a few diff's between that good and bad and searching for "bus_notifier" changes, saw something strange in arch/arm/mach-mvebu/coherency.c. It seems bus_register_notifier() is been called for platform and pci devices with the *same* notifier block. Haven't looked close enough, but you mentioned that could cause trouble? This patch fixes the issue here: Paolo, can you apply it and confirm it fixes the problem? Greg, can you confirm using the same notifier block pointer for two different bus types makes the bus notifier go nuts? Thanks for the help, diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c index 477202f..2bdc323 100644 --- a/arch/arm/mach-mvebu/coherency.c +++ b/arch/arm/mach-mvebu/coherency.c @@ -292,6 +292,10 @@ static struct notifier_block mvebu_hwcc_nb = { .notifier_call = mvebu_hwcc_notifier, }; +static struct notifier_block mvebu_hwcc_pci_nb = { + .notifier_call = mvebu_hwcc_notifier, +}; + static void __init armada_370_coherency_init(struct device_node *np) { struct resource res; @@ -427,7 +431,7 @@ static int __init coherency_pci_init(void) { if (coherency_available()) bus_register_notifier(&pci_bus_type, - &mvebu_hwcc_nb); + &mvebu_hwcc_pci_nb); return 0; }