From patchwork Sat Nov 10 07:41:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pandarathil, Vijaymohan R" X-Patchwork-Id: 198175 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2F9D82C0087 for ; Sat, 10 Nov 2012 18:44:50 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751435Ab2KJHop (ORCPT ); Sat, 10 Nov 2012 02:44:45 -0500 Received: from g4t0015.houston.hp.com ([15.201.24.18]:2507 "EHLO g4t0015.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751415Ab2KJHoo convert rfc822-to-8bit (ORCPT ); Sat, 10 Nov 2012 02:44:44 -0500 Received: from G4W3011G.americas.hpqcorp.net (g4w3011g.houston.hp.com [16.234.25.125]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by g4t0015.houston.hp.com (Postfix) with ESMTPS id EA47382D0; Sat, 10 Nov 2012 07:44:43 +0000 (UTC) Received: from G9W2161G.americas.hpqcorp.net (16.216.113.179) by G4W3011G.americas.hpqcorp.net (16.234.25.125) with Microsoft SMTP Server (TLS) id 14.2.283.4; Sat, 10 Nov 2012 07:41:04 +0000 Received: from G9W0717.americas.hpqcorp.net ([169.254.4.192]) by G9W2161G.americas.hpqcorp.net ([16.216.113.179]) with mapi id 14.02.0283.004; Sat, 10 Nov 2012 07:41:04 +0000 From: "Pandarathil, Vijaymohan R" To: "bhelgaas@google.com" CC: "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linasvepstas@gmail.com" , Myron Stowe Subject: [ PATCH RESEND ] PCI-AER: Do not report successful error recovery for devices with AER-unaware drivers Thread-Topic: [ PATCH RESEND ] PCI-AER: Do not report successful error recovery for devices with AER-unaware drivers Thread-Index: AQHNvxa8hUTykftZIUuYHm9OnADUUw== Date: Sat, 10 Nov 2012 07:41:04 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [15.201.58.22] MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org When an error is detected on a PCIe device which does not have an AER-aware driver, prevent AER infrastructure from reporting successful error recovery. This is because the report_error_detected() function that gets called in the first phase of recovery process allows forward progress even when the driver for the device does not have AER capabilities. It seems that all callbacks (in pci_error_handlers structure) registered by drivers that gets called during error recovery are not mandatory. So the intention of the infrastructure design seems to be to allow forward progress even when a specific callback has not been registered by a driver. However, if error handler structure itself has not been registered, it doesn't make sense to allow forward progress. As a result of the current design, in the case of a single device having an AER-unaware driver or in the case of any function in a multi-function card having an AER-unaware driver, a successful recovery is reported. Typical scenario this happens is when a PCI device is detached from a KVM host and the pci-stub driver on the host claims the device. The pci-stub driver does not have error handling capabilities but the AER infrastructure still reports that the device recovered successfully. The changes proposed here leaves the device in an unrecovered state if the driver for the device or for any function in a multi-function card does not have error handler structure registered. This reflects the true state of the device and prevents any partial recovery (or no recovery at all) reported as successful. Please also see comments from Linas Vepstas at the following link http://www.spinics.net/lists/linux-pci/msg18572.html Reviewed-by: Linas Vepstas gmail.com> Reviewed-by: Myron Stowe redhat.com> Signed-off-by: Vijay Mohan Pandarathil hp.com> --- drivers/pci/pcie/aer/aerdrv_core.c | 6 ++++++ 1 file changed, 6 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 06bad96..030b229 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c @@ -215,6 +215,12 @@ static int report_error_detected(struct pci_dev *dev, void *data) dev->error_state = result_data->state; + if ((!dev->driver || !dev->driver->err_handler) && + !(dev->hdr_type & PCI_HEADER_TYPE_BRIDGE)) { + dev_info(&dev->dev, "AER: Error detected but no driver has claimed this device or the driver is AER-unaware\n"); + result_data->result = PCI_ERS_RESULT_NONE; + return 1; + } if (!dev->driver || !dev->driver->err_handler || !dev->driver->err_handler->error_detected) {