Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3805321imj; Tue, 12 Feb 2019 05:05:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IbMuFQi04bvu/pyTerSQ3crDRyF1kWbJyF1LEPN4Zl6RI8c/kIoP6Qs73iekobTz7JCgAC3 X-Received: by 2002:a63:db02:: with SMTP id e2mr3600337pgg.419.1549976742146; Tue, 12 Feb 2019 05:05:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549976742; cv=none; d=google.com; s=arc-20160816; b=V3EOe1Jwu7GcPvP7yQuQEF4rHGGd5eP9D4WEa4Da1Q2YJ7fcsxN/i9Y/Ibb25aak9/ Xfr5IngGbJOPO4tnJGJ02GHd81M5lJhYkYN9gA3OHqQ+xFw6MqenDoFfH8lsDTxDHCZp uPxfroAZVqot4r0PlSvygwWWDZ8Vcm67gyKI6/ItPlIYh4MM0Ni43YlLBP6u+79FYoaP mA+PJkHmT3r7t1nME0FarhLDg+O8Y7ZXKrxOLf1LlVg+AP2cqmnHmAaeiou42WF+Errz s7ae5Qtx0cU/MuWBWI0+z1ObEJ90i+1FA5ZSyDCaAxnQIApPSEDlQa+D3lKkAwmIcO+w XLAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=v1l3UaXrUgzoGS97cXXtoP1+HjJYv0QpMKtDawKY6B4=; b=Odm7daYZ+gPOPyKsnzGjlxVO2CoP4G12jiCQJpDd92F5V9UHgFur4/HCRRYwcWY7JJ APXhKVItOHMbnd9xLyDsUQO2KbV3OFZOVfloW1c9cmRnKrHo0A31VzF8cBUTOt9OCex/ sBwRAYYc1MczEZVecVuG1Es7FukBWEi0MDcR3Wm/CfMw3OE+ahJSTjeerV5srE5ten69 udY5SIAG1LoD7JwnzJnLU8gHSB0PB10UxNG9VjfScVSL5LaMpXUWN2Wt6zNHGGYN1SPm /gRVLirptEGY5Fa471f4UxPr/J7xHtC/+40K5+F9nBzrFXq9XLhJ7Fkp3Am/bVqP01CA zKwA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y20si1701216pgk.498.2019.02.12.05.05.25; Tue, 12 Feb 2019 05:05:42 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728940AbfBLNCZ (ORCPT + 99 others); Tue, 12 Feb 2019 08:02:25 -0500 Received: from mga09.intel.com ([134.134.136.24]:42246 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728126AbfBLNCZ (ORCPT ); Tue, 12 Feb 2019 08:02:25 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Feb 2019 05:02:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,362,1544515200"; d="scan'208";a="319699797" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by fmsmga005.fm.intel.com with SMTP; 12 Feb 2019 05:02:22 -0800 Received: by lahna (sSMTP sendmail emulation); Tue, 12 Feb 2019 15:02:21 +0200 Date: Tue, 12 Feb 2019 15:02:21 +0200 From: Mika Westerberg To: Lukas Wunner 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: <20190212130221.GH7875@lahna.fi.intel.com> 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> <20190212125927.yvotrkyzqtdxm6n7@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190212125927.yvotrkyzqtdxm6n7@wunner.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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 Tue, Feb 12, 2019 at 01:59:27PM +0100, Lukas Wunner wrote: > 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? Yes, once the switch is enumerated the other domain cannot access it anymore but instead gets back errors.