Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3805499imj; Tue, 12 Feb 2019 05:05:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IZfck4oCBaNb+5oSMrE3H24FxYqdpveOVX02UxEOzJsIhlHYHCplSWMlpbEzyCjsFh9H9fJ X-Received: by 2002:a62:3990:: with SMTP id u16mr3929460pfj.80.1549976751063; Tue, 12 Feb 2019 05:05:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549976751; cv=none; d=google.com; s=arc-20160816; b=qHwTTXfTBB4KkBYQrg0HStQdke0f/9OUqwXchKLDqRp8jUHOHGAn29d8rHdrCBP6M3 yQcPnhUv1eZd9y60XvbtxfoTbhh/0H6QdaA2sRqHVBtnaam/88P90cEhtPDUceQUWcdl bnuN0GlRFfVmfDGnkX/mNzHf5klTNWNgac+Q4yDXmZUhw0fOhKAw4gMqWIIlQPp62Lj9 szUuFVsl3x69KeAoMfqNQmg+4JW9818lKYg2wM77dVFr6ewZnIPjTxGwwYoMCiFM7KiG 6t/tJV6kAP+L2Xcey/wVq3n3oHlbXHiD/WJNptQiW/Q/ehOloISOycGXDiF4dwsuzoQc HxZw== 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=vKB43Ka0UF55ifpQ9ywXfeqSCRX+Qet/YLfd9fFduY0=; b=KHg3uCIzVAp879lkoBM7aIK19SOkqbz9zsVqAdGjn2UufGqAFJTmIxYb0D1Ldtj91d iPm2DioeIXM/kkXmib4o4FrihLhjIJMklvHA4tdSDlYVoZycPjNRbQFrA4oiORHWb/FG LIhlwAvfqOVPQRLbO40bTWNNG+LteHVIrv0pKjJtwCMwSNPMzqHVqkgnGcSPXbW7LqzA bUlqBIEXqMjqS2utmx+4tUx4ZYJAK1CMlAgwFM/Wq3Muq8T68qqtIxlib/ykpa8p/rGF bwIiNq4N25IzB8mDz3kmx+mfnU3syO4O5+QcMvZGK1COr8DaPLFf7V/ejsH1NYH43GOJ 7oDg== 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 (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16si12882957pga.328.2019.02.12.05.05.11; Tue, 12 Feb 2019 05:05:51 -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; 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 S1729453AbfBLM7a (ORCPT + 99 others); Tue, 12 Feb 2019 07:59:30 -0500 Received: from bmailout2.hostsharing.net ([83.223.90.240]:51121 "EHLO bmailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728145AbfBLM73 (ORCPT ); Tue, 12 Feb 2019 07:59:29 -0500 Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (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 6F97F2800B1DF; Tue, 12 Feb 2019 13:59:27 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 2D6F44B560; Tue, 12 Feb 2019 13:59:27 +0100 (CET) Date: Tue, 12 Feb 2019 13:59:27 +0100 From: Lukas Wunner To: Mika Westerberg Cc: linux-kernel@vger.kernel.org, Michael Jamet , Yehezkel Bernat , Andreas Noever , Andy Shevchenko Subject: Re: [PATCH v2 12/28] thunderbolt: Add functions for allocating and releasing hop IDs Message-ID: <20190212125927.yvotrkyzqtdxm6n7@wunner.de> References: <20190206131738.43696-1-mika.westerberg@linux.intel.com> <20190206131738.43696-13-mika.westerberg@linux.intel.com> <20190210121353.fw7gj4pm7ce3flvf@wunner.de> <20190211083043.GT7875@lahna.fi.intel.com> <20190212124333.hgrnm6owtuqzp4iu@wunner.de> <20190212125125.GG7875@lahna.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190212125125.GG7875@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 Tue, Feb 12, 2019 at 02:51:25PM +0200, Mika Westerberg wrote: > On Tue, Feb 12, 2019 at 01:43:33PM +0100, Lukas Wunner wrote: > > On Mon, Feb 11, 2019 at 10:30:43AM +0200, Mika Westerberg wrote: > > > On Sun, Feb 10, 2019 at 01:13:53PM +0100, Lukas Wunner wrote: > > > > If there are two Macs at the ends of the daisy-chain with Thunderbolt > > > > devices in-between, the other Mac may already have established tunnels > > > > to some of the devices and therefore has occupied hop entries in the > > > > devices' path config space. How do you ensure that you don't allocate > > > > the same entries and overwrite the other Mac's hop entries, thereby > > > > breaking its tunnels? > > > > > > If the other Mac has enumerated the device (set the upstream port, > > > route, depth) then the other Mac cannot access the device. You get an > > > error (we deal with that in the later patch in the series when we > > > identify XDomain connections). The Hop ID allocation is only relevant in > > > a single domain. Crossing one needs to have protocol such as we have in > > > case of ThunderboltIP to negotiate Hop IDs used in the link between two > > > domains. > > > > Understood now, thanks. (Well, in part at least.) > > > > It looks like there's a race condition currently in tb_switch_configure() > > wherein two machines on the daisy chain may write the config simultaneously > > and overwrite each other's changes. Isn't there some kind of synchonization > > mechanism available to prevent such an outcome? > > AFAICT that's expected. The host that first enumerated the device wins. Yes but tb_switch_configure() goes on to blindly call tb_plug_events_active(). Does that or any other subsequently called function fail if another machine managed to overwrite the switch config?