{"id":806995,"url":"http://patchwork.ozlabs.org/api/1.0/patches/806995/?format=json","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.0/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/"},"msgid":"<20170829073404.8885-6-aik@ozlabs.ru>","date":"2017-08-29T07:34:03","name":"[kernel,v2,5/6] powerpc/eeh: Reduce use of pci_dn::node","commit_ref":"14db3d52d3a214ae8132a403de410af7643cb8b0","pull_url":null,"state":"accepted","archived":false,"hash":"92256e9b5071795d002e9c77477fc895f919e257","submitter":{"id":7621,"url":"http://patchwork.ozlabs.org/api/1.0/people/7621/?format=json","name":"Alexey Kardashevskiy","email":"aik@ozlabs.ru"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170829073404.8885-6-aik@ozlabs.ru/mbox/","series":[{"id":322,"url":"http://patchwork.ozlabs.org/api/1.0/series/322/?format=json","date":"2017-08-29T07:34:01","name":"powerpc/eeh: Some cleanups","version":2,"mbox":"http://patchwork.ozlabs.org/series/322/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/806995/checks/","tags":{},"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xhLH33M50z9s83\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 17:43:43 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xhLH31t7LzDrbJ\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 17:43:43 +1000 (AEST)","from ozlabs.ru (ozlabs.ru [107.173.13.209])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xhL4k34b3zDqYG\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 29 Aug 2017 17:34:46 +1000 (AEST)","from vpl1.ozlabs.ibm.com (localhost [IPv6:::1])\n\tby ozlabs.ru (Postfix) with ESMTP id B435C3A60056;\n\tTue, 29 Aug 2017 03:35:22 -0400 (EDT)"],"From":"Alexey Kardashevskiy <aik@ozlabs.ru>","To":"linuxppc-dev@lists.ozlabs.org","Subject":"[PATCH kernel v2 5/6] powerpc/eeh: Reduce use of pci_dn::node","Date":"Tue, 29 Aug 2017 17:34:03 +1000","Message-Id":"<20170829073404.8885-6-aik@ozlabs.ru>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170829073404.8885-1-aik@ozlabs.ru>","References":"<20170829073404.8885-1-aik@ozlabs.ru>","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"Alexey Kardashevskiy <aik@ozlabs.ru>,\n\tAndrew Donnellan <andrew.donnellan@au1.ibm.com>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"The pci_dn struct caches a OF device node pointer in order to access\nthe \"ibm,loc-code\" property when EEH is recovering.\n\nHowever, when this happens in eeh_dev_check_failure(), we also have\na pci_dev pointer which should have a valid pointer to the device node\nwhen pci_dn has one (both pointers are not NULL for physical functions\nand are NULL for virtual functions).\n\nThis changes pci_remove_device_node_info() to look for a parent of\nthe node being removed, just like pci_add_device_node_info() does when it\nreferences the parent node.\n\nThis is the first step to get rid of pci_dn::node.\n\nSigned-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>\n---\nChangelog:\nv2:\n* fixed pseries platform\n* this does not remove pci_dn::node yet, just prepares\n---\n arch/powerpc/kernel/eeh.c    | 9 +++++----\n arch/powerpc/kernel/pci_dn.c | 7 +++++--\n 2 files changed, 10 insertions(+), 6 deletions(-)","diff":"diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c\nindex 66c98c158ee3..9e816787c0d4 100644\n--- a/arch/powerpc/kernel/eeh.c\n+++ b/arch/powerpc/kernel/eeh.c\n@@ -435,7 +435,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)\n \tint ret;\n \tint active_flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE);\n \tunsigned long flags;\n-\tstruct pci_dn *pdn;\n+\tstruct device_node *dn;\n \tstruct pci_dev *dev;\n \tstruct eeh_pe *pe, *parent_pe, *phb_pe;\n \tint rc = 0;\n@@ -493,9 +493,10 @@ int eeh_dev_check_failure(struct eeh_dev *edev)\n \tif (pe->state & EEH_PE_ISOLATED) {\n \t\tpe->check_count++;\n \t\tif (pe->check_count % EEH_MAX_FAILS == 0) {\n-\t\t\tpdn = eeh_dev_to_pdn(edev);\n-\t\t\tif (pdn->node)\n-\t\t\t\tlocation = of_get_property(pdn->node, \"ibm,loc-code\", NULL);\n+\t\t\tdn = pci_device_to_OF_node(dev);\n+\t\t\tif (dn)\n+\t\t\t\tlocation = of_get_property(dn, \"ibm,loc-code\",\n+\t\t\t\t\t\tNULL);\n \t\t\tprintk(KERN_ERR \"EEH: %d reads ignored for recovering device at \"\n \t\t\t\t\"location=%s driver=%s pci addr=%s\\n\",\n \t\t\t\tpe->check_count,\ndiff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c\nindex 0256372b72de..dfb107631116 100644\n--- a/arch/powerpc/kernel/pci_dn.c\n+++ b/arch/powerpc/kernel/pci_dn.c\n@@ -342,6 +342,7 @@ EXPORT_SYMBOL_GPL(pci_add_device_node_info);\n void pci_remove_device_node_info(struct device_node *dn)\n {\n \tstruct pci_dn *pdn = dn ? PCI_DN(dn) : NULL;\n+\tstruct device_node *parent;\n #ifdef CONFIG_EEH\n \tstruct eeh_dev *edev = pdn_to_eeh_dev(pdn);\n \n@@ -354,8 +355,10 @@ void pci_remove_device_node_info(struct device_node *dn)\n \n \tWARN_ON(!list_empty(&pdn->child_list));\n \tlist_del(&pdn->list);\n-\tif (pdn->parent)\n-\t\tof_node_put(pdn->parent->node);\n+\n+\tparent = of_get_parent(dn);\n+\tif (parent)\n+\t\tof_node_put(parent);\n \n \tdn->data = NULL;\n \tkfree(pdn);\n","prefixes":["kernel","v2","5/6"]}