From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753833AbbGXP3N (ORCPT ); Fri, 24 Jul 2015 11:29:13 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:40398 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751109AbbGXP3K (ORCPT ); Fri, 24 Jul 2015 11:29:10 -0400 X-Helo: d03dlp02.boulder.ibm.com X-MailFrom: paulmck@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org Date: Fri, 24 Jul 2015 08:29:05 -0700 From: "Paul E. McKenney" To: peterz@infradead.org Cc: will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, paulus@samba.org, rostedt@goodmis.org Subject: perf_mmap__write_tail() and control dependencies Message-ID: <20150724152905.GA4766@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15072415-8236-0000-0000-00000D73646E Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Peter, The ring-buffer code uses control dependencies, and the shiny new READ_ONCE_CTRL() is now in mainline. I was idly curious about whether the write side could use smp_store_release(), and I found this: static inline void perf_mmap__write_tail(struct perf_mmap *md, u64 tail) { struct perf_event_mmap_page *pc = md->base; /* * ensure all reads are done before we write the tail out. */ mb(); pc->data_tail = tail; } I see mb() rather than smp_mb(). Did I find the correct code for the write side? If so, why mb() rather than smp_mb()? To serialize against MMIO interactions with hardware counters or some such? Thanx, Paul