Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2166163pxk; Sat, 26 Sep 2020 20:32:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn3rC+LsPPxeh+b2e0F9qRBYhT3yAAqQsPuUlw/9MKbtnkp1Kw+DqV/vNabtptCEokH4uO X-Received: by 2002:a05:6402:17fc:: with SMTP id t28mr9203738edy.244.1601177557640; Sat, 26 Sep 2020 20:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601177557; cv=none; d=google.com; s=arc-20160816; b=o5INmh0Si/+F6xywK2GvBsZFbnOst+mmBMHQ1oF/jvaCBsB3/OYx0+dwLkK61UwCY1 VosxmbyR6vn2Azol3xC+MxJ6Ey3dsQrGXh3i6bw5I5bLWYRNF7TQEwQt/FQ2HVhcen9N VhxaDsin0mYNJG6OMm4gKg6AAnhHztt9oMX5sb1n/PGsqkxxTNVZJzIXQQZ4ROXBTpHD Q1SfimQYz/QBGAmS7OZw2qq/+2v35oPQ/dHi0BsjndopW0T/cxf6BtKNNKWc3OcqTvUU sn8uqJb2wvTrh1GRmnNIf6sYMfGAtGQgwYup7XKOyaxoRuV4sTe9jUP8LfS0dpXkV2oc Y8XQ== 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=5/KGLopQ+sXhpivfkbGOjhhUei082yNcQrLpthvpXiw=; b=OGvLZ003ETERNgZy31MbuGnbYoaU2JMwR/GAvzUUwzshMPkWZW44ZjXbDC9T9xVpxF F1aSbSVw/+W6uGGHUyvoHOW8dYFMp/FZ84eCzOgDRDtQ+j6wv3J4kOyFQEEcFsWkw9x9 2v3BLaN7/NXlKLE8dMBhsLM/kymPVAMff0u9LAck4ajjJVKCejsnTEH5TcwgQzOtR04F WyC5uR1myOFBAXKGgzFbV1oislaoBqdORNjaXtl/lbtLFifzg1xck3jFCmx9Aqq3qZG2 bfokxlUOkVzMygnXRY/RW/M9uz0EBtslFT5DzkQ1GlAYVyTTPgsmW+UhZQI6S3H7A4X7 dj2A== 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 u16si5130787edr.507.2020.09.26.20.32.15; Sat, 26 Sep 2020 20:32:37 -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 S1730268AbgI0DaR (ORCPT + 99 others); Sat, 26 Sep 2020 23:30:17 -0400 Received: from mga12.intel.com ([192.55.52.136]:65386 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730250AbgI0DaQ (ORCPT ); Sat, 26 Sep 2020 23:30:16 -0400 IronPort-SDR: H34r4B0OK17luwr0NjGtK/I5dtFit4OYxetEP7TYt8Cfe1qmLgZfobCxTKzGZ7iRX4hfaKKeqL RRSAOKGCmqCA== X-IronPort-AV: E=McAfee;i="6000,8403,9756"; a="141242672" X-IronPort-AV: E=Sophos;i="5.77,308,1596524400"; d="scan'208";a="141242672" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2020 20:30:16 -0700 IronPort-SDR: Q7mHcK+KZFD3rtG0Zw1IMqVNWMwH3L84/t8EZ7k7K823g71MfyifCe9X/UQuPMTIc3FUjH06VM mO9Khs58ThoQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,308,1596524400"; d="scan'208";a="337697550" Received: from shskylake.sh.intel.com ([10.239.48.137]) by fmsmga004.fm.intel.com with ESMTP; 26 Sep 2020 20:30:13 -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 V2] PCI/ERR: don't mix io state not changed and no driver together Date: Sat, 26 Sep 2020 23:28:29 -0400 Message-Id: <20200927032829.11321-6-haifeng.zhao@intel.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20200927032829.11321-1-haifeng.zhao@intel.com> References: <20200927032829.11321-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. 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