Messages in this thread | | | Date | Tue, 12 Feb 2019 13:59:27 +0100 | From | Lukas Wunner <> | Subject | Re: [PATCH v2 12/28] thunderbolt: Add functions for allocating and releasing hop IDs |
| |
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?
| |