Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934268AbcJ1OeN (ORCPT ); Fri, 28 Oct 2016 10:34:13 -0400 Received: from mail-ua0-f193.google.com ([209.85.217.193]:33767 "EHLO mail-ua0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754180AbcJ1OeM (ORCPT ); Fri, 28 Oct 2016 10:34:12 -0400 MIME-Version: 1.0 X-Originating-IP: [2a02:fe0:c130:1430:7e7a:91ff:fe0e:3e2c] In-Reply-To: <20161028135817.GG3142@twins.programming.kicks-ass.net> References: <20161026191810.12275-1-dh.herrmann@gmail.com> <20161026191810.12275-7-dh.herrmann@gmail.com> <20161027164312.GI3175@twins.programming.kicks-ass.net> <20161028133335.GF3142@twins.programming.kicks-ass.net> <20161028135817.GG3142@twins.programming.kicks-ass.net> From: Tom Gundersen Date: Fri, 28 Oct 2016 16:33:50 +0200 Message-ID: Subject: Re: [RFC v1 06/14] bus1: util - queue utility library To: Peter Zijlstra Cc: David Herrmann , LKML , Andy Lutomirski , Jiri Kosina , Greg KH , Hannes Reinecke , Steven Rostedt , Arnd Bergmann , Josh Triplett , Linus Torvalds , Andrew Morton Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2641 Lines: 55 On Fri, Oct 28, 2016 at 3:58 PM, Peter Zijlstra wrote: > On Fri, Oct 28, 2016 at 03:47:58PM +0200, Tom Gundersen wrote: >> On Fri, Oct 28, 2016 at 3:33 PM, Peter Zijlstra wrote: >> > On Fri, Oct 28, 2016 at 01:33:25PM +0200, Tom Gundersen wrote: > >> > And this, precisely, is what generates all the complexity found in this >> > patch. You want to strictly provide more than causality, which does >> > not, as per the argument above, provide this at all. >> > >> > You're providing a semi-global ordering of things that are themselves >> > not actually ordered. >> >> We are providing two things: causality (as in your physics example >> above), and consistency (which, I agree, is cute, but not necessarily >> crucial). However, the complexity comes from causality. Consistency is >> trivial. The only thing needed for consistency is to tag each message >> by its sender and use this to resolve conflicts in the ordering. The >> alternative would be to just let these entries order arbitrarily >> instead, but conceptually it would not be simpler and it would only >> save us a few lines of code. > > Earlier you wrote: > >> >> To make this work with multicast, we must stage messages first, then >> >> commit on a second round. That is, we must find some way to iterate >> >> over all clocks before committing, but at the same time preventing any >> >> races. The multicast-stability as you just described we get for free >> >> by introducing the second-level ordering via sender-address. > > But you don't need the two-pass thing at all for causality. The entire > two-pass thing, and the serialization, is part of the consistency thing. > > This is not virtually free. > > For causality, all you need is a single iteration, delivering the > message one after the other, only ever doing local clock movements. You > do not need to find the max clock in the multicast set and avoid races > etc.. Ah, I see, we are talking past each other. The property we do want (which is not trivial) is that we do not want to observe the effect before the cause. If an event at A causes an event at B, then the two events should be guaranteed to be observed at C in that order. i.e., if you send a multi-cast message from A to B and C and as a result of receiving the message, B sends a message to C, we want to be guaranteed that C receives the latter after the former. If this property is not wanted, then (repeated) unicast can in most cases be used instead of multi-cast (and a natural optimization, which we left out for now, would be to skip the staging round for unicast messages). Cheers, Tom