Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3071793imu; Thu, 29 Nov 2018 15:05:58 -0800 (PST) X-Google-Smtp-Source: AFSGD/X+kwZvlXx4d6cteX6+z1FqE04WTfoGnw1936G60h3h+C+hTEjJOX16qaHcCgA01fXzaZzL X-Received: by 2002:a63:cc43:: with SMTP id q3mr2821801pgi.291.1543532757939; Thu, 29 Nov 2018 15:05:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543532757; cv=none; d=google.com; s=arc-20160816; b=sF0lPakXbuH57zL868qIZEXCXyvXgQfc6vnIrrO0Lq9B13HENNxEKFwg5CUv2Z6oyo fGlIzuzfL3jS0IUu6q6H1qctsAmJ1GTRLqaoj5r9gMRnZNcDfxSjBrYdHS1kBH4kgnlT gF2BU7UGyq1njoAXEJ3Gfg8+0nIXXQIzFGSv5UqD3yk/tx3yk6US59KqouwgT286oTGP vS0v2m+Mjs1YJ5DMwTJuV3E1EtdSU9bwn+6CmmY+fpmKlvzbmGctR7zpIXgAun5WKJIT gEo1Pe/d94AqfrkReAInEfvidX3Pjx5/OJNyqbUJkumxnOB6rIQCY5ckP7yhf/aq1xkN QAjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=da8hwJO5YhXUmnT4pWJPwih+1r7BmuTF4KH7O78i1zc=; b=Z7CMUqs7K+IM8OGOdRP6qF9dRa5rQUHEt7YATl05bkT6zldFV/sSSDrI8XAzsLhCFU mtYOcNf5qSws3qQiihu5KUC6qxjkpzOS5/iwrHkmtFWnWECGVNmSzPYHXzMS39zRx7mv wKpa5VOIkVWtdugHxVsNx64dp9PJnAwJUfoI9ev0iht3wasPQ9e4s6JIM8Tkqu6buv/B FVyz5VO1pEbpEiiI3IUZdSfHlzkBXX6w7lk6QyKssWqH1YMqH7d8NqCk6dPzp41bpMVJ yfhb3qG7vAmKnUceb6jwuVwmz37dNcXcvm/T74xGFNCNtghk7mdkUHviv69Dk0Tvkua4 hN4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UhV33sG6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k33si499875pld.374.2018.11.29.15.05.43; Thu, 29 Nov 2018 15:05:57 -0800 (PST) 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=UhV33sG6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727208AbeK3KME (ORCPT + 99 others); Fri, 30 Nov 2018 05:12:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:45988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726425AbeK3KME (ORCPT ); Fri, 30 Nov 2018 05:12:04 -0500 Received: from localhost (unknown [69.71.4.100]) (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 96ED320863; Thu, 29 Nov 2018 23:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543532697; bh=SnI4YkvoCDWU11Nn81ZU7jCEYMiHp2OTIQ+2Cz5SqOI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UhV33sG6rtPPX7KZOTDFp4Zk5HmOTVF6D0QVl9Jz6A7eeGi9NgeY+nFz6W/QkNMb3 r+aX2doE17cVhqRPwoKmTElyafBSxsKfmoYzG7zfuOSzeNtP6cM+YYbbhvIEva+vRs ts4Db/aIW9lChc+RcYTlFacV0VM0pESYEpoSpDcw= Date: Thu, 29 Nov 2018 17:04:54 -0600 From: Bjorn Helgaas To: Lukas Wunner Cc: Alex_Gagniuc@Dellteam.com, mr.nuke.me@gmail.com, Austin.Bolen@dell.com, keith.busch@intel.com, Shyam.Iyer@dell.com, mika.westerberg@linux.intel.com, okaya@codeaurora.org, rafael.j.wysocki@intel.com, poza@codeaurora.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: pciehp: Report degraded links via link bandwidth notification Message-ID: <20181129230454.GF178809@google.com> References: <20181129000829.14751-1-mr.nuke.me@gmail.com> <20181129173553.GD178809@google.com> <1828edee07fa483d9600aeb5b9b69456@ausx13mps321.AMER.DELL.COM> <20181129191312.6ksdzjv6qojacv4j@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181129191312.6ksdzjv6qojacv4j@wunner.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 29, 2018 at 08:13:12PM +0100, Lukas Wunner wrote: > On Thu, Nov 29, 2018 at 06:57:37PM +0000, Alex_Gagniuc@Dellteam.com wrote: > > On 11/29/2018 11:36 AM, Bjorn Helgaas wrote: > > > On Wed, Nov 28, 2018 at 06:08:24PM -0600, Alexandru Gagniuc wrote: > > >> A warning is generated when a PCIe device is probed with a degraded > > >> link, but there was no similar mechanism to warn when the link becomes > > >> degraded after probing. The Link Bandwidth Notification provides this > > >> mechanism. > > >> > > >> Use the link bandwidth notification interrupt to detect bandwidth > > >> changes, and rescan the bandwidth, looking for the weakest point. This > > >> is the same logic used in probe(). > > > > > > I like the concept of this. What I don't like is the fact that it's > > > tied to pciehp, since I don't think the concept of Link Bandwidth > > > Notification is related to hotplug. So I think we'll only notice this > > > for ports that support hotplug. Maybe it's worth doing it this way > > > anyway, even if it could be generalized in the future? > > > > That makes sense. At first, I thought that BW notification was tied to > > hotplug, but our PCIe spec writer disagreed with that assertion. I'm > > just not sure where to handle the interrupt otherwise. > > I guess the interrupt is shared with hotplug and PME? In that case write > a separate pcie_port_service_driver and request the interrupt with > IRQF_SHARED. Define a new service type in drivers/pci/pcie/portdrv.h. > Amend get_port_device_capability() to check for PCI_EXP_LNKCAP_LBNC. I really don't like the port driver design. I'd rather integrate those services more tightly into the PCI core. But realistically that's wishful thinking and may never happen, so this might be the most expedient approach. Bjorn