Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1246793pxk; Fri, 25 Sep 2020 09:43:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr8HpamiqCC+p276mzMwPl6J37pnanA4SLIvt3Qgt4iJzfXbHP/cQt8AFPuiWtkjGP/6F1 X-Received: by 2002:aa7:ce19:: with SMTP id d25mr2248874edv.189.1601052219219; Fri, 25 Sep 2020 09:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601052219; cv=none; d=google.com; s=arc-20160816; b=v/QZD+tP056jiQz1nfbklXvBii59LIONy9lcl4ksiuzXvY+3LqyZi6NGZm8wHzS4VR BlNmeECPgafpH9PmFLhM1j5TbH/w9rFY5xxMepKJNldtxAah0w949QvTRIvhak6HdDqM 7uhxUSPuvyM1RwtwOTzkfMtkFHT9Mtfag5cyMGtv6jeWJ5RnN9pKvXALcd13yoxP7/7H jVj77vGJc+tFOfcok2KRhKeChyghcDgqKhYyPEEsRogGxgbepOlN+yrBHgnDaoQj5hmx UxDrf11SbluM07nBdLP7XgVpTEiuY4wUu0ZsJVoiF13GCxh+5s51P2VtaYjB9ums/ITl ZXwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=S3HQ28hFCWUP+zMPkGzsR0swu2hsVKGHV4JUV7a3QZM=; b=N15bzGlHRj12atrou6g+JxSVLmNLNMidFrZ8MVzqQ0JN43ECF8NKvNo/sSZhS2tRZD xXMZHm0bJvaCj88RE8nVWeCpnF76/jppx/vgzUGp6lDZKd9s+rK4fIE86hCw+hZ5B0qe 6nqkH2vVGXz/ZQYehd1UHkfTIiBsCpvCL2Kb2U7YqJ81OCmv74u7+hkd49ny+Ze1kNT9 0eutwrc2cvhl5XNQ+MNY8qYpS0cqjU3NeMcvGHIQq9HGbaUvFGCkEOl4CC0PPoO/0ex+ s1hiVNf67KppBqzkgBHUPjCKPHVwRzvkBwOHNp8lf6V9p0s9kF9FaKdHI+Ci6uQLryor cSuw== 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 pk27si2148679ejb.715.2020.09.25.09.43.16; Fri, 25 Sep 2020 09:43:39 -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 S1729288AbgIYQkX (ORCPT + 99 others); Fri, 25 Sep 2020 12:40:23 -0400 Received: from mga01.intel.com ([192.55.52.88]:44646 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728353AbgIYQkW (ORCPT ); Fri, 25 Sep 2020 12:40:22 -0400 IronPort-SDR: CHDeJUsVZvy3PQ43INxcT1lcdZZijBYSbDd5fSP6CNGBygw2RZ/G2dbBA15+FzF05BO/sHWZsN qQUZnhmjysmA== X-IronPort-AV: E=McAfee;i="6000,8403,9755"; a="179655316" X-IronPort-AV: E=Sophos;i="5.77,302,1596524400"; d="scan'208";a="179655316" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2020 09:40:16 -0700 IronPort-SDR: Qz8UptCdPjaACMrQab4Cq1l0NWLpyR8p73aa1nGo2XuyBzjl6yTtTlD7rN3WbmJY1RkB8oJnjW 5pecNSJHP5JQ== X-IronPort-AV: E=Sophos;i="5.77,302,1596524400"; d="scan'208";a="323440246" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2020 09:40:13 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1kLmzG-001v06-Ax; Fri, 25 Sep 2020 15:38:06 +0300 Date: Fri, 25 Sep 2020 15:38:06 +0300 From: Andy Shevchenko To: Ethan Zhao Cc: bhelgaas@google.com, oohall@gmail.com, ruscur@russell.cc, lukas@wunner.de, stuart.w.hayes@gmail.com, mr.nuke.me@gmail.com, mika.westerberg@linux.intel.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, pei.p.jia@intel.com Subject: Re: [PATCH 4/5] PCI: only return true when dev io state is really changed Message-ID: <20200925123806.GG3956970@smile.fi.intel.com> References: <20200925023423.42675-1-haifeng.zhao@intel.com> <20200925023423.42675-5-haifeng.zhao@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200925023423.42675-5-haifeng.zhao@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 24, 2020 at 10:34:22PM -0400, Ethan Zhao wrote: > When uncorrectable error happens, AER driver and DPC driver interrupt > handlers likely call > pcie_do_recovery()->pci_walk_bus()->report_frozen_detected() with > pci_channel_io_frozen the same time. Call chains are better to read if they split like foo() -> bar() -> baz() > If pci_dev_set_io_state() return true even if the original state is > pci_channel_io_frozen, that will cause AER or DPC handler re-enter > the error detecting and recovery procedure one after another. > The result is the recovery flow mixed between AER and DPC. > So simplify the pci_dev_set_io_state() function to only return true > when dev->error_state is changed. ... > + if (dev->error_state != new) { > dev->error_state = new; > + changed = true; > + } > return changed; Perhaps if (dev->error_state == new) return changed; dev->error_state = new; return true; ? -- With Best Regards, Andy Shevchenko