Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3120798img; Mon, 25 Mar 2019 04:18:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpOprb4/xS5vjTK1TRDC2hn/IWMq1VQQNFTARSmFnmHU6m1xD/pzXvfVupCL7HsBGRIkA8 X-Received: by 2002:a17:902:2f43:: with SMTP id s61mr24814155plb.158.1553512696457; Mon, 25 Mar 2019 04:18:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553512696; cv=none; d=google.com; s=arc-20160816; b=pE1+ks1qO/p/6SA3g1JsahhW5ZQ/Dk3r40Fm79jFntOdWn41qj45MEE1/sYGaWZyJR ufov8HOZb1C8TMwjbVZry6BUDJ84NDeJwzdoaqD5ysoznNtl8NGrciHFlAanHdEEwgNy R19Lf9Kb79FWRynQScK+Logh0x7NldCCzgJOf31wOFXD5i/C3rg7LzZH7vJSXnBDWKlF 8xkA/EgYKQ0OeURXaxhl5ZAh8fW3ZwXPCozJNsv6N972c+dNmbyCecHCa32HupvoEtH2 Ndmdls4ShogHdBURLfrQHanVWK3Wj8GpxFz/4AR89M82yzTFWN0m7FE74n9YmJwMzadm 0pSQ== 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; bh=qjFmW2te9vaTe3dW2Yj2DeoGw+a/77g+f7A+guy12j0=; b=VvQekGhdR/Gp9m8BOMUWfvKXiW+UR6MQzIPmnEnGIlHIt+/Ap4QZFPtcLuFIySfP+l WuQooVQjabRcT31sO9z3/0DFPuDJL9kdhtzCg42S4wPnMzC3IF7pzwMt04XZ1IIs3KkJ PL4uvaV3/CU6VJohJBZlh8oJkViKyBOy4p6njlkqb2hQ8L+P7xoAPZB4vqgyOGYICEQU b2oMSLyYD0pcQoB3Eiprp1XQG340v5jzTix4s0r3jOoaUfkehB8obOJNGuVQjOGIebfc q6uoDKZha8iKrPlhKifB/v4U8qLy9X+4icadbXDUc3k3o9edO0IxQ/GnqPMTJh67Ksl6 foWA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org ([209.132.180.67]) by mx.google.com with ESMTP id 15si13296195pfy.11.2019.03.25.04.18.01; Mon, 25 Mar 2019 04:18:16 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730820AbfCYLQT (ORCPT + 99 others); Mon, 25 Mar 2019 07:16:19 -0400 Received: from bmailout2.hostsharing.net ([83.223.90.240]:35351 "EHLO bmailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729727AbfCYLQS (ORCPT ); Mon, 25 Mar 2019 07:16:18 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id BABA52800B489; Mon, 25 Mar 2019 12:16:16 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 7846B210C5; Mon, 25 Mar 2019 12:16:16 +0100 (CET) Date: Mon, 25 Mar 2019 12:16:16 +0100 From: Lukas Wunner To: Mika Westerberg Cc: linux-kernel@vger.kernel.org, Michael Jamet , Yehezkel Bernat , Andreas Noever , "David S . Miller" , Andy Shevchenko , netdev@vger.kernel.org Subject: Re: [PATCH v2 17/28] thunderbolt: Add support for full PCIe daisy chains Message-ID: <20190325111616.gjfkos666gz3blj2@wunner.de> References: <20190206131738.43696-1-mika.westerberg@linux.intel.com> <20190206131738.43696-18-mika.westerberg@linux.intel.com> <20190324113144.wubme46hby7rj6r2@wunner.de> <20190325095733.GC3622@lahna.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190325095733.GC3622@lahna.fi.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 25, 2019 at 11:57:33AM +0200, Mika Westerberg wrote: > On Sun, Mar 24, 2019 at 12:31:44PM +0100, Lukas Wunner wrote: > > On Wed, Feb 06, 2019 at 04:17:27PM +0300, Mika Westerberg wrote: > > > -static void tb_activate_pcie_devices(struct tb *tb) > > > +static int tb_tunnel_pci(struct tb *tb, struct tb_switch *sw) > > > { > > [...] > > > + /* > > > + * Look up available down port. Since we are chaining, it is > > > + * typically found right above this switch. > > > + */ > > > + down = NULL; > > > + parent_sw = tb_to_switch(sw->dev.parent); > > > + while (parent_sw) { > > > + down = tb_find_unused_down_port(parent_sw); > > > + if (down) > > > + break; > > > + parent_sw = tb_to_switch(parent_sw->dev.parent); > > > + } > > > > The problem I see here is that there's no guarantee that the switch > > on which you're selecting a down port is actually itself connected > > with a PCI tunnel. E.g., allocation of a tunnel to that parent > > switch may have failed. In that case you end up establishing a > > tunnel between that parent switch and the newly connected switch > > but the tunnel is of no use. > > Since this is going through tb_domain_approve_switch() it does not allow > PCIe tunnel creation if the parent is not authorized first. Yes, but my point is that it doesn't make much sense to establish a tunnel between a switch and one of its parent switches unless that parent switch is reachable from the root switch over a PCI tunnel or a series of PCI tunnels. It may be worth checking that condition, or, if new tunnels are established top-down in the daisy-chain and tunnel establishment has failed for a switch, to not establish tunnels for switches beyond that one. Thanks, Lukas