From patchwork Wed Sep 30 07:45:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 7293341 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D70269F314 for ; Wed, 30 Sep 2015 07:45:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D6C21205EC for ; Wed, 30 Sep 2015 07:45:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C56B3205C6 for ; Wed, 30 Sep 2015 07:45:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9F3536E334; Wed, 30 Sep 2015 00:45:44 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 315106E334 for ; Wed, 30 Sep 2015 00:45:43 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 30 Sep 2015 00:45:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,611,1437462000"; d="scan'208,223";a="816076987" Received: from jliu23-mobl.ccr.corp.intel.com (HELO [10.238.128.169]) ([10.238.128.169]) by orsmga002.jf.intel.com with ESMTP; 30 Sep 2015 00:45:40 -0700 Subject: Re: WARNING: CPU: 4 PID: 863 at include/drm/drm_crtc.h:1577 drm_helper_choose_encoder_dpms+0x88/0x90() - evildoer found and neutralized To: Borislav Petkov References: <20150922202105.GB3453@pd.tnic> <20150923072523.GB3383@phenom.ffwll.local> <20150923085950.GA3440@pd.tnic> <20150923144450.GD3383@phenom.ffwll.local> <20150923160621.GA3446@pd.tnic> <20150923161839.GB3446@pd.tnic> <20150926164651.GA3640@pd.tnic> <560A50DC.1040505@linux.intel.com> <20150929105138.GA12037@nazgul.tnic> From: Jiang Liu Organization: Intel Message-ID: <560B9323.6000309@linux.intel.com> Date: Wed, 30 Sep 2015 15:45:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20150929105138.GA12037@nazgul.tnic> Cc: lkml , Maling list - DRI developers , Bjorn Helgaas , Alex Deucher , Thomas Gleixner , =?UTF-8?Q?Christian_K=c3=b6nig?= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP n 2015/9/29 18:51, Borislav Petkov wrote: > On Tue, Sep 29, 2015 at 04:50:36PM +0800, Jiang Liu wrote: >> So could you please help to apply the attached debug patch to gather >> more information about the regression? > > Sure, just did. > > I'm sending you a full s/r cycle attempt caught over serial in a private > message. Hi Boris, From the log file, we got to know that the NULL pointer dereference was caused by AMD IOMMU device. For normal MSI-enabled PCI devices, we get valid irq numbers such as: [ 74.661170] ahci 0000:04:00.0: irqdomain: freeze msi 1 irq28 [ 74.661297] radeon 0000:01:00.0: irqdomain: freeze msi 1 irq47 But for AMD IOMMU device, we got an invalid irq number(0) after enabling MSI as: [ 74.662488] pci 0000:00:00.2: irqdomain: freeze msi 1 irq0 which then caused NULL pointer deference when __pci_restore_msi_state() gets called by system resume code. So we need to figure out why we got irq number 0 after enabling MSI for AMD IOMMU device. The only hint I got is that iommu driver just grabbing the PCI device without providing a PCI device driver for IOMMU PCI device, we have solved a similar case for eata driver. So could you please help to apply this debug patch to gather more info and send me /proc/interrupts? Thanks! Gerry O> > Thanks. > From 57d3013c1c64d9407e432598c645c8de256e0b42 Mon Sep 17 00:00:00 2001 From: Jiang Liu Date: Wed, 30 Sep 2015 14:49:29 +0800 Subject: [PATCH] Debug: Gather more information about AMD iommu device Hi Boris, From the log file, we got to know that the NULL pointer dereference was caused by AMD IOMMU device. For normal MSI-enabled PCI devices, we get valid irq numbers such as: [ 74.661170] ahci 0000:04:00.0: irqdomain: freeze msi 1 irq28 [ 74.661297] radeon 0000:01:00.0: irqdomain: freeze msi 1 irq47 But for AMD IOMMU device, we got an invalid irq number(0) after enabling MSI as: [ 74.662488] pci 0000:00:00.2: irqdomain: freeze msi 1 irq0 which then caused NULL pointer deference when __pci_restore_msi_state() gets called by system resume code. So we need to figure out why we got irq number 0 after enabling MSI for AMD IOMMU device. The only hint I got is that iommu driver just grabbing the PCI device without providing a PCI device driver for IOMMU PCI device, we have solved a similar case for eata driver. So could you please help to apply this debug patch to gather more info and send me /proc/interrupts? Thanks! Gerry Signed-off-by: Jiang Liu --- arch/x86/kernel/apic/msi.c | 6 +++++- drivers/iommu/amd_iommu_init.c | 8 ++++++++ drivers/pci/msi.c | 4 ++++ kernel/irq/msi.c | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c index 5f1feb6854af..050dcf25577c 100644 --- a/arch/x86/kernel/apic/msi.c +++ b/arch/x86/kernel/apic/msi.c @@ -71,6 +71,7 @@ int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) { struct irq_domain *domain; struct irq_alloc_info info; + int ret; init_irq_alloc_info(&info, NULL); info.type = X86_IRQ_ALLOC_TYPE_MSI; @@ -82,7 +83,10 @@ int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) if (domain == NULL) return -ENOSYS; - return pci_msi_domain_alloc_irqs(domain, dev, nvec, type); + ret = pci_msi_domain_alloc_irqs(domain, dev, nvec, type); + dev_warn(&dev->dev, "irqdomain: domain %p, def_domain %p ret%d\n", + domain, msi_default_domain, ret); + return ret; } void native_teardown_msi_irq(unsigned int irq) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 5ef347a13cb5..23cd4d861dba 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -1416,7 +1416,11 @@ static int iommu_setup_msi(struct amd_iommu *iommu) { int r; + dev_warn(&iommu->dev->dev, "irqdomain: before enabling MSI for msi%d, irq%d\n", + iommu->dev->msi_enabled, iommu->dev->irq); r = pci_enable_msi(iommu->dev); + dev_warn(&iommu->dev->dev, "irqdomain: after enabling MSI for msi%d, irq%d\n", + iommu->dev->msi_enabled, iommu->dev->irq); if (r) return r; @@ -1428,6 +1432,8 @@ static int iommu_setup_msi(struct amd_iommu *iommu) if (r) { pci_disable_msi(iommu->dev); + dev_warn(&iommu->dev->dev, "irqdomain: failed to enable MSI for msi%d, irq%d\n", + iommu->dev->msi_enabled, iommu->dev->irq); return r; } @@ -1440,6 +1446,8 @@ static int iommu_init_msi(struct amd_iommu *iommu) { int ret; + dev_warn(&iommu->dev->dev, "irqdomain: init msi for iommu %p int_enabled%d\n", + iommu, iommu->int_enabled); if (iommu->int_enabled) goto enable_faults; diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index d4497141d083..0301a18663b0 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -602,6 +602,8 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) int ret; unsigned mask; + dev_warn(&dev->dev, "irqdomain: enable msi cap msi_enabled%d irq%d\n", + dev->msi_enabled, dev->irq); pci_msi_set_enable(dev, 0); /* Disable MSI during set up */ entry = msi_setup_entry(dev, nvec); @@ -643,6 +645,8 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) pcibios_free_irq(dev); dev->irq = entry->irq; + dev_warn(&dev->dev, "irqdomain: succeed to enable msi cap msi_enabled%d irq%d\n", + dev->msi_enabled, dev->irq); return 0; } diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index 7e6512b9dc1f..535cf59bc5a7 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -298,6 +298,7 @@ int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev, return ret; } + dev_warn(dev, "irqdomain: allocated virq%d\n", virq); for (i = 0; i < desc->nvec_used; i++) irq_set_msi_desc_off(virq, i, desc); } -- 1.7.10.4