Re: [PATCH v1 1/2] perf auxtrace: Change to use SMP memory barriers
From: Peter Zijlstra
Date: Thu May 27 2021 - 05:46:25 EST
On Thu, May 27, 2021 at 11:25:40AM +0300, Adrian Hunter wrote:
> On 27/05/21 11:11 am, Peter Zijlstra wrote:
> > On Thu, May 27, 2021 at 10:54:56AM +0300, Adrian Hunter wrote:
> >> On 19/05/21 5:03 pm, Leo Yan wrote:
> >>> The AUX ring buffer's head and tail can be accessed from multiple CPUs
> >>> on SMP system, so changes to use SMP memory barriers to replace the
> >>> uniprocessor barriers.
> >> I don't think user space should attempt to be SMP-aware.
> > Uhh, what? It pretty much has to. Since userspace cannot assume UP, it
> > must assume SMP.
> Yeah that is what I meant, but consequently we generally shouldn't be
> using functions called smp_<anything>
Of course we should; they're the SMP class of barriers.
> > So ACK on the patch, it's sane and an optimization for both x86 and ARM.
> > Just the Changelog needs work.
> If all we want is a compiler barrier, then shouldn't that be what we use?
> i.e. barrier()
No, we want the SMP barriers, smp_rmb() happens to be a compiler barrier
on x86, but it will be dmb(ishld) on Aarrgh64 for example.