Received: by 10.223.185.116 with SMTP id b49csp2101800wrg; Thu, 22 Feb 2018 08:10:33 -0800 (PST) X-Google-Smtp-Source: AH8x225QMTu+4Vgdg8TBL0hpCkkWAT6g5YNqlvafJXXfuTyxmu7qYlLAWx1ECVJvW8hdmX7XYT8m X-Received: by 10.98.90.132 with SMTP id o126mr7278819pfb.239.1519315833063; Thu, 22 Feb 2018 08:10:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519315833; cv=none; d=google.com; s=arc-20160816; b=XipdYHmS0m0pKSDZjXrRWKuW1Vx3UOujTilJUPs8cttLL0WWJ1Gjctarwmi9fHzLJs d+U+HErkKX5FaJiiCJDjBJU04hnhvp5RX413+qnshbaKM7LvKpcGzljD/bHXVNJQTdKc 90SOedPsIXkM5/EfCFoCDEBwoiG/43qxuqbM4HfTIRpZDmwyQD/RxblpSQHLgEjTtE6f gqokPAAYFHjWkObKc8rLEt6WJIUYWq0NaxxuI7n4oiygl4K3jFS9QzwS6N1MAVIB864f yhTfLS2YlE0A22ynadsbOg7c6fcQA44SsK8u4EIifadY4rpkkcaaFU2h7cX7mMGqgi7i 1pkw== 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:dkim-signature:arc-authentication-results; bh=3Mf+oSWRMaN4AUNOIrr2JisILg8YlgDnbn0CWwuv6kI=; b=V5kr7CNp1AbgJ3Rg3DaqK+PL+KnZdH0+L0pDhzpzfdJ5RAkHgC5qHrocJBnBAzluvK C9HR4TXn/q/Lo9DrI7EXcbFbwIlV5rnkq/i6SUp9ybWn3GJuJeHk4eG5meyCtkZbMWV1 GoPIZMOuG1PXaEuM6aW9YE3dd7rk8ISr+DsJDNME7vhI/IaX2CYB/0TGBzJ3aQuUzPmN EgXH3/C9lSGP+BTQgyN7RU2277FoJ/GcGl7JUnj9RkDWbakOnrbbo3Yr+266vmkNe+0c THbN5cwYQ47eqfmR6R0Cn+RhVYOprHGF+s9LIQrSUzhDIVC8H3Kk53vG0SWC+EwTOj5E a09g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=OToD49Cc; 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 i66si197597pgc.445.2018.02.22.08.10.16; Thu, 22 Feb 2018 08:10:33 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=OToD49Cc; 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 S933173AbeBVQIQ (ORCPT + 99 others); Thu, 22 Feb 2018 11:08:16 -0500 Received: from merlin.infradead.org ([205.233.59.134]:54900 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932952AbeBVQIP (ORCPT ); Thu, 22 Feb 2018 11:08:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3Mf+oSWRMaN4AUNOIrr2JisILg8YlgDnbn0CWwuv6kI=; b=OToD49CcA2+YlRXzBTUR1HWls 3bKiGxe6Mas6Ptm/ajdOUCRLr0W8MtZgUv4QmjNpo70/SHFIdrnsu2fD58xTL6ox4KztX2RsrY4o7 FLBWUGUp6TDPkW/O6/zJtHrFhN0PRkEpTL69QYZ4kNovmAgfRivKRLDiiJb3L0cfD53IRJlma0eMo aZymqfyCQHqi3LeLUokc5mh0jKin8YRb8Flkhpj9RjOjpBNZij/dfDXZNrnDrH2hUVwB70UOZu/oR 7PyBVAazbLYsSbtrCOp6/3wR399E8HX6MiMw8YYpIq+GZ1PWvbmRZFA2z9K07LoYVyaIKfxhxV9f/ vphL2dHOg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1eotPo-0007DQ-Hi; Thu, 22 Feb 2018 16:08:13 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5ADE12029FD41; Thu, 22 Feb 2018 17:08:11 +0100 (CET) Date: Thu, 22 Feb 2018 17:08:11 +0100 From: Peter Zijlstra To: Boqun Feng Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrea Parri Subject: Re: [RFC tip/locking/lockdep v5 05/17] lockdep: Extend __bfs() to work with multiple kinds of dependencies Message-ID: <20180222160811.GT25201@hirez.programming.kicks-ass.net> References: <20180222070904.548-1-boqun.feng@gmail.com> <20180222070904.548-6-boqun.feng@gmail.com> <20180222142614.GR25201@hirez.programming.kicks-ass.net> <20180222151210.jwxjchywk4jfecyf@tardis> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180222151210.jwxjchywk4jfecyf@tardis> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 22, 2018 at 11:12:10PM +0800, Boqun Feng wrote: > On Thu, Feb 22, 2018 at 03:26:14PM +0100, Peter Zijlstra wrote: > > On Thu, Feb 22, 2018 at 03:08:52PM +0800, Boqun Feng wrote: > > > Now we have four kinds of dependencies in the dependency graph, and not > > > all the pathes carry strong dependencies, for example: > > > > > > Given lock A, B, C, if we have: > > > > > > CPU1 CPU2 > > > ============= ============== > > > write_lock(A); read_lock(B); > > > read_lock(B); write_lock(C); > > > > > > then we have dependencies A--(NR)-->B, and B--(RN)-->C, (NR and > > > RN are to indicate the dependency kind), A actually doesn't have > > > strong dependency to C(IOW, C doesn't depend on A), to see this, > > > let's say we have a third CPU3 doing: > > > > > > CPU3: > > > ============= > > > write_lock(C); > > > write_lock(A); > > > > > > , this is not a deadlock. However if we change the read_lock() > > > on CPU2 to a write_lock(), it's a deadlock then. > > > > > > So A --(NR)--> B --(RN)--> C is not a strong dependency path but > > > A --(NR)--> B --(NN)-->C is a strong dependency path. > > > > I'm not really satisfied with the above reasoning. I don't disagree, but > > if possible it would be nice to have something a little more solid. > > > > What do you mean by "solid"? You mean "A --(NR)--> B --(NN)-->C" is too > abstract, and want something like the below instead: The above description mostly leaves it as an exercise to the reader to 'proof' ignoring *R -> R* is both safe and complete while that is the main argument.