From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751673AbbJLJHG (ORCPT ); Mon, 12 Oct 2015 05:07:06 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:33322 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751067AbbJLJHA (ORCPT ); Mon, 12 Oct 2015 05:07:00 -0400 Date: Mon, 12 Oct 2015 17:06:36 +0800 From: Boqun Feng To: "Paul E. McKenney" Cc: Peter Zijlstra , Oleg Nesterov , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet , Michal Hocko , David Howells , Linus Torvalds , Will Deacon Subject: Re: [PATCH] Documentation: Remove misleading examples of the barriers in wake_*() Message-ID: <20151012090636.GF27351@fixme-laptop.cn.ibm.com> References: <1441674841-11498-1-git-send-email-boqun.feng@gmail.com> <20150909192822.GM4029@linux.vnet.ibm.com> <20150910021612.GC18494@fixme-laptop.cn.ibm.com> <20150910175557.GA20640@redhat.com> <20150917130125.GL3816@twins.programming.kicks-ass.net> <20150924132121.GA1814@fixme-laptop.cn.ibm.com> <20151006160650.GT3604@twins.programming.kicks-ass.net> <20151011152640.GC27351@fixme-laptop.cn.ibm.com> <20151012004044.GZ3910@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0QFb0wBpEddLcDHQ" Content-Disposition: inline In-Reply-To: <20151012004044.GZ3910@linux.vnet.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0QFb0wBpEddLcDHQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 11, 2015 at 05:40:44PM -0700, Paul E. McKenney wrote: > On Sun, Oct 11, 2015 at 11:26:40PM +0800, Boqun Feng wrote: > > On Tue, Oct 06, 2015 at 06:06:50PM +0200, Peter Zijlstra wrote: > > > On Thu, Sep 24, 2015 at 09:21:22PM +0800, Boqun Feng wrote: > > > > > Included in it are some of the details on this subject, because a= wakeup > > > > > has two prior states that are of importance, the tasks own prior = state > > > > > and the wakeup state, both should be considered in the 'program o= rder' > > > > > flow. > > > > >=20 > > > >=20 > > > > Great and very helpful ;-) > > > >=20 > > > > > So maybe we can reduce the description in memory-barriers to this > > > > > 'split' program order guarantee, where a woken task must observe = both > > > > > its own prior state and its wakee state. > > > > ^^^^^ > > > > I think you mean "waker" here, right? > > >=20 > > > Yes. > > >=20 > > > > And the waker is not necessarily the same task who set the @cond to > > > > true, right?=20 > > >=20 > > > It should be. > > >=20 > > > > If so, I feel like it's really hard to *use* this 'split' > > > > program order guarantee in other places than sleep/wakeup itself. C= ould > > > > you give an example? Thank you. > > >=20 > > > It was not meant to be used in any other scenario; the 'split' PO rea= lly > > > is part of the whole sleep/wakeup. It does not apply to anything else. > >=20 > > Got it. So at this point, I think it's better to remove the entire > > "Sleep and wake-up functions" section in memory-barriers.txt. Because > > this order guarantee is not for other users except sleep/wakeup. Any > > concern, Paul? >=20 > The concern I have with just removing it is that it is all too easy for > people to assume that they provide ordering. So we should at least have Understood. But, IMO, the position of this section is already misleading: (*) Implicit kernel memory barriers. - Locking functions. - Interrupt disabling functions. ->- Sleep and wake-up functions.<- - Miscellaneous functions. I read it as that sleep and wake-up functions provide some kernel memory barriers which we can use *externally*(outside sleep/wakeup themselves). So how about something like: (*) Barriers only for internal use - Sleep and wake-up functions. Regards, Boqun > a section stating clearly that ordering is not guaranteed without help > from locks, release-acquire, explicit memory barriers, etc. >=20 > Thanx, Paul >=20 --0QFb0wBpEddLcDHQ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJWG3gYAAoJEEl56MO1B/q4ObEH/34WAgwkREJSHF+rJW0L3isb c7HHur/ZpQHtDBas4Qk9ptdY+ZVJyKyw7rAv87Kg3waJoezkbY8d/SXUbSdb+NPX CLuVETpLiDqPHIeb8FOX7ovcAGwZuMrohjqhOnVIdboU4Mb96s5DOKN5TAzU1JUa +WsW7CWNAYIWH5op2az2nOChalK7HcWTYfnsvt2aeFtN7O6K2T8DDSMSzPi5IuAX jUqX6VGoUQDywJ2TZi+yASKN6O6KvNkVHSiwr5QlCpv1lqMxOT07Ag4O8iCrkFaF FLychLRT1kNsc3LlDtGjUkWTA4dcs1RhVE7KmdJ4iDIMc8eKJFdDOKpx8schXDY= =bV5v -----END PGP SIGNATURE----- --0QFb0wBpEddLcDHQ--