Received: by 10.223.185.116 with SMTP id b49csp2301108wrg; Thu, 22 Feb 2018 11:24:50 -0800 (PST) X-Google-Smtp-Source: AH8x227uf+gxFqcQvG5gvwmJJYdePI5BMRiNJLeOTdAe5qUSilXYf0MJezxi2Z6Dfn3S74K/RKbT X-Received: by 10.101.93.82 with SMTP id e18mr6402342pgt.371.1519327490720; Thu, 22 Feb 2018 11:24:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519327490; cv=none; d=google.com; s=arc-20160816; b=Wxi6mXjPLIkXjGmQybftJQLZbKlBP6jgJBDOX5kGjlexH5cdjBigUiosxx0NEHEKDd NBbXzxUPzSOtYDwhOGw9eeszDIYSKp61WJ8HPw50T9mvSiBu+RMRWQqFiuILeXhvwPHz Olno6yMeLzvsCJNdJmjukLHQUZx8hIelXZRRZWXwJOFy89vuBYw0kt+jFMB89mn4zLbB iE+ON+J44KLyzmkCW1qC2jZ8PwhYegD2ej00nK5jqQ2mzGPRUaQzjrAcz5V8uuup8Vki Tqjh58FbuTVnec+z6qz0WVswCNxp3OD80L/Yg5WBQmttTnenoVwWAqk/UT8G26tsuhmE hGjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:to:subject:from:dkim-signature :arc-authentication-results; bh=BeU+FiTCN6S/hpR0wxTsJfTPHdY1bsru0syQI+3IH40=; b=Ma7q4gvBmTiEaBsuLYsjPuSJZiHpEe+Ii+8CU/6Ie4ooDAuptpuibs1WV4UwhEnGT5 mI+xL/YXYp5xftBWt3PyOTkSu8QnJa4aB/83SHVorRDSsv27yimskmZ79Xzv56R7K9ks 5FcBiK+L/URl9VqcZGExF6zPRg9dRv//EnqwT4ZZXiMxxcYxWSU7357p164RwMwzDWzo ot1oiHVBX8IjhxSFCIKteYPl4DOM8fi/2s7/TO+qYPwTjucnPWiExFPmMy739LhMD8cU sC2J7SzsP4kKE8E8A/gFpH4G3wio/MEoTkzS8lFsuBWHjB/yqd757CC+Bvjh26QdpV8m /CMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=keT2yVoL; 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 c19si470926pfd.343.2018.02.22.11.24.35; Thu, 22 Feb 2018 11:24:50 -0800 (PST) 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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=keT2yVoL; 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 S1751422AbeBVTXy (ORCPT + 99 others); Thu, 22 Feb 2018 14:23:54 -0500 Received: from merlin.infradead.org ([205.233.59.134]:56504 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751273AbeBVTXu (ORCPT ); Thu, 22 Feb 2018 14:23:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:References:To:Subject:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BeU+FiTCN6S/hpR0wxTsJfTPHdY1bsru0syQI+3IH40=; b=keT2yVoLsz4OFGSIAyuWWXHfN2 PhrAmNWjKR0FcZJ5UkNuDp2rKLLjlwyJjA0fGBqE/uJgLxoAsberbF1A8d5huodn2qi/ivaubMHyH QbA7CTPWm+dAYnH6DurH5Jzgqa74Wi7Eqr4vSZtl8KqsIexXmyThHEUcmMQUWWeMDC56ESxBmN7Dr G8Rgf43UaTlUCWaveC4J9hTFvn07JDnzJd6HWXfNyWb55SLYFsnNZo5gx/VKS+Qdm2E1QjWglaBNf 75uzH0cgQVyUqk9frEZHhpvYFtKt2WgF8uy1LxRwrF/2lNDfvg3iP4KymptwG/I5D/C0dauuaGfpS Os8/qHiQ==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by merlin.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1eowT1-0000Nt-EI; Thu, 22 Feb 2018 19:23:43 +0000 From: Randy Dunlap Subject: Re: [PATCH v9 2/7] PCI/AER: factor out error reporting from AER To: Oza Pawandeep , 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 References: <1519285571-5634-1-git-send-email-poza@codeaurora.org> <1519285571-5634-3-git-send-email-poza@codeaurora.org> Message-ID: Date: Thu, 22 Feb 2018 11:23:41 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1519285571-5634-3-git-send-email-poza@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/21/2018 11:46 PM, Oza Pawandeep wrote: Hi, Just minor stuff: > diff --git a/drivers/pci/pcie/pcie-err.c b/drivers/pci/pcie/pcie-err.c > new file mode 100644 > index 0000000..a532fe0 > --- /dev/null > +++ b/drivers/pci/pcie/pcie-err.c > @@ -0,0 +1,334 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * This file implements the error recovery as a core part of PCIe error reporting. > + * When a PCIe error is delivered, an error message will be collected and printed > + * to console, then, an error recovery procedure will be executed by following > + * the PCI error recovery rules. > + * > + * Copyright (C) 2006 Intel Corp. > + * Tom Long Nguyen (tom.l.nguyen@intel.com) > + * Zhang Yanmin (yanmin.zhang@intel.com) > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include "portdrv.h" > +static int report_error_detected(struct pci_dev *dev, void *data) > +{ > + pci_ers_result_t vote; > + const struct pci_error_handlers *err_handler; > + struct aer_broadcast_data *result_data; > + > + result_data = (struct aer_broadcast_data *) data; > + > + device_lock(&dev->dev); > + dev->error_state = result_data->state; > + > + if (!dev->driver || > + !dev->driver->err_handler || > + !dev->driver->err_handler->error_detected) { > + if (result_data->state == pci_channel_io_frozen && > + dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { > + /* > + * In case of fatal recovery, if one of down- > + * stream device has no driver. We might be > + * unable to recover because a later insmod > + * of a driver for this device is unaware of > + * its hw state. > + */ > + dev_printk(KERN_DEBUG, &dev->dev, "device has %s\n", > + dev->driver ? > + "no error-aware driver" : "no driver"); or: dev_printk(KERN_DEBUG, &dev->dev, "device has no%s driver\n", dev->driver ? " error-aware" : ""); > + } > + > + /* > + * If there's any device in the subtree that does not > + * have an error_detected callback, returning > + * PCI_ERS_RESULT_NO_AER_DRIVER prevents calling of > + * the subsequent mmio_enabled/slot_reset/resume > + * callbacks of "any" device in the subtree. All the > + * devices in the subtree are left in the error state > + * without recovery. > + */ > + > + if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) > + vote = PCI_ERS_RESULT_NO_AER_DRIVER; > + else > + vote = PCI_ERS_RESULT_NONE; > + } else { > + err_handler = dev->driver->err_handler; > + vote = err_handler->error_detected(dev, result_data->state); > + } > + > + result_data->result = merge_result(result_data->result, vote); > + device_unlock(&dev->dev); > + return 0; > +} > +/** > + * broadcast_error_message - handle message broadcast to downstream drivers > + * @dev: pointer to from where in a hierarchy message is broadcasted down I would drop ^^ "from" ... is broadcast downstream > + * @state: error state > + * @error_mesg: message to print > + * @cb: callback to be broadcasted to be broadcast > + * > + * Invoked during error recovery process. Once being invoked, the content > + * of error severity will be broadcasted to all downstream drivers in a will be broadcast > + * hierarchy in question. > + */ > +static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, > + enum pci_channel_state state, > + char *error_mesg, > + int (*cb)(struct pci_dev *, void *)) > +{ > + struct aer_broadcast_data result_data; -- ~Randy