Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2749610pxk; Sun, 27 Sep 2020 21:11:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQnZZJoqkT36RN1jLZ6fn1NYCxNCri0l37YV0TPIAMY3VzFGQ2ZAe9mKh82qC0XTV0nDAV X-Received: by 2002:a17:906:17c6:: with SMTP id u6mr13961378eje.95.1601266262227; Sun, 27 Sep 2020 21:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601266262; cv=none; d=google.com; s=arc-20160816; b=Abddo9O895QygA/liCjzdXOGrZXcvxKrINIYTRMjXKs0AjSaMAeF5E6jviZo6J+j9p gZGddsv16EIrBQqZpkZr7JYebDV8uNOkWONjOMmcrCqsA1bY5aNdbzOI1H2DU1kX/STP GfUkzAL1LzzKo0/ty+48CRIm/6OOB3Wdj4wxT05MeOKkQgTd4BKWYw2qkS12i3W3hxgp MIjtKJwLEbTK+5s1YQ2mawtH3Ng7bLjg8ibTdvdfD+TAyF2ykmfdJRq8RPERvcc2H02s RCwByeb5E2bjhr/V/tufJ9FHFtpTV79uIRhQ7BfDiJ8k4QJfYxm2OqSms0DHRHRV3sq7 hOkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=jsEXzYQZ4HI4I39PsU59we8fVlTzMygvmjOUknda43A=; b=ckVSbmtaZWm6vtqOOrnJCRbyp6C8JroeiSPye7BzfYZAOHf/pW+0WH1nohH1ksXCCK UENrfSB0DCMJVn0oInWXHWM8RbZ0gYGf7S1H/YiTCt8DGkpakEU6uNK62qD1uZhmXiGi klbiaFtn/YQNaa+s0sUR+i84wCqUWHMaRLq0DjDZj+GL8Xi7o0Fz/XlbMPYmktvicGFw Q/bocijjH5l6tct/Pr9Qy2qWpxF+5MnWiDyGv6Q1FcSbDtzP7TLhX21OSsTjgXE97jMu tDZWI6qoNU0E2b6xv5rb/aJZhH2TbGJDEwpgFG+WOE1X096ks3pwj/zZAKOP2neEOTop 0kHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si6689813eje.580.2020.09.27.21.10.39; Sun, 27 Sep 2020 21:11:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726613AbgI1EIs (ORCPT + 99 others); Mon, 28 Sep 2020 00:08:48 -0400 Received: from mga18.intel.com ([134.134.136.126]:30290 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725290AbgI1EIm (ORCPT ); Mon, 28 Sep 2020 00:08:42 -0400 IronPort-SDR: t+7kTvOuo+TrI/9zmbf/PYWT0jmqNoLlv+z28RFj29cbv0+ZlhGzAw43UvXkkEPgSEIjInaQuY j6m2LNAupZlg== X-IronPort-AV: E=McAfee;i="6000,8403,9757"; a="149710901" X-IronPort-AV: E=Sophos;i="5.77,312,1596524400"; d="scan'208";a="149710901" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2020 21:08:41 -0700 IronPort-SDR: p8KvPyKGQSZM5hr74cP0clr+WzHemPj7g9nkcoIqQ09zkuftqdi7829iElGmIQwo1QTi5orxNk 1g9j8j8vMZWg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,312,1596524400"; d="scan'208";a="311628179" Received: from shskylake.sh.intel.com ([10.239.48.137]) by orsmga006.jf.intel.com with ESMTP; 27 Sep 2020 21:08:38 -0700 From: Ethan Zhao To: bhelgaas@google.com, oohall@gmail.com, ruscur@russell.cc, lukas@wunner.de, andriy.shevchenko@linux.intel.com, stuart.w.hayes@gmail.com, mr.nuke.me@gmail.com, mika.westerberg@linux.intel.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, pei.p.jia@intel.com, ashok.raj@linux.intel.com, sathyanarayanan.kuppuswamy@intel.com, Ethan Zhao Subject: [PATCH 5/5 V5] PCI/ERR: don't mix io state not changed and no driver together Date: Mon, 28 Sep 2020 00:06:51 -0400 Message-Id: <20200928040651.24937-6-haifeng.zhao@intel.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20200928040651.24937-1-haifeng.zhao@intel.com> References: <20200928040651.24937-1-haifeng.zhao@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When we see 'can't recover (no error_detected callback)' on console, Maybe the reason is io state is not changed by calling pci_dev_set_io_state(), that is confused. fix it. Signed-off-by: Ethan Zhao Tested-by: Wen Jin Tested-by: Shanshan Zhang --- Chagnes: V2: no change. V3: no change. V4: no change. V5: no change. drivers/pci/pcie/err.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c index e35c4480c86b..d85f27c90c26 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -55,8 +55,10 @@ static int report_error_detected(struct pci_dev *dev, if (!pci_dev_get(dev)) return 0; device_lock(&dev->dev); - if (!pci_dev_set_io_state(dev, state) || - !dev->driver || + if (!pci_dev_set_io_state(dev, state)) { + pci_dbg(dev, "Device might already being in error handling ...\n"); + vote = PCI_ERS_RESULT_NONE; + } else if (!dev->driver || !dev->driver->err_handler || !dev->driver->err_handler->error_detected) { /* -- 2.18.4