From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by ozlabs.org (Postfix) with ESMTP id 552562C0336 for ; Wed, 30 Oct 2013 07:15:20 +1100 (EST) Date: Tue, 29 Oct 2013 21:15:46 +0100 From: Oleg Nesterov To: Peter Zijlstra Subject: Re: perf events ring buffer memory barrier on powerpc Message-ID: <20131029201546.GA4932@redhat.com> References: <20131025173749.GG19466@laptop.lan> <20131028132634.GO19466@laptop.lan> <20131028163418.GD4126@linux.vnet.ibm.com> <20131028201735.GA15629@redhat.com> <20131029102131.GA16117@laptop.programming.kicks-ass.net> <20131029103057.GN2490@laptop.programming.kicks-ass.net> <20131029103526.GO2490@laptop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20131029103526.GO2490@laptop.programming.kicks-ass.net> Cc: Michael Neuling , Mathieu Desnoyers , LKML , Linux PPC dev , Anton Blanchard , Frederic Weisbecker , Victor Kaplansky , "Paul E. McKenney" List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 10/29, Peter Zijlstra wrote: > > On Tue, Oct 29, 2013 at 11:30:57AM +0100, Peter Zijlstra wrote: > > @@ -154,9 +175,11 @@ int perf_output_begin(struct perf_output > > * Userspace could choose to issue a mb() before updating the > > * tail pointer. So that all reads will be completed before the > > * write is issued. > > + * > > + * See perf_output_put_handle(). > > */ > > tail = ACCESS_ONCE(rb->user_page->data_tail); > > - smp_rmb(); > > + smp_mb(); > > offset = head = local_read(&rb->head); > > head += size; > > if (unlikely(!perf_output_space(rb, tail, offset, head))) > > That said; it would be very nice to be able to remove this barrier. This > is in every event write path :/ Yes.. And I'm afraid very much that I simply confused you. Perhaps Victor is right and we do not need this mb(). So I am waiting for the end of this story too. And btw I do not understand why we need it (or smp_rmb) right after ACCESS_ONCE(data_tail). Oleg.