Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3912828ybg; Fri, 25 Oct 2019 10:36:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNzruT9QcYmlItkwRLo3Anf/LQhbTkdGWbG58D0EwtTTzFoc4KQ52mYxbfsaJ9WQZdF/Q1 X-Received: by 2002:aa7:d2d3:: with SMTP id k19mr1286152edr.267.1572024998282; Fri, 25 Oct 2019 10:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572024998; cv=none; d=google.com; s=arc-20160816; b=h8CourKZ3QqhABdyIk9eVAi2eX8MvMInskyFILNgXY6y4Hkerk7C3KmqTwdz6T630P zVLzpNMF2CHirUGh7o45Yzk+Tv42JdfNhQSIf+Qv4v4HMoRPOhVrsfNd5nqFOOHf7aYZ n/LqHZ5pOAVTymz1DUC/0NhvLNhl11jqy9V4mKEiWwKJZCsahu7oeePjY4OUTMPpoJCU POr6btlJaOjYGN732fJCEr9Q9CUkSOVq7IyEs2e5MYZVl3fAqaesYUrJ4AcGHYgIwA8V rU1Vw35NroxANBflUVqu41mSbg+l6GtSRU1mHyVQhrmAsSmTatuk1IcHM4nLjHcrOMae Fwdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pd8O3Eb7qSMRp9Kj05XZyId359rCorPJtmLFzVCz1tU=; b=Pg4X8TtVY5EuRa7h8b95x4hM2s05AIbBCgaShYB6M1b5GgV8Q33Iz8TnvOuBxNcCHt 8tlxWp1xb70QyqQPgTdXC813isMMdwT5tky551G1HvR8uTEQMrd7lp0GLZokXQLIPlZD or7KJRmni8KILEtSW6E49Uoy850CXEw1yCeRLRiKwT393XbsJqreF3NfzA5E0HIMQb59 f3k+zlRHE/XYNVgEJedg3zyxpbhirkvRl+aQWO69SqpmQD99NJRwha7KxxshjfOHBGsD nSmcWrBUCKsY4cHkgn5SVRgq+uODdrMW+5scrkVYz1+GA4ij5vaQnXGoNJRd68g3WioI MLAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BcaBLSXm; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gw21si1711899ejb.202.2019.10.25.10.36.13; Fri, 25 Oct 2019 10:36:38 -0700 (PDT) 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=pass header.i=@google.com header.s=20161025 header.b=BcaBLSXm; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409491AbfJXOtr (ORCPT + 99 others); Thu, 24 Oct 2019 10:49:47 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:46536 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409485AbfJXOtr (ORCPT ); Thu, 24 Oct 2019 10:49:47 -0400 Received: by mail-qt1-f194.google.com with SMTP id u22so38198869qtq.13 for ; Thu, 24 Oct 2019 07:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pd8O3Eb7qSMRp9Kj05XZyId359rCorPJtmLFzVCz1tU=; b=BcaBLSXmWaHk5110Xo0O38xPCC95AqKidjb+KH5ChdckilUoZbt1WyEwYm1yUOa4RM RfiRdAcCfWShMq1AjdO4X2NNxO19cCSlBCF7CR4/hwIxt4Qc9ZpW6S48IFadbBdf17cX JALXMDwZp1n9/94SF0EcqIO9snuYmxP7M7P7Uz6YvVLb9xy5N6KEnmIYf6UEPboXYSS4 atki90J22tNTjqSCVObVMuAnhhzK1cJm0cqovSZ96lgg/WHDuWXptOynmVwTtSpq1U9m ZexHeZgG4YVPSYrJr3pZGyq4CSR3sZlmC9nig7ZRz43wPKhTVKpcWL8SFOKxwtxlIzAv Hxqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pd8O3Eb7qSMRp9Kj05XZyId359rCorPJtmLFzVCz1tU=; b=SYG/zsb0t86UcK2YEuDdkjOBhJVYI4MSW4GX4sWAgEIidv2mirCPLoccgkRKdvgJqP SXJG1GH+8yr1r7P4+4yXx8T/vlKsN2NOPDmeUpeRTUomdPjcreg/M24BiAdWT9Njunsw +idst09kN18o+Cz10Z7v2eVVUHtRvsf7O4cPlByWzzVf5Y99wcnkJUbSI6GWJOmiqyYH CxLTljzenqodZzgaIERHsj1wSZb4HSCZRJT02bk7J45kx5/00m+D9v0fOaYA5YHnhAhu 4whEZz+KW3smvg5S7QRKODRYKKlOrGpgWrfqN86S/BkgPGZcqYBiQM+o9beO/1x0IKVf Vkvw== X-Gm-Message-State: APjAAAVl0pQiM6kWbWpAKFah88qPaxCzZeV6GCK/z01TzH5V9EzS//wG psKZT67cUHB1RijtxxHEHWKgltqvZ+UouD4csYsG2A== X-Received: by 2002:a0c:fec3:: with SMTP id z3mr15231985qvs.122.1571928585784; Thu, 24 Oct 2019 07:49:45 -0700 (PDT) MIME-Version: 1.0 References: <20191009114809.8643-1-christian.brauner@ubuntu.com> <20191021113327.22365-1-christian.brauner@ubuntu.com> <20191023121603.GA16344@andrea.guest.corp.microsoft.com> <20191024113155.GA7406@andrea.guest.corp.microsoft.com> <20191024130502.GA11335@andrea.guest.corp.microsoft.com> <20191024134319.GA12693@andrea.guest.corp.microsoft.com> <20191024144049.GA13747@andrea.guest.corp.microsoft.com> In-Reply-To: <20191024144049.GA13747@andrea.guest.corp.microsoft.com> From: Dmitry Vyukov Date: Thu, 24 Oct 2019 16:49:33 +0200 Message-ID: Subject: Re: [PATCH v6] taskstats: fix data-race To: Andrea Parri Cc: Christian Brauner , Will Deacon , LKML , bsingharora@gmail.com, Marco Elver , stable , syzbot , syzkaller-bugs Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 24, 2019 at 4:40 PM Andrea Parri wrote: > > On Thu, Oct 24, 2019 at 03:58:40PM +0200, Dmitry Vyukov wrote: > > On Thu, Oct 24, 2019 at 3:43 PM Andrea Parri wrote: > > > > > > > But why? I think kernel contains lots of such cases and it seems to be > > > > officially documented by the LKMM: > > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/memory-model/Documentation/explanation.txt > > > > address dependencies and ppo > > > > > > Well, that same documentation also alerts about some of the pitfalls > > > developers can incur while relying on dependencies. I'm sure you're > > > more than aware of some of the debate surrounding these issues. > > > > I thought that LKMM is finally supposed to stop all these > > centi-threads around subtle details of ordering. And not we finally > > have it. And it says that using address-dependencies is legal. And you > > are one of the authors. And now you are arguing here that we better > > not use it :) Can we have some black/white yes/no for code correctness > > reflected in LKMM please :) If we are banning address dependencies, > > don't we need to fix all of rcu uses? > > Current limitations of the LKMM are listed in tools/memory-model/README > (and I myself discussed a number of them at LPC recently); the relevant > point here seems to be: > > 1. Compiler optimizations are not accurately modeled. Of course, > the use of READ_ONCE() and WRITE_ONCE() limits the compiler's > ability to optimize, but under some circumstances it is possible > for the compiler to undermine the memory model. [...] > > Note that this limitation in turn limits LKMM's ability to > accurately model address, control, and data dependencies. > > A less elegant, but hopefully more effective, way to phrase such point > is maybe "feel free to rely on dependencies, but then do not blame the > LKMM authors please". ;-) We are not going to blame LKMM authors :) Acquire will introduce actual hardware barrier on arm/power/etc. Maybe it does not matter here. But I feel if we start replacing all load-depends/rcu with acquire, it will be noticeable overhead. So what do we do in the context of the whole kernel?