From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754151Ab3J2Kfm (ORCPT ); Tue, 29 Oct 2013 06:35:42 -0400 Received: from merlin.infradead.org ([205.233.59.134]:44914 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752331Ab3J2Kfk (ORCPT ); Tue, 29 Oct 2013 06:35:40 -0400 Date: Tue, 29 Oct 2013 11:35:26 +0100 From: Peter Zijlstra To: Victor Kaplansky Cc: Oleg Nesterov , Anton Blanchard , Benjamin Herrenschmidt , Frederic Weisbecker , LKML , Linux PPC dev , Mathieu Desnoyers , Michael Ellerman , Michael Neuling , "Paul E. McKenney" Subject: Re: perf events ring buffer memory barrier on powerpc Message-ID: <20131029103526.GO2490@laptop.programming.kicks-ass.net> References: <20131023141948.GB3566@localhost.localdomain> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131029103057.GN2490@laptop.programming.kicks-ass.net> 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 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 :/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from merlin.infradead.org (unknown [IPv6:2001:4978:20e::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9AA602C0342 for ; Tue, 29 Oct 2013 21:35:39 +1100 (EST) Date: Tue, 29 Oct 2013 11:35:26 +0100 From: Peter Zijlstra To: Victor Kaplansky Subject: Re: perf events ring buffer memory barrier on powerpc Message-ID: <20131029103526.GO2490@laptop.programming.kicks-ass.net> References: <20131023141948.GB3566@localhost.localdomain> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20131029103057.GN2490@laptop.programming.kicks-ass.net> Cc: Michael Neuling , Mathieu Desnoyers , Oleg Nesterov , LKML , Linux PPC dev , Anton Blanchard , Frederic Weisbecker , "Paul E. McKenney" List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 :/