Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3867656imm; Mon, 25 Jun 2018 06:03:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKlSVtxatu9C8xm/16Iav0t4Ejaovv35WWPF3UUo2FaRjtDFItatPB/7E1njoWrONSfYCIi X-Received: by 2002:a63:7c03:: with SMTP id x3-v6mr10905861pgc.412.1529931781162; Mon, 25 Jun 2018 06:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529931781; cv=none; d=google.com; s=arc-20160816; b=RUM0NNeFbEJI2GpbljyMnrfYnMP1cXU7rkTTCnh0FLcxwtv9dB/Zlv15b2jxIKAt8x LZlLcaWMA5+M5eUpiW78MgDqr/0FepU9hfsaie7PaezXsXJCGUT2Huk2AcGY2d0MXKoj ojg4FXb8EbBIrso8hc1qOupwAv3Q7V8IxEzc2ooQCd+RyfId6RAAmw33EL/zRLRAK+SY AphFqdN+MTgtWZYpoQ42E+fktcGpUvqffMGBP8KemwjRIrhIuOdowXWQAPJyz9r7Ylw3 0KCyPopbyABbvIKHLvIs3OVlP2P9m/DEhDykihdBJ2UD09LuGCuede6T2Of+RfJ7hA97 zY3w== 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=vZX8jYOWO3a90wCemC9ahigb6/SmMgNRcEPmtmnRURA=; b=OS4u7h2Tghwit/z2Y0cEX9haIltcaW+r056oUlssU92L2x6rY5Dx0ppypxeU/HyJCx vQYHr3GUZ0oyG1dxnoxee/rT/vFyPZdfx/ji6eKoohSBcTw3NcbLwY8Bm7mHPEt0nDwq WxaV5X4Pky91P6r2KnCAeCxuR58YTe+2Kl3tI+z6EWKtzozwR9Bv83InVw+PtkuIfE7K BTkoVPxG7cHKYeKgdTbfkJnfzU9uzwYMqd6DqQLbon+x/moESaNDEBpH9o8pZ2KiyFOh dp3rW5f5jNtLOq5CWvEs/AGAr94Rda+jHrToUDEd9qM7F95q8jCj90LN1Z9AmTXYeU2i sgVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BrIjbdD0; 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 t8-v6si580328pfi.221.2018.06.25.06.02.45; Mon, 25 Jun 2018 06:03:01 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BrIjbdD0; 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 S1755487AbeFYNBP (ORCPT + 99 others); Mon, 25 Jun 2018 09:01:15 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:51768 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755411AbeFYNBN (ORCPT ); Mon, 25 Jun 2018 09:01:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=vZX8jYOWO3a90wCemC9ahigb6/SmMgNRcEPmtmnRURA=; b=BrIjbdD0n6DazM0FFELolQaJK UaThofzbBDfyhs8G4Y2GcOy0M6UZshi2mResO8ysfJRYnnXHhtJ2uGSROhq0K4irQtyqGg041BH6A ovobXxSSva84nB2yTNmkANVzHlExmg/gYUsY2bW2Nn7lpl7v6CqvaacYcl1e3tq2Cr+I6xdbp5CMD JTScTXz/JZBnOH1IBgY5bIpz2Xe8HLtWJYAbSo87GN9BoYSQCXsu3V+G6rxHOB6vYksjJwsEOStMq MRs0gUWb9j4IBN0VlggU6iY+oKPXeT90eIMI6rKnBLKh2PwRLVFQJQmFH+54NbWUcSmPjxOQL1Ago VTtMwMEgg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fXR6z-0000CJ-6F; Mon, 25 Jun 2018 13:00:53 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A72F92029F1DB; Mon, 25 Jun 2018 15:00:51 +0200 (CEST) Date: Mon, 25 Jun 2018 15:00:51 +0200 From: Peter Zijlstra To: Andrea Parri Cc: David Howells , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Alan Stern , Will Deacon , Boqun Feng , Nicholas Piggin , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Akira Yokosawa , Daniel Lustig , Jonathan Corbet , Ingo Molnar , Randy Dunlap Subject: Re: [PATCH] doc: Update wake_up() & co. memory-barrier guarantees Message-ID: <20180625130051.GA2494@hirez.programming.kicks-ass.net> References: <20180625095031.GX2494@hirez.programming.kicks-ass.net> <1529918258-7295-1-git-send-email-andrea.parri@amarulasolutions.com> <2779.1529928765@warthog.procyon.org.uk> <20180625122850.GA14561@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180625122850.GA14561@andrea> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 25, 2018 at 02:28:50PM +0200, Andrea Parri wrote: > On Mon, Jun 25, 2018 at 01:12:45PM +0100, David Howells wrote: > > Peter Zijlstra wrote: > > > > > So yes, I suppose we're entirely suck with the full memory barrier > > > semantics like that. But I still find it easier to think of it like a > > > RELEASE that pairs with the ACQUIRE of waking up, such that the task > > > is guaranteed to observe it's own wake condition. > > > > > > And maybe that is the thing I'm missing here. These comments only state > > > that it does in fact imply a full memory barrier, but do not explain > > > why, should it? > > > > I think because RELEASE and ACQUIRE concepts didn't really exist in Linux at > > the time I wrote the doc, so the choices were read/readdep, write or full. > > > > Since this document defines the *minimum* you can expect rather than what the > > kernel actually gives you, I think it probably makes sense to switch to > > RELEASE and ACQUIRE here. > > RELEASE and ACQUIRE are not enough in SB. Can you elaborate? I prefer RELEASE vs wait-condition and treat task->state as an internal matter. Also note how the set_current_task() comment is fairly vague on what exact barriers are used. It just states 'sufficient'. Maybe I should just give up and accept smp_mb(), but strictly speaking that is overkill, but it is the only sufficient barrier we currently have.