From patchwork Fri Nov 23 02:51:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 201236 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 2E7512C03B8 for ; Fri, 23 Nov 2012 13:52:00 +1100 (EST) Received: from mail-ie0-f179.google.com (mail-ie0-f179.google.com [209.85.223.179]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 9E5992C009A for ; Fri, 23 Nov 2012 13:51:32 +1100 (EST) Received: by mail-ie0-f179.google.com with SMTP id 9so3451867iec.38 for ; Thu, 22 Nov 2012 18:51:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=7eN5bUMtF2uR6rwP4mSc8bFpb8qghjg3al+PvCH0tCA=; b=pBQYHjTpWZW9/wY+/DQBRtXTmB4Kh3KdWDkll+tP/U5l5wg0NC4X/Lq1P2flYmMGCz I5xrMULq6r8quinVL8MpWsCT/Sb+2E6aqAlajpcSVgvaauP8IWx8jrBwDiszLic1wCtT Uuea6IKmugQ3i7xayKqyjQlXxBjBZ/2remEZ/spLEB9OHps34B/db2YCak3chw5JztbY iRcfdg9UEFi0+z6WBX9QH/3SQtEGXX0NqsuWMVOzkFeqUyIvxECzGlbnXQ4uG+XGbXIi co3HdIAEzKHLYM+J9EzOFOFAyRqqeARu8whaozm+YBUISBvrFDRZqXYUnGZF3eFnjIjg IXiw== Received: by 10.42.201.201 with SMTP id fb9mr2057967icb.19.1353639089829; Thu, 22 Nov 2012 18:51:29 -0800 (PST) Received: from ka1.ozlabs.ibm.com (ibmaus65.lnk.telstra.net. [165.228.126.9]) by mx.google.com with ESMTPS id eo7sm3743098igc.12.2012.11.22.18.51.26 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Nov 2012 18:51:29 -0800 (PST) From: Alexey Kardashevskiy To: Benjamin Herrenschmidt Subject: [PATCH] powerpc/pseries: Fix kernel crash caused by NULL PE Date: Fri, 23 Nov 2012 13:51:10 +1100 Message-Id: <1353639070-11195-1-git-send-email-aik@ozlabs.ru> X-Mailer: git-send-email 1.8.0.rc3 X-Gm-Message-State: ALoCoQks/k5Y3AnvgrrQBMRYxottNGmWm9VoFdN/qdWF7BLdUSdlrwkMo8fnbDtJ/HIpeuKB0kVO Cc: Alexey Kardashevskiy , David Gibson , linuxppc-dev@lists.ozlabs.org, Gavin Shan , linux-kernel@vger.kernel.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Gavin Shan While hooking MSI interrupts, the corresponding device tree node of the PE that the PCI device has been put into should be checked. However, those PCI devices (e.g. VirtIO based PCI devices) that don't have EEH capability shouldn't have the associated PE. So we shouldn't try to get the PE's device tree node. Otherwise, it would cause kernel crash. Actually, it was introduced by commit 66523d9f ("powerpc/eeh: Trace error based on PE from beginning"). Signed-off-by: Alexey Kardashevskiy Signed-off-by: Gavin Shan --- arch/powerpc/platforms/pseries/msi.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c index d19f497..9284e42 100644 --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c @@ -218,9 +218,16 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total) if (!dn) return NULL; - /* Get the top level device in the PE */ + /* + * Get the top level device in the PE, but some PCI devices + * without EEH capability (e.g. VirtIO based PCI devices) + * don't have the associated PE. So we should not get the + * top level device from PE for those PCI devices. + */ edev = of_node_to_eeh_dev(dn); - edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list); + if (edev->pe) + edev = list_first_entry(&edev->pe->edevs, + struct eeh_dev, list); dn = eeh_dev_to_of_node(edev); if (!dn) return NULL;