Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp938144imm; Fri, 11 May 2018 08:36:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqXegvzzKOdKw7Jz9mVKdESlLv3bG1ZA55yRW5WLSMbfPrtJ4Wrf5BuBP+1gGnsDV/+d8RJ X-Received: by 2002:a62:ccdc:: with SMTP id j89-v6mr6096504pfk.182.1526052980448; Fri, 11 May 2018 08:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526052980; cv=none; d=google.com; s=arc-20160816; b=ZeC9BN7QQsuBDzwU0q8hptyUvSZvTwDjNpjAj5sXT7tRxnD2u9yaLF5GSPYbe35IUM rnB87M/VvmKfHSMe+dxpTsEQBer7oeAlsrudGtuUal4NOvVGsq4Q/Mvb+INlm/3cizfw k70QWlDIyOv7DP/9IA+xtjkwR/CEqmsGEnmnzboyS2I2xqzRGz73PaQaVkag7IBqF8m7 0kZ6CwPL/71ZtgxbQKcY5FHZ+pLIGVxWY9yOf8PMy6ADwE7f5DvRHw2CWf5FNPc5c4xq Hi8i4eZTIQ8sNkwhwwOAYz8vNxTCGYOplwmTIFy3FV600jIruDpk1wFf9Cio0dA6R3B9 r5fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=LGz7BYwWbw6p5r0CSYDzo52kVfVLViMmlaI1luq1U6A=; b=S048peLoeqWtV+qUQ0Xz5NrKdLS/87n+BGV8r1WqMcmMKPKGNRvCjLPpCoU1MGFtuL yan2Rk8eIR5FM8pLINIfXHzNS/07ILN3pa5AanQF1/s8OVtMPaUAaN8NV/k5vSSQwUOD jnDpNRmTiQtTCTwbpEuVl7NmaMgAHamYya1nEg1RnCAVMa+8QuqzcfidktPSw2dA1o1w 1hfeAVIcut+jSIA1XS4zL2vzO6zRZUDpVwh/twiubg98Wk/XFojWGPiN8OCTMyGzg39R vITLcPhcrgLcIa0xQ4rX8O1lkZKhhqtxoGdbM3IH860XBPM1jP5BRnOc6pSg9zW2YKIo qCfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=iCg2cfnX; dkim=pass header.i=@codeaurora.org header.s=default header.b=RWU+VTGf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2-v6si649786pgs.676.2018.05.11.08.36.05; Fri, 11 May 2018 08:36:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=iCg2cfnX; dkim=pass header.i=@codeaurora.org header.s=default header.b=RWU+VTGf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751228AbeEKPej (ORCPT + 99 others); Fri, 11 May 2018 11:34:39 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:51670 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750711AbeEKPei (ORCPT ); Fri, 11 May 2018 11:34:38 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BE0B7607E1; Fri, 11 May 2018 15:34:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526052877; bh=hjoSZbTc61EqGinj2kV5nOAhVYFWRT3+weCd5yuLfnA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iCg2cfnXC+L3SHo5d+BeE3rhPCs5KdwSccM9YMrS5dOIZM1MzR0emMZHI7Bu3yNNm qCxvCeOzfF2nRrB6yIzWaUYBK2c1Xy78Nj4tfSgZbqhLqb6EBcfV+GLj0b+Akf0LJW vABruo0w11H5nLDIhJ7qYMAOAkN8yu4Q4P21oJgc= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id DBABD601EA; Fri, 11 May 2018 15:34:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526052876; bh=hjoSZbTc61EqGinj2kV5nOAhVYFWRT3+weCd5yuLfnA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RWU+VTGfwBGcyggnljyI3GUiYpOiBVPWeQ/1opJav+IiIOoqlvJvBt0ASwZMPuCvL sw4xz6ac0Itm6GahI4PB1vsolKJbyhHLhQD+OTlQkhm1pu4lS4g8oSF+JcvfHrO+6r pIAmrDTHyHMdS2cjtoWRDkduyR0YHNw8QDuOAKA4= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 11 May 2018 21:04:36 +0530 From: poza@codeaurora.org To: Lukas Wunner Cc: Bjorn Helgaas , Philippe Ombredanne , Thomas Gleixner , Greg Kroah-Hartman , Kate Stewart , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Dongdong Liu , Keith Busch , Wei Zhang , Sinan Kaya , Timur Tabi Subject: Re: [PATCH v16 5/9] PCI/AER: Factor out error reporting from AER In-Reply-To: <20180511125857.GA23225@wunner.de> References: <1526035408-31328-1-git-send-email-poza@codeaurora.org> <1526035408-31328-6-git-send-email-poza@codeaurora.org> <20180511125857.GA23225@wunner.de> Message-ID: <7317531a7a85404d590008a27131955f@codeaurora.org> X-Sender: poza@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-05-11 18:28, Lukas Wunner wrote: > On Fri, May 11, 2018 at 06:43:24AM -0400, Oza Pawandeep wrote: >> +void pcie_do_fatal_recovery(struct pci_dev *dev) >> +{ >> + struct pci_dev *udev; >> + struct pci_bus *parent; >> + struct pci_dev *pdev, *temp; >> + pci_ers_result_t result = PCI_ERS_RESULT_RECOVERED; >> + struct aer_broadcast_data result_data; >> + >> + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) >> + udev = dev; >> + else >> + udev = dev->bus->self; >> + >> + parent = udev->subordinate; >> + pci_lock_rescan_remove(); >> + list_for_each_entry_safe_reverse(pdev, temp, &parent->devices, >> + bus_list) { >> + pci_dev_get(pdev); >> + pci_dev_set_disconnected(pdev, NULL); >> + if (pci_has_subordinate(pdev)) >> + pci_walk_bus(pdev->subordinate, >> + pci_dev_set_disconnected, NULL); >> + pci_stop_and_remove_bus_device(pdev); >> + pci_dev_put(pdev); >> + } > > Any reason not to simply call > > pci_walk_bus(udev->subordinate, pci_dev_set_disconnected, NULL); > > before the list_for_each_entry_safe_reverse() iteration, instead of > calling it for each device on the subordinate bus and for each > device's children? Should be semantically identical, saves 3 LoC > and saves wasted cycles of acquiring pci_bus_sem over and over again > for each device on the subordinate bus. > > Thanks, > > Lukas Well this is borrowed code from DPC driver, hence I thought to keep the same. but to me it looks like its taking care of PCIe switch where is goes through all the subordinates, and which could turn out to be more swicthes down the line, and son on... it goes all the way down to the tree Am I missing something here ?