Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1859729lql; Wed, 13 Mar 2024 10:03:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVr5/yjy8kryK7R0mtClxEn2+uJBwNz4yvAuyvjHLpjsE3CIThkXv1Sp+PgNu1wqOxMQBTkJ6tvtoJ3MrFpEs7DKXjWUuL114sUf1IKdQ== X-Google-Smtp-Source: AGHT+IHk2y9YUJ1w+iKIySYCgGqjSbdWf6f6GtWedICELioDO2U3Qkh0dG1srNEK6ehDHcGUwAlw X-Received: by 2002:a05:6a00:2da0:b0:6e6:9471:9f83 with SMTP id fb32-20020a056a002da000b006e694719f83mr3211644pfb.8.1710349384649; Wed, 13 Mar 2024 10:03:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710349384; cv=pass; d=google.com; s=arc-20160816; b=oIpDaz7zBSMa9C6YjzgXqH9sYqt+MtsjnyZeJtPDCWDzHa51JS0z7cEQE/K0An1Ya4 X1tiYYSqI7Fz7PknBrAD/TeTg6eELMeBqkTOZSUrO5stX1NnXmC5EH14OHzkfzHyXp25 pE+bIrKFWp1JjZq32Qi+QZu94kgRi4Sy76SY51fKUe5f47qlY3wHvvJhlCKVf9PiOc0F 0meZ8tsCQkgvMLw3Ww6NMEnT+yU8Lkj8pibJcGuF7uPzpAhkRzbbqvWXEXVVO2qQ9yJV mSJtLwlBfTWb8bKbRS2D+rfHZlm8lh94TXqMC9UibVqBMqqB5ZC8PuWFlB8oUl3TQ7wc /oPg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:date:from :dkim-signature; bh=GoArUnSwDlV5k+SYYvok9EFdCNVO4qCJzM/vGNioRWA=; fh=VQgF4ldYwStlNjZEvEOBHr28tr9hEHqd9Y2J7+CJJtw=; b=HDI0idi/YlNVHxpBl1e6p2905L7WlabePem9ucD2JZiOjBOMK5y0oxoioI+VNFfp1j wT8grJCyy2YSodxWNN1i8VdViyuMlZxGA1L4SeggoMg2x4tIR7Hw9ByfsBDRx0d3ebgg 7ozsKG3frNCtckzXkzJvSCcY7Cp9DtPqbu8vdcBulbExOj6TA3mc/qaYlmbbuDyqsG8j 0Q5zAIB3swOR1loaMosCdFs29k9cGQTjU6+GUJC/oDqvVWYkbF7SqTTHw9dnWYDHbno4 Mvy2dcUgCx7Qtn3GBmtTYq7x53vRNDmt2LwBhgP3Orc3Y0UzlA9aVEXnzBTAZevPLt24 /Bmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b5KbJ7PR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-101453-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101453-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b8-20020a637148000000b005dc87112e2asi9355028pgn.733.2024.03.13.10.03.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 10:03:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101453-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b5KbJ7PR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-101453-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101453-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 466F0B2297D for ; Wed, 13 Mar 2024 12:00:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE1473FB88; Wed, 13 Mar 2024 12:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="b5KbJ7PR" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 648623F9D5; Wed, 13 Mar 2024 12:00:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710331231; cv=none; b=HrXwvfzxf6sgRzSkGI2vuO5hSftOH+XPSGglHTD7jeHjh6dnjHSiqHnDAR75lwwTAWVEI3u6Kudnc4LjRmfYrvouoXVufo+jsqBDBaJeJDUs1U9jpp8y081iz9DGxxOWR8Ik+ZY1BBbKjY4sKFswyreC6K2cBbz1iearB/OrTYw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710331231; c=relaxed/simple; bh=oTmsZxsDwI243Hwkzpf2lxroCsnB9x2YChpMLaPvfP4=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=VwpajFPYW7rB2Yu8lyjDpredr9UdaIRzUgXeDqUYEFxklMceDIHdFyX57oueQDdE9x30nIwWNkGiFtOMuLE3dcHtSIGOwIcZh5r0thWbFuhgMwL6tia4269R33cr7nGnjUcqPsGNqnxDBWmDbj4VPweodJiixSOIpren9bAVwO8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=b5KbJ7PR; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710331229; x=1741867229; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=oTmsZxsDwI243Hwkzpf2lxroCsnB9x2YChpMLaPvfP4=; b=b5KbJ7PR4YhP7VjpgLL9jPxlb1F4zSCvuUy4jeoekSs8keTmG/YFWJyt czG+HFVLyFr6ZmkhoZ2Oom+G44IyU414S4tiVRZsHg2MvBaGVjoNa+HO6 jhkaaBSOyz5BMyjRS+7Cbxru+ftMLDBYYiDKMCzLulpnLmdYRpKWdGnY1 fCR6NE46O7UQNH7QCmnDjVKKdWvSxA10dSMp/KApqB3IhwyeiZXPCxC65 owX+bA48w9MiDXpnKH4OO4aDdnTuYGBRwpXVOLTsxuH2U2CgB0Optu+20 pf1Zqia0w6grQyJB/N0znBRHDYknqsgTBiCQnZt4CdJ+F1R25xCIdkHVS A==; X-IronPort-AV: E=McAfee;i="6600,9927,11011"; a="4954283" X-IronPort-AV: E=Sophos;i="6.07,122,1708416000"; d="scan'208";a="4954283" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2024 05:00:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,122,1708416000"; d="scan'208";a="11782605" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.7]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2024 05:00:25 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Wed, 13 Mar 2024 14:00:21 +0200 (EET) To: Simon Guinot , Bjorn Helgaas cc: "Maciej W . Rozycki" , linux-pci@vger.kernel.org, LKML , stable@vger.kernel.org Subject: Re: [PATCH] PCI: fix link retrain status in pcie_wait_for_link_delay() In-Reply-To: <20240313094938.484113-1-simon.guinot@seagate.com> Message-ID: <53b2239b-4a23-a948-a422-4005cbf76148@linux.intel.com> References: <20240313094938.484113-1-simon.guinot@seagate.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Wed, 13 Mar 2024, Simon Guinot wrote: > The current code in pcie_wait_for_link_delay() handles the value > returned by pcie_failed_link_retrain() as an integer, expecting 0 > when the link has been successfully retrained. The issue is that > pcie_failed_link_retrain() returns a boolean: "true" if the link > has been successfully retrained and "false" otherwise. This leads > pcie_wait_for_link_delay() to return an incorrect "active link" > status when pcie_failed_link_retrain() is called. > > This patch fixes the check of the value returned by > pcie_failed_link_retrain() in pcie_wait_for_link_delay(). > > Note that this bug induces abnormal timeout delays when a PCI device > is unplugged (around 60 seconds per bridge / secondary bus removed). > > Cc: stable@vger.kernel.org > Fixes: 1abb47390350 ("Merge branch 'pci/enumeration'") > Signed-off-by: Simon Guinot Hi Simon, Thanks for your patch. There's, however, already a better series to fix this and other related issues. Bjorn just hasn't gotten into applying them yet: https://patchwork.kernel.org/project/linux-pci/list/?series=824858 (I proposed a patch very similar to yours month ago, but Maciej came up a better way to fix all the issues.) -- i. > --- > drivers/pci/pci.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index ccee56615f78..7ec91b4c5d03 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -5101,9 +5101,7 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, > msleep(20); > rc = pcie_wait_for_link_status(pdev, false, active); > if (active) { > - if (rc) > - rc = pcie_failed_link_retrain(pdev); > - if (rc) > + if (rc && !pcie_failed_link_retrain(pdev)) > return false; > > msleep(delay); > -- i.