Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3396189ybp; Sun, 6 Oct 2019 11:01:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEWFjw7ft0IPwPLt//8DRDePheNRcdXnmN0/74+Me9qdgWbZrEb0L5yy9vLxbv/nWdpZ9e X-Received: by 2002:a17:906:fae2:: with SMTP id lu34mr20296276ejb.53.1570384889790; Sun, 06 Oct 2019 11:01:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570384889; cv=none; d=google.com; s=arc-20160816; b=Lue0I60Kj07BdyAHh5vNQaWUsjDxdqviCzvLlR7vQbMS38GXiiRd7e+klq3/Rnb8Uz GRKcrrv7MYv2IHmCGcALpW+boWRzb4rW/diCnws+3A51W6IvRoc+qugU8uDVrWpKqD/3 seZdnN/mBdzn0FQk/COwnt2/eHhScCaf1HPwPj2DoTjWh9egriSGhcBWGlYWQYuPoMJB a2xgwibO6xhQuthDueDbp658eZ7nkCItv7ty7IhnZ5rGmZ1RWSSv6XpeGi3ZFi7IsRCL 5v7L2J2Syy86IyEroCuqsV4BVJ/sl16IH1jOSge7WEgRr9oFGy/JfX8Ea15GRBD6F3hj +zQA== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=90nRT7sofJkmoogpQ2TV31vLYmrg4fNBUHWb6QLOfSQ=; b=jDtDGeWBUzkrGZkejWMg9LQvWSjc9LSedMwBUkMPVegT5+N6ZocpJO8lb2zGMjl722 g4J1CATqr1+HiJ9hoM0Vd3VXeIQVXrAv0XnxYlnplle5svexY3au5PL0xdi5BoTZ8WEW 2ZHg7Fpet5QDpssIu9NoXC6Uwdvi4R75q4vvakMLZw7jacJZmgBA5EQw2cD+KAlrRpu4 K4miNou1DrrpfUURia4+soLndDJwQ4rsFa0pxO4GbB7O5E26LynAYpSfellUckx665Q2 6hXHpZv2xuRA8Clr820FX7xU/lFGmRpKy7GtB4EsKxl2AupXI+XjGxIaACE+ZKGxuoTe 9+Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a7J4yR4A; 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 c6si7635895edc.291.2019.10.06.11.01.05; Sun, 06 Oct 2019 11:01:29 -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=@kernel.org header.s=default header.b=a7J4yR4A; 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 S1728929AbfJFR3G (ORCPT + 99 others); Sun, 6 Oct 2019 13:29:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:54724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727754AbfJFR3B (ORCPT ); Sun, 6 Oct 2019 13:29:01 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3ED212080F; Sun, 6 Oct 2019 17:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570382940; bh=0iETnc1ZmZbUuwk8H8XexJ/KlhyEDLrIuvsdckyzRDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a7J4yR4AveAWObzaJMao2G6oe+5h+8oJheE2Y+9+S9T5ixCZvq1WH5T1oM0LkyznS DsfhL7D3AGeQtVa3EEey/VD/zbNyxztneS5halgD69kjzYt11hEcWgjRCWwBubGW5Q sp1Ena/WFU3nqK1THW5YT16Oi9UAKaWpBup7H8Lw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Bobroff , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 027/106] powerpc/eeh: Clear stale EEH_DEV_NO_HANDLER flag Date: Sun, 6 Oct 2019 19:20:33 +0200 Message-Id: <20191006171138.303166186@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006171124.641144086@linuxfoundation.org> References: <20191006171124.641144086@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sam Bobroff [ Upstream commit aa06e3d60e245284d1e55497eb3108828092818d ] The EEH_DEV_NO_HANDLER flag is used by the EEH system to prevent the use of driver callbacks in drivers that have been bound part way through the recovery process. This is necessary to prevent later stage handlers from being called when the earlier stage handlers haven't, which can be confusing for drivers. However, the flag is set for all devices that are added after boot time and only cleared at the end of the EEH recovery process. This results in hot plugged devices erroneously having the flag set during the first recovery after they are added (causing their driver's handlers to be incorrectly ignored). To remedy this, clear the flag at the beginning of recovery processing. The flag is still cleared at the end of recovery processing, although it is no longer really necessary. Also clear the flag during eeh_handle_special_event(), for the same reasons. Signed-off-by: Sam Bobroff Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/b8ca5629d27de74c957d4f4b250177d1b6fc4bbd.1565930772.git.sbobroff@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/eeh_driver.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c index 67619b4b3f96c..110eba400de7c 100644 --- a/arch/powerpc/kernel/eeh_driver.c +++ b/arch/powerpc/kernel/eeh_driver.c @@ -811,6 +811,10 @@ void eeh_handle_normal_event(struct eeh_pe *pe) pr_warn("EEH: This PCI device has failed %d times in the last hour and will be permanently disabled after %d failures.\n", pe->freeze_count, eeh_max_freezes); + eeh_for_each_pe(pe, tmp_pe) + eeh_pe_for_each_dev(tmp_pe, edev, tmp) + edev->mode &= ~EEH_DEV_NO_HANDLER; + /* Walk the various device drivers attached to this slot through * a reset sequence, giving each an opportunity to do what it needs * to accomplish the reset. Each child gets a report of the @@ -1004,7 +1008,8 @@ final: */ void eeh_handle_special_event(void) { - struct eeh_pe *pe, *phb_pe; + struct eeh_pe *pe, *phb_pe, *tmp_pe; + struct eeh_dev *edev, *tmp_edev; struct pci_bus *bus; struct pci_controller *hose; unsigned long flags; @@ -1075,6 +1080,10 @@ void eeh_handle_special_event(void) (phb_pe->state & EEH_PE_RECOVERING)) continue; + eeh_for_each_pe(pe, tmp_pe) + eeh_pe_for_each_dev(tmp_pe, edev, tmp_edev) + edev->mode &= ~EEH_DEV_NO_HANDLER; + /* Notify all devices to be down */ eeh_pe_state_clear(pe, EEH_PE_PRI_BUS); eeh_set_channel_state(pe, pci_channel_io_perm_failure); -- 2.20.1