public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jamie Iles <jamie.iles@picochip.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Jamie Iles <jamie.iles@picochip.com>,
	linux-kernel@vger.kernel.org,
	Russell King <linux@arm.linux.org.uk>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH 1/2] perf tools: allow building for ARM
Date: Fri, 11 Dec 2009 11:01:11 +0000	[thread overview]
Message-ID: <20091211110111.GD4164@wear.picochip.com> (raw)
In-Reply-To: <20091211103848.GA9947@elte.hu>

On Fri, Dec 11, 2009 at 11:38:48AM +0100, Ingo Molnar wrote:
> 
> * Jamie Iles <jamie.iles@picochip.com> wrote:
> 
> > On Fri, Dec 11, 2009 at 11:23:16AM +0100, Ingo Molnar wrote:
> > > cpu_relax() looks fine, but rmb() seems not to match the one that can be 
> > > found in arch/arm/:
> > > 
> > > arch/arm/include/asm/system.h:#define rmb()		dmb()
> > > arch/arm/include/asm/system.h:#define rmb()	do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
> > > arch/arm/include/asm/system.h:#define smp_rmb()	rmb()
> > > 
> > > arch/arm/include/asm/system.h:#define dmb() __asm__ __volatile__ ("dmb" : : : "memory")
> > > arch/arm/include/asm/system.h:#define dmb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" \
> > > arch/arm/include/asm/system.h:#define dmb() __asm__ __volatile__ ("" : : : "memory")
> > > arch/arm/include/asm/system.h:#define dmb() __asm__ __volatile__ ("" : : : "memory")
> >
> > The implementation of the barriers depend on the CPU arch revision 
> > which is defined in the kernel config. As the perf tools don't use the 
> > kernel config, we don't know here what arch revision we're building 
> > for. Perhaps we need a LINUX_ARM_ARCH parameter when building for ARM 
> > so we can pick the correct one.
> 
> rmb() is used in two places in perf:
> 
>  tools/perf/builtin-record.c:    rmb();
>  tools/perf/builtin-top.c:       rmb();
> 
> to interact with the shared kernel/user ring-buffer. Getting a barrier 
> wrong there may cause hickups in recording.
> 
> Could you tell me a bit more about this ARM instruction - is the 'DMB' 
> instruction used on all SMP ARM cores? Can it be used unconditionally, 
> or is the instruction undefined on certain versions? To get the ball 
> rolling we could use it unconditionally in the initial patch, but this 
> needs to be solved i suspect.
There are a few cases we need to deal with:
	- v7 SMP: DMB instruction
	- v6 SMP: MCR coprocessor instruction
	- v5 and earlier no instructions for barriers.

Looking at the TRM for a v7 core (cortex A9) the MCR instruction that v6 uses
is deprecated but still present. I suspect we could use this to cover the v6
and v7 cores but we wouldn't be able to do soft perf events on v5 or earlier
(which don't have hardware counters).

Jamie

  reply	other threads:[~2009-12-11 11:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-11  9:20 [PATCH 1/2] perf tools: allow building for ARM Jamie Iles
2009-12-11  9:21 ` [PATCH 2/2] perf tools: allow cross compiling Jamie Iles
2009-12-11 10:27   ` [tip:perf/urgent] perf tools: Allow " tip-bot for Jamie Iles
2009-12-11 12:20   ` [PATCH] perf tools: allow building for ARM (patch v2) Jamie Iles
2009-12-11 12:54     ` [tip:perf/urgent] perf tools: Allow building for ARM tip-bot for Jamie Iles
2009-12-11 13:04       ` Jamie Iles
2009-12-11 13:26         ` Ingo Molnar
2009-12-11 10:23 ` [PATCH 1/2] perf tools: allow " Ingo Molnar
2009-12-11 10:30   ` Jamie Iles
2009-12-11 10:38     ` Ingo Molnar
2009-12-11 11:01       ` Jamie Iles [this message]
2009-12-11 11:26         ` Mikael Pettersson
2009-12-11 21:22           ` Russell King - ARM Linux
     [not found]     ` <000101ca7a50$b3e2ad70$1ba80850$@deacon@arm.com>
2009-12-11 11:02       ` Ingo Molnar
2009-12-11 11:08         ` Pekka Enberg
2009-12-11 10:38   ` David Miller
2009-12-11 10:41     ` Ingo Molnar
2009-12-11 11:48       ` Jamie Iles
2009-12-11 12:48         ` Ingo Molnar
2009-12-11 21:19     ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091211110111.GD4164@wear.picochip.com \
    --to=jamie.iles@picochip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox