From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752222AbbIRJjY (ORCPT ); Fri, 18 Sep 2015 05:39:24 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:51736 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751613AbbIRJjX (ORCPT ); Fri, 18 Sep 2015 05:39:23 -0400 Date: Fri, 18 Sep 2015 11:33:55 +0200 From: Peter Zijlstra To: Will Deacon Cc: Dmitry Vyukov , Oleg Nesterov , "ebiederm@xmission.com" , Al Viro , Andrew Morton , Ingo Molnar , Paul McKenney , "mhocko@suse.cz" , LKML , "ktsan@googlegroups.com" , Kostya Serebryany , Andrey Konovalov , Alexander Potapenko , Hans Boehm Subject: Re: [PATCH] kernel: fix data race in put_pid Message-ID: <20150918093355.GK3604@twins.programming.kicks-ass.net> References: <1442496268-47803-1-git-send-email-dvyukov@google.com> <20150917160837.GA26050@redhat.com> <20150917174456.GA30178@redhat.com> <20150917180919.GA32116@redhat.com> <20150918085156.GS3816@twins.programming.kicks-ass.net> <20150918092820.GA27377@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150918092820.GA27377@arm.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 18, 2015 at 10:28:20AM +0100, Will Deacon wrote: > > #define atomic_read_ctrl(v) READ_ONCE_CTRL(&(v)->counter) > > Funnily enough, I had this exact same discussion off-list yesterday > afternoon, since I wrote some code relying on a ctrl dependency from > an atomic_read to an atomic_xchg_relaxed. > > So I guess I'm for the addition, but at the same time, could we make > atomic_read and atomic_set generic too? Nope (having just gone through them), there's a few archs that implement them in asm or even outright function calls (see blackfin, metag, powerpc, s390). That said, the patch I just send should see them all be at least {READ,WRITE}_ONCE, the asm one obviously qualify for that etc..