Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1738179ybh; Thu, 16 Jul 2020 22:52:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJQPFe54DwRlRXnTbrbeG50mcYB5QI7envII0YvuccqHulon3suTxXEEPm501y7dfgddix X-Received: by 2002:a05:6402:319b:: with SMTP id di27mr7871488edb.133.1594965166160; Thu, 16 Jul 2020 22:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594965166; cv=none; d=google.com; s=arc-20160816; b=anc2+8ERrinBLLzSPQIiUK2khanVCBip6x2y1Q8V3gGoIaTOEEEnW4sva5K1llnj20 yFt+TY/OFGkGWdA57L2kSzW8DK82Oce2dOmKKhloiPynn1KYisK3c2VPSTR7xPBVtwiq 1x/FZv4TRCWeWRzDF3k34KW7N/ysakFgtSbnXmrfU2OzD9ZPQh1Aaxe8NM7vnKB2Fx5q BAFIXS8/9fXiIyu4uFlFxNJ0NoEDzWWGXdBdR//LExS6Rw/FKaxU4UW5GbUBKWFi+0xg vZS/dHAd6YsZ5pKcvXk6vNqAkN0Vttum9T8JPNUpnE4CNUJDT9xRNDrVMmwn7PCdeUZs l3hA== 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 :reply-to:in-reply-to:references:mime-version:dkim-signature; bh=jRkz34kzHFPJP/YTtWgR3dxC6hqrBlvuag30CVq0UoQ=; b=lZZoKEFJp+xORfiI/NaWOAWoO8gfKo5PT0jVuCDXhp1PAxqsu7LAXHutKHnDIYhHBA R2Lz0pQVv4S/Ndxu79aaAEL3xuJAoasWQTPxL9LeQZUBq7UJbFsGUY/q+0YgjoACWiWi np1C8h1gTR4QcUsIVdWnKKZex4KDyNSt8uhI0xTwQ0vPoX4p0whdnvkPqkF43Okp9OZr ompl1455mwSpNSpsSqgFHycN/DHqfmEui8kkImn0Iyj62a3jK3OTu0yIM2lg2JfW1Dw3 z9SVaBb51kXBxJvmcSoHtEcUOk13XhkMChfy+ygXRNPTNk2w9AbntcJFxWc09zHP9IFO Y3Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="iI/+5rrk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr25si4343731ejb.622.2020.07.16.22.52.23; Thu, 16 Jul 2020 22:52:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="iI/+5rrk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726180AbgGQFtP (ORCPT + 99 others); Fri, 17 Jul 2020 01:49:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725909AbgGQFtO (ORCPT ); Fri, 17 Jul 2020 01:49:14 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1F5FC061755; Thu, 16 Jul 2020 22:49:14 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id f23so9275872iof.6; Thu, 16 Jul 2020 22:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=jRkz34kzHFPJP/YTtWgR3dxC6hqrBlvuag30CVq0UoQ=; b=iI/+5rrkFI4dnPFFL/L9iw7HH0VcWjZdoGZaaLuBlmQLDJBqtgojCpPaS3yo+FxkxR QnsmJXspT3A6FdmPPRQi1kCxZI3LL4vXUOxU9+4MTQFH8ebFhEC6t9sSPUzTHryU2S9P wA4jU47UYjRo8kflfSBSCbrZn1YjpOsYYvNfxjL+8oSiE/dp8lXc4Ieoe3wd/ezx+p6X Y23br8KsxQoPQ8wl8rvcmJ3qSQ4E8lZjIC7NzYhOtXZR6nkY8+XsUhqu94AC0nRBLKkf wbjb8wv4lIfPYwBANTy2DmUI/ncQ0uDt5kIhcoBMNekF+PvbzBgB7lsW37mcntgP1ZDg fV/w== 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:reply-to :from:date:message-id:subject:to:cc; bh=jRkz34kzHFPJP/YTtWgR3dxC6hqrBlvuag30CVq0UoQ=; b=OoGVshz3SCffiY5Hctbq15Zb/iYxrkW8s7K29oHjaNdOZbrkJEoa201dg80eSdnt/K ydqAJJ3P5NHZQT5rI2D0qjaXEZ85Xy7qaAYTBWxa4iNpypvZN96hmvWEu15HWPr4BI6j EovtwB5Xy3F65cTEIZYEMhjnTrGlHDllJDeeI4WMHsVeiVwKG6YySzqiXL39hIzAsRpx lyz5fWgiWOr0KapdfDT6SBRAR9z/UEQ+b2fA5W1R5K91O6Z9zvBgwhV/0bxXAw1/sZw4 U41cyAoZL9kXiiaebu/Qj1i8lOJ2nOmX6Dfd4Xe54PL0sa4UO2MDSdQYjnO1m+YzQqYp Cg9w== X-Gm-Message-State: AOAM5337XQ2up79OdCBHIIYSwg1PIw9n7uLxZo69YZwMOPzpXohV+aXR z+lqU1B3V40s6qiDm2PhOOpVJIvb1FuNvvvxmXk= X-Received: by 2002:a5e:c91a:: with SMTP id z26mr8188202iol.70.1594964954143; Thu, 16 Jul 2020 22:49:14 -0700 (PDT) MIME-Version: 1.0 References: <20200717044427.68747-1-ebiggers@kernel.org> In-Reply-To: <20200717044427.68747-1-ebiggers@kernel.org> Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Fri, 17 Jul 2020 07:49:02 +0200 Message-ID: Subject: Re: [PATCH] tools/memory-model: document the "one-time init" pattern To: Eric Biggers Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, "Paul E . McKenney" , linux-fsdevel@vger.kernel.org, Akira Yokosawa , Alan Stern , Andrea Parri , Boqun Feng , Daniel Lustig , "Darrick J . Wong" , Dave Chinner , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , Peter Zijlstra , Will Deacon 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 Fri, Jul 17, 2020 at 6:48 AM Eric Biggers wrote: > > From: Eric Biggers ... > This is motivated by the discussion at > https://lkml.kernel.org/linux-fsdevel/20200713033330.205104-1-ebiggers@kernel.org/T/#u ... > +In where cases where taking the mutex in the "already initialized" case "In cases where..." (drop first "where") > +presents scalability concerns, the implementation can be optimized to > +check the 'inited' flag outside the mutex. Unfortunately, this > +optimization is often implemented incorrectly by using a plain load. > +That violates the memory model and may result in unpredictable behavior. - Sedat -