Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp816748imm; Thu, 31 May 2018 09:52:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLgRyafR0AXzo2b2giI4q3etf0Z6m3rdvQDDZtv8JoVxC1iaZ/st8DtSb/pVVINBd41Nfq7 X-Received: by 2002:a17:902:8d81:: with SMTP id v1-v6mr7564909plo.136.1527785576130; Thu, 31 May 2018 09:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527785576; cv=none; d=google.com; s=arc-20160816; b=mSXW+t+tDTg6AE+xIBsrjYPJwHYB1DieYgbuXTS8yxKOAXWi9Wy9FUXOwY9YE/IC7H Dlj5MjXFP4b9f5B0OQv0IlWrWifqvfsN4/cC9auuzEbhnKohZIBUIrmU5sGiY7YGrlja K3pymChBzBz85uOl0WrMW0xVOGWrPVROfz8/BAKwv72J5ki1M1TSAVJEpSLDS3UoDKA+ vP4AXs5oNvLq49yMjKczS1NNvICIcS0Sfl/s2+F/D+HIo+uE0xTqtx27nW+kKCiFR+tU Oe/+NM0UQkhOz3LBiLAL2LE3dtPfKW76AGykhPoakHiKD/1peL577Obw/IgRHbPBayFD IyvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=WyVva38NwwLOzTxVw5wJaodOm03vPVEYpPTcWmKoJkE=; b=o7QjIUH5jbN0oUUOw6cmxeTMobHiwMa2SbhJ8W/x6voQ/yCVY4R0QJV8r6jX+qxwKT zJgAwGLBbWT0/guQ6qb5Ai9tBUf7MU9L8SkrqG03Cer+zzBLyIFaXMFnxJ8V9urit8Gn IlzfkpBaJ5s/7NdR93NRQmI6GYv6lVJbRe+WHjoEpZj+njCYCxFQ6rxyN0yufeLm/qye n3pgIRS4PZOECbkCWItspX9m7Wp1Vzq9djUKYewu2Q28q4x3vJsgXXrAvRW6p1ZUmSDY BBj/GVqKXRbHGKcyRzbFuqBeGlQo3Tdw9dJ7qfO2hBHbUbYP8HRjte84HiZm7ILrg+Te +CAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hmis7pYm; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12-v6si3599805pge.684.2018.05.31.09.52.41; Thu, 31 May 2018 09:52:56 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=hmis7pYm; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932746AbeEaQu3 (ORCPT + 99 others); Thu, 31 May 2018 12:50:29 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:39500 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932714AbeEaQu1 (ORCPT ); Thu, 31 May 2018 12:50:27 -0400 Received: by mail-ot0-f193.google.com with SMTP id l12-v6so26047833oth.6; Thu, 31 May 2018 09:50:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=WyVva38NwwLOzTxVw5wJaodOm03vPVEYpPTcWmKoJkE=; b=hmis7pYmg3R5NMXirlURVvR8HxTESfaR+/pnLF9SaTtd1EMQUJd78QyHc43EmzI7kv 3d5D8/G6VZjMZceR5nMxOT+hauPxsIDEzforuSI1PXFJNdFt2Cu/MOOZ4DXa+De2epNc t90oOYxNZ4W5bvaSkPbQTLTECxgOX8WMqw58X30gVihW3MuMljNnvwX3jrVJ2gsPhHzQ XvaL961SgalRn2PIu/Rlui5pYc1+Jh8l3i4JFISustD47pi0q6V1LJmp9hRIMPdiC4O9 GRZOctrHV5rP2SOKwU9yRkoR2FV+9oviCrwFedJqgrE7rK/ekXDq3mhCjp3jAlju5Acs HAGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WyVva38NwwLOzTxVw5wJaodOm03vPVEYpPTcWmKoJkE=; b=Kf+Fzjcl7xSzqhy2u6pQp5b307I0G2L4xZ1+RJtepQwDiE4P4r1UYGP6vIPygnhNo8 8DhpJIpFtaHPvDQIzD0KOG51NndhA6QhgLgfd9OOihUmMj4WfOzufwy0tXl66Eg6KcuW caPE1Km4VdyKUr1KtTOFQgMtx93iCCkSCJufbx59s8bMytVN27g/VdJ97buFQjKmji9v rJ5JoLTcstQGyqBD08KbK/81/QGbuCTSd4aVd8uf+uk48yNZHFKBRYCil0PJjbSb3zn/ C3HSgZ23DMITQiLiDN26JoADb/SquH5Z0btygf+khrZGwx9E0fY6/Qi81crmXA6t/3zc /9+w== X-Gm-Message-State: ALKqPwfmCpN8dNm6hqbbn6vEG2FNyg1VO/0beSFUVdgzw+Il3A9RG86v lZOMvYLKDjHAeOQBFOx/OjeroHnVySg= X-Received: by 2002:a9d:2f68:: with SMTP id h95-v6mr5379665otb.376.1527785426396; Thu, 31 May 2018 09:50:26 -0700 (PDT) Received: from nuclearis2_1.gtech (c-98-201-114-184.hsd1.tx.comcast.net. [98.201.114.184]) by smtp.gmail.com with ESMTPSA id d201-v6sm20290697oig.18.2018.05.31.09.50.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 09:50:25 -0700 (PDT) Subject: Re: [PATCH] PCI: Check for PCIe downtraining conditions From: "Alex G." To: Sinan Kaya , Alex_Gagniuc@Dellteam.com, bhelgaas@google.com Cc: Austin.Bolen@dell.com, Shyam.Iyer@dell.com, keith.busch@intel.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180531150535.9684-1-mr.nuke.me@gmail.com> <28004506-24f0-6d10-2d1e-074e0483d2f9@codeaurora.org> <4e0611c872054e768daa96b302651db3@ausx13mps321.AMER.DELL.COM> <3b8a895b-3080-7ddb-cbfd-5aa972e9bf65@gmail.com> <35563ce3-e235-096c-4b9b-5f3664d67d0f@codeaurora.org> <093b2789-39a1-db9e-5783-b0488b3c9ccd@gmail.com> <32d58835-2f35-0b80-38d0-b9ff603619dd@codeaurora.org> <54071f83-5d0d-04a0-d448-0c99ec0ffc4f@gmail.com> Message-ID: Date: Thu, 31 May 2018 11:50:25 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <54071f83-5d0d-04a0-d448-0c99ec0ffc4f@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/31/2018 11:49 AM, Alex G. wrote: > > > On 05/31/2018 11:13 AM, Sinan Kaya wrote: >> On 5/31/2018 12:01 PM, Alex G. wrote: >>>> PCI: Add pcie_print_link_status() to log link speed and whether it's limited >>> This one, I have, but it's not what I need. This looks at the available >>> bandwidth from root port to endpoint, whereas I'm only interested in >>> downtraining between endpoint and upstream port. >> >> I see what you are saying. >> >> With a little bit of effort, you can reuse the same code. >> >> Here is an attempt. >> >> You can probably extend pcie_bandwidth_available() to put an optional parent bridge >> device for your own use case and terminate the loop around here. >> >> https://elixir.bootlin.com/linux/v4.17-rc7/source/drivers/pci/pci.c#L5182 >> >> Then, you can use the existing code to achieve what you are looking for via >> pcie_print_link_status() by adding an optional parent parameter. >> >> bw_cap = pcie_bandwidth_capable(dev, &speed_cap, &width_cap); >> bw_avail = pcie_bandwidth_available(dev, &limiting_dev, &speed, &width, *parent*); > > That's confusing. "confusing" refers to the way the code currently works. It doesn't refer to your proposal. Alex I'd expect _capable() and _available() to be > symmetrical. They either both look at one link only, or both go down to > the root port. Though it seems _capable() is link-local, and > _available() is down to root port. > >> >> If parent parameter is NULL, code can walk all the way to root as it is doing today. >> If it is not, then will terminate the loop on the first iteration. >>