Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2309322rdf; Mon, 6 Nov 2023 10:10:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBKvbM727ZjzRmi5gmbx4fk9wyolXjPyGpZ05V+ABMlsjAiBozVcJ4w8Emc0PmWaeCCuNo X-Received: by 2002:a05:6a20:4323:b0:17b:9d92:7d0 with SMTP id h35-20020a056a20432300b0017b9d9207d0mr35313335pzk.52.1699294252845; Mon, 06 Nov 2023 10:10:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699294252; cv=none; d=google.com; s=arc-20160816; b=CwM+t5KlokrLVCJuN4AnG4gukqBEgG+BnfViPZ2drSWuACW/hjdN4Jx9qSoT9MXVWu GRPH6mHtNRYB9DUTNoxiFFm/fxrsHtWgwg89LtNPgl61bfdwKMluCsLrSiaGazdIV+9i 2XP0zIYrXLqFEGxXcLgKWeCx9ieV1qs4CtTLAhET+lsxVhynZDOsUAhnDaWDKCKc5qn/ jW0QJ5jHkJRovAgmONtyMFj/i7qR4Jz945lrtCHdH9uWygw+qjrlShwv/NLeZpz+d4dJ ffmIvW4c0PlJQPQVG5YP2AowpHFadaVShgh6kI7HpXy0WlE5hD3r9PrkCscjyaxBNw7S FUdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=I3NhPc65UZTwOMg7LcbDCQ0jW8km7NvcatICpBUwaes=; fh=0ieJPfoExuQt46vDqFsOsJ96/VpYGniNBzlGGgjLsEk=; b=i73paLx+bIEsNLpMFLA1rYLmxF8f8sORPAozs7e5BnyeTfG9p/G763D9xPouDzAUtG JtttEyvVOeJ617TEw/yOXrLizV7l1H5sQbZZtziWjhmAOuDri7vnG/gmxDwyyxrsS//a KxyCLipATnFI+sWOyh3jT4CJbJJkwWvgcmU7OIMT+eLwbc6f4RKM3gmndWpgb7b1fPQ1 Emw33IZcA2tnanJfjR4wyHqd8Eh+2eLaXxJ9EnIIM+MXz+WiBB2OYKGOeH0/6p1FFBwy hEKRRexhQjS4TsflhVNvJPPkOvq5NABcNCI2H+tMp/7Fix4qXRfT2ubfg9JFMdJ9Yzir OgPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id g30-20020a63521e000000b005b91536981csi221737pgb.11.2023.11.06.10.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 10:10:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id ABDE68033DC8; Mon, 6 Nov 2023 10:10:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232191AbjKFSKa (ORCPT + 99 others); Mon, 6 Nov 2023 13:10:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232174AbjKFSK3 (ORCPT ); Mon, 6 Nov 2023 13:10:29 -0500 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [83.223.95.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0078DD47; Mon, 6 Nov 2023 10:10:24 -0800 (PST) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL Global TLS RSA4096 SHA256 2022 CA1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id D4A49300002D5; Mon, 6 Nov 2023 19:10:22 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id CCA24473B55; Mon, 6 Nov 2023 19:10:22 +0100 (CET) Date: Mon, 6 Nov 2023 19:10:22 +0100 From: Lukas Wunner To: Mario Limonciello Cc: Karol Herbst , Lyude Paul , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , Bjorn Helgaas , Hans de Goede , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Mika Westerberg , Danilo Krummrich , David Airlie , Daniel Vetter , Xinhui Pan , "Rafael J . Wysocki" , Mark Gross , Andreas Noever , Michael Jamet , Yehezkel Bernat , Pali =?iso-8859-1?Q?Roh=E1r?= , Marek =?iso-8859-1?Q?Beh=FAn?= , "Maciej W . Rozycki" , Manivannan Sadhasivam , "open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS" , "open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS" , open list , "open list:RADEON and AMDGPU DRM DRIVERS" , "open list:PCI SUBSYSTEM" , "open list:ACPI" , "open list:X86 PLATFORM DRIVERS" , "open list:THUNDERBOLT DRIVER" Subject: Re: [PATCH v2 8/9] PCI: Exclude PCIe ports used for tunneling in pcie_bandwidth_available() Message-ID: <20231106181022.GA18564@wunner.de> References: <20231103190758.82911-1-mario.limonciello@amd.com> <20231103190758.82911-9-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231103190758.82911-9-mario.limonciello@amd.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 06 Nov 2023 10:10:49 -0800 (PST) On Fri, Nov 03, 2023 at 02:07:57PM -0500, Mario Limonciello wrote: > The USB4 spec specifies that PCIe ports that are used for tunneling > PCIe traffic over USB4 fabric will be hardcoded to advertise 2.5GT/s and > behave as a PCIe Gen1 device. The actual performance of these ports is > controlled by the fabric implementation. > > Downstream drivers such as amdgpu which utilize pcie_bandwidth_available() > to program the device will always find the PCIe ports used for > tunneling as a limiting factor potentially leading to incorrect > performance decisions. > > To prevent problems in downstream drivers check explicitly for ports > being used for PCIe tunneling and skip them when looking for bandwidth > limitations of the hierarchy. If the only device connected is a root port > used for tunneling then report that device. I think a better approach would be to define three new bandwidths for Thunderbolt in enum pci_bus_speed and add appropriate descriptions in pci_speed_string(). Those three bandwidths would be 10 GBit/s for Thunderbolt 1, 20 GBit/s for Thunderbolt 2, 40 GBit/s for Thunderbolt 3 and 4. Code to determine the Thunderbolt generation from the PCI ID already exists in tb_switch_get_generation(). This will not only address the amdgpu issue you're trying to solve, but also emit an accurate speed from __pcie_print_link_status(). The speed you're reporting with your approach is not necessarily accurate because the next non-tunneled device in the hierarchy might be connected with a far higher PCIe speed than what the Thunderbolt fabric allows. Thanks, Lukas