From: James Hogan <james.hogan@imgtec.com>
To: Maynard Johnson <maynardj@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
oprofile-list@lists.sf.net
Subject: Re: [PATCH v3 41/44] metag: OProfile
Date: Fri, 11 Jan 2013 09:43:04 +0000 [thread overview]
Message-ID: <50EFDEA8.2070505@imgtec.com> (raw)
In-Reply-To: <50EEF67F.4010703@us.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 3038 bytes --]
Hi Maynard,
On 10/01/13 17:12, Maynard Johnson wrote:
>> +static void kernel_backtrace_fp(unsigned long *fp, unsigned long *stack,
>> + unsigned int depth)
>> +{
...
>> +#ifdef CONFIG_KALLSYMS
>> + /* If we've reached TBIBoingVec then we're at an interrupt
>> + * entry point or a syscall entry point. The frame pointer
>> + * points to a pt_regs which can be used to continue tracing on
>> + * the other side of the boing.
>> + */
>> + if (tbi_boing_size && addr >= tbi_boing_addr &&
>> + addr < tbi_boing_addr + tbi_boing_size) {
>> + struct pt_regs *regs = (struct pt_regs *)fp;
>> + /* OProfile doesn't understand backtracing into
>> + * userland.
>> + */
> Since we can only get into kernel_backtrace_fp if user_mode(regs) == 0, why the if-statement?
Because this regs comes from the stack, so it could be a userland
context from the point of entry into the kernel.
>> + if (!user_mode(regs) && --depth) {
>> + oprofile_add_trace(regs->ctx.CurrPC);
>> + metag_backtrace(regs, depth);
>> + }
...
>> +
>> +/*
>> + * Unfortunately we don't have a native exception or interrupt for counter
>> + * overflow.
>> + *
>> + * OProfile on the other hand likes to have samples taken periodically, so
>> + * for now we just piggyback the timer interrupt to get the expected
>> + * behavior.
>> + */
>> +
> I presume an oprofile userspace patch is forthcoming.
Yes, unfortunately it's not included in our public buildroot tree yet,
but there's a slightly older patch (semantically identical) available in
the Pure ONE Flow release from http://www.pure.com/gpl/ in
metag-buildroot2/package/oprofile/oprofile-0.9.4-003-metag.patch and
also attached to this email.
It could probably do with some updating tbh though...
> As you probably know already, each event definition in oprofile
userspace requires a minimum 'count' value, which is the number of
events to occur before taking a sample. With your userspace patch, you
should try to set min count values such that the fastest arrival rate
for the given event can be caught within (or near) one timer tick.
Yes, it appears the values are all left at 1000 in the patch which is
likely suboptimal.
>> +static int meta_timer_notify(struct pt_regs *regs)
>> +{
>> + int i;
>> + u32 val, total_val, sub_val;
>> + u32 enabled_threads;
>> +
>> + for (i = 0; i < NR_CNTRS; i++) {
>> + if (!ctr[i].enabled)
>> + continue;
>> +
>> + /* Disable performance monitoring. */
>> + enabled_threads = meta_read_counter(i);
>> + meta_write_counter(i, 0);
>> +
>> + sub_val = total_val = val = enabled_threads & PERF_COUNT_BITS;
>> +
>> + if (val >= ctr[i].count) {
>> + while (val > ctr[i].count) {
>> + oprofile_add_sample(regs, i);
> I don't see a good reason for adding multiple samples using the same regs values. As a matter of fact, it could really skew results under certain conditions.
I suspect the reasoning was to give more weight if the count is higher.
If that's not the usual way I'll change it.
Thanks for giving it a look.
Cheers
James
[-- Attachment #2: oprofile-0.9.4-003-metag.patch --]
[-- Type: text/x-patch, Size: 4544 bytes --]
diff -ruNP oprofile-0.9.4.orig/daemon/opd_cookie.c oprofile-0.9.4/daemon/opd_cookie.c
--- oprofile-0.9.4.orig/daemon/opd_cookie.c 2008-05-21 13:30:15.000000000 +0100
+++ oprofile-0.9.4/daemon/opd_cookie.c 2009-12-01 17:10:37.000000000 +0000
@@ -64,7 +64,8 @@
|| (defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32) \
&& defined(__MIPSEB__)) \
|| (defined(__arm__) && defined(__ARM_EABI__) \
- && defined(__ARMEB__))
+ && defined(__ARMEB__)) \
+ || (defined(__metag__))
static inline int lookup_dcookie(cookie_t cookie, char * buf, size_t size)
{
return syscall(__NR_lookup_dcookie, (unsigned long)(cookie >> 32),
diff -ruNP oprofile-0.9.4.orig/events/metag/events oprofile-0.9.4/events/metag/events
--- oprofile-0.9.4.orig/events/metag/events 1970-01-01 01:00:00.000000000 +0100
+++ oprofile-0.9.4/events/metag/events 2009-12-01 17:09:35.000000000 +0000
@@ -0,0 +1,12 @@
+# metag events
+#
+event:0x00 counters:0,1 um:threads minimum:1000 name:CYCLES_SUPERTHREADS : cycles with superthreads
+event:0x01 counters:0,1 um:threads minimum:1000 name:DCACHE_MISS : data cache misses
+event:0x02 counters:0,1 um:threads minimum:1000 name:CYCLES_WITH_REWINDS : cycles with rewinds and superthreads (for all threads)
+event:0x03 counters:0,1 um:threads minimum:1000 name:CYCLES_SINCE_START : cycles since execution start (for all threads)
+event:0x08 counters:0,1 um:threads minimum:1000 name:DCACHE_HITS : data cache hits
+event:0x09 counters:0,1 um:threads minimum:1000 name:ICACHE_HITS : instruction cache hits
+event:0x0a counters:0,1 um:threads minimum:1000 name:ICACHE_MISS : instruction cache misses
+event:0x0b counters:0,1 um:threads minimum:1000 name:CYCLES_DCACHE_STALLED : cycles data cache stalled at MMU
+event:0x0c counters:0,1 um:threads minimum:1000 name:CYCLES_ICACHE_STALLED : cycles instruction cache stalled at MMU
+event:0x0f counters:0,1 um:threads minimum:1000 name:EXTERNAL_EVENTS : external events selected by crossbar performance channel 0 register
diff -ruNP oprofile-0.9.4.orig/events/metag/unit_masks oprofile-0.9.4/events/metag/unit_masks
--- oprofile-0.9.4.orig/events/metag/unit_masks 1970-01-01 01:00:00.000000000 +0100
+++ oprofile-0.9.4/events/metag/unit_masks 2009-12-01 17:09:35.000000000 +0000
@@ -0,0 +1,10 @@
+# metag performance counters possible unit masks
+#
+# These are used to turn on performance counting for
+# particular threads.
+name:threads type:bitmask default:0x0f
+ 0x01 Monitor Thread 1
+ 0x02 Monitor Thread 2
+ 0x03 Monitor Thread 3
+ 0x04 Monitor Thread 4
+ 0x0f Monitor all threads
diff -ruNP oprofile-0.9.4.orig/libop/op_cpu_type.c oprofile-0.9.4/libop/op_cpu_type.c
--- oprofile-0.9.4.orig/libop/op_cpu_type.c 2008-02-22 16:17:48.000000000 +0000
+++ oprofile-0.9.4/libop/op_cpu_type.c 2009-12-01 17:09:35.000000000 +0000
@@ -74,6 +74,7 @@
{ "ppc64 POWER5++", "ppc64/power5++", CPU_PPC64_POWER5pp, 6 },
{ "e300", "ppc/e300", CPU_PPC_E300, 4 },
{ "AVR32", "avr32", CPU_AVR32, 3 },
+ { "metag", "metag", CPU_META, 2 },
};
static size_t const nr_cpu_descrs = sizeof(cpu_descrs) / sizeof(struct cpu_descr);
diff -ruNP oprofile-0.9.4.orig/libop/op_cpu_type.h oprofile-0.9.4/libop/op_cpu_type.h
--- oprofile-0.9.4.orig/libop/op_cpu_type.h 2008-02-22 16:17:48.000000000 +0000
+++ oprofile-0.9.4/libop/op_cpu_type.h 2009-12-01 17:09:35.000000000 +0000
@@ -72,6 +72,7 @@
CPU_PPC64_POWER5pp, /**< ppc64 Power5++ family */
CPU_PPC_E300, /**< e300 */
CPU_AVR32, /**< AVR32 */
+ CPU_META, /**< META */
MAX_CPU_TYPE
} op_cpu;
diff -ruNP oprofile-0.9.4.orig/libop/op_events.c oprofile-0.9.4/libop/op_events.c
--- oprofile-0.9.4.orig/libop/op_events.c 2008-02-22 16:17:48.000000000 +0000
+++ oprofile-0.9.4/libop/op_events.c 2009-12-01 17:09:35.000000000 +0000
@@ -852,6 +852,11 @@
descr->name = "CPU_CLK";
break;
+ case CPU_META:
+ descr->name = "CYCLES_SINCE_START";
+ descr->um = 0x01; // Monitor thread 1 perf
+ break;
+
// don't use default, if someone add a cpu he wants a compiler
// warning if he forgets to handle it here.
case CPU_TIMER_INT:
diff -ruNP oprofile-0.9.4.orig/libutil/op_cpufreq.c oprofile-0.9.4/libutil/op_cpufreq.c
--- oprofile-0.9.4.orig/libutil/op_cpufreq.c 2003-11-04 04:26:45.000000000 +0000
+++ oprofile-0.9.4/libutil/op_cpufreq.c 2009-12-02 10:19:20.000000000 +0000
@@ -51,6 +51,9 @@
fval = uval / 1E6;
break;
}
+ /* metag */
+ if (sscanf(line, "Clocking: %lfMHz", &fval) == 1)
+ break;
/* s390 doesn't provide cpu freq, checked up to 2.6-test4 */
free(line);
next prev parent reply other threads:[~2013-01-11 9:43 UTC|newest]
Thread overview: 130+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-10 15:30 [PATCH v3 00/44] Meta Linux Kernel Port James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 01/44] asm-generic/io.h: check CONFIG_VIRT_TO_BUS James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 02/44] asm-generic/unistd.h: handle symbol prefixes in cond_syscall James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 03/44] Revert some of "binfmt_elf: cleanups" James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 04/44] Add HAVE_64BIT_ALIGNED_ACCESS James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 05/44] trace/ring_buffer: handle 64bit aligned structs James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 06/44] metag: Add MAINTAINERS entry James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 07/44] metag: Headers for core arch constants James Hogan
2013-01-10 15:30 ` [PATCH v3 08/44] metag: Header for core memory mapped registers James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 09/44] metag: Boot James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 10/44] metag: TBX header James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 11/44] metag: TBX source James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 12/44] metag: Cache/TLB handling James Hogan
2013-01-10 15:30 ` [PATCH v3 13/44] metag: Memory management James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 14/44] metag: Memory handling James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 15/44] metag: Huge TLB James Hogan
2013-01-10 16:57 ` Dave Hansen
2013-01-11 9:58 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 16/44] metag: Highmem support James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 17/44] metag: TCM support James Hogan
2013-01-10 15:30 ` [PATCH v3 18/44] metag: Signal handling James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 19/44] metag: Device tree James Hogan
2013-02-06 13:06 ` Vineet Gupta
2013-02-06 13:47 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 20/44] metag: ptrace James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 21/44] metag: Time keeping James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-26 0:03 ` Arnd Bergmann
2013-01-28 12:59 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 22/44] metag: Traps James Hogan
2013-01-10 15:30 ` [PATCH v3 23/44] metag: IRQ handling James Hogan
[not found] ` <1357831872-29451-1-git-send-email-james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2013-01-10 15:30 ` [PATCH v3 24/44] metag: Internal and external irqchips James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 25/44] metag: System Calls James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 26/44] metag: Scheduling/Process management James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 27/44] metag: Module support James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 28/44] metag: Atomics, locks and bitops James Hogan
2013-01-10 15:30 ` [PATCH v3 29/44] metag: Basic documentation James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 30/44] metag: SMP support James Hogan
2013-01-10 15:30 ` James Hogan
2013-01-10 15:30 ` [PATCH v3 31/44] metag: DMA James Hogan
2013-01-10 15:31 ` [PATCH v3 32/44] metag: Optimised library functions James Hogan
2013-01-10 15:31 ` [PATCH v3 33/44] metag: Stack unwinding James Hogan
2013-01-10 15:31 ` James Hogan
2013-01-10 15:31 ` [PATCH v3 34/44] metag: Various other headers James Hogan
2013-01-10 15:31 ` [PATCH v3 35/44] mm: define VM_GROWSUP for CONFIG_METAG James Hogan
2013-01-10 15:31 ` James Hogan
2013-01-10 15:31 ` [PATCH v3 36/44] Kconfig.debug: add METAG to dependency lists James Hogan
2013-01-10 15:31 ` James Hogan
2013-01-10 15:31 ` [PATCH v3 37/44] metag: Build infrastructure James Hogan
2013-01-10 15:31 ` James Hogan
2013-01-10 15:31 ` [PATCH v3 38/44] metag: Perf James Hogan
2013-01-10 15:31 ` [PATCH v3 39/44] metag: ftrace support James Hogan
2013-01-10 15:31 ` James Hogan
2013-01-10 15:59 ` Steven Rostedt
2013-01-10 16:00 ` Steven Rostedt
2013-01-10 16:13 ` James Hogan
2013-01-10 15:31 ` [PATCH v3 40/44] scripts/checkstack.pl: Add metag support James Hogan
2013-01-10 15:31 ` James Hogan
2013-01-10 15:31 ` [PATCH v3 41/44] metag: OProfile James Hogan
2013-01-10 15:31 ` James Hogan
2013-01-10 17:12 ` Maynard Johnson
2013-01-11 9:43 ` James Hogan [this message]
2013-01-10 15:31 ` [PATCH v3 42/44] metag: Add JTAG Debug Adapter (DA) support James Hogan
2013-01-10 15:31 ` James Hogan
2013-01-10 15:31 ` [PATCH v3 43/44] tty/metag_da: Add metag DA TTY driver James Hogan
2013-01-10 15:31 ` James Hogan
2013-01-10 16:03 ` Jiri Slaby
2013-01-11 10:50 ` James Hogan
2013-01-14 10:15 ` Jiri Slaby
2013-01-14 10:15 ` Jiri Slaby
2013-01-14 10:54 ` James Hogan
2013-01-25 11:36 ` James Hogan
2013-01-30 5:14 ` Greg Kroah-Hartman
2013-01-30 5:14 ` Greg Kroah-Hartman
2013-01-30 10:43 ` James Hogan
2013-01-10 15:31 ` [PATCH v3 44/44] fs: imgdafs: Add IMG DAFS filesystem for metag James Hogan
2013-01-10 15:31 ` James Hogan
2013-01-28 13:28 ` James Hogan
2013-01-10 23:34 ` [PATCH v3 00/44] Meta Linux Kernel Port Stephen Rothwell
2013-01-10 23:34 ` Stephen Rothwell
2013-01-11 9:15 ` James Hogan
2013-01-11 13:03 ` Stephen Rothwell
2013-01-11 13:16 ` James Hogan
2013-01-11 13:16 ` James Hogan
2013-01-11 15:02 ` James Hogan
2013-01-11 15:02 ` James Hogan
2013-01-12 1:09 ` Stephen Rothwell
2013-01-12 1:09 ` Stephen Rothwell
2013-01-12 9:55 ` James Hogan
2013-01-12 14:56 ` Stephen Rothwell
2013-01-19 5:55 ` Al Viro
2013-01-22 11:35 ` James Hogan
2013-01-22 11:35 ` James Hogan
2013-01-25 17:04 ` James Hogan
2013-01-26 0:25 ` Arnd Bergmann
2013-01-26 21:53 ` James Hogan
2013-01-28 7:10 ` Vineet Gupta
2013-01-28 11:08 ` James Hogan
2013-01-29 12:45 ` ARC Port for linux-next (was Re: [PATCH v3 00/44] Meta Linux Kernel Port) Vineet Gupta
2013-01-29 20:44 ` [PATCH v3 00/44] Meta Linux Kernel Port Stephen Rothwell
2013-01-29 20:44 ` Stephen Rothwell
2013-01-29 20:50 ` Stephen Rothwell
2013-01-29 20:50 ` Stephen Rothwell
2013-02-01 8:18 ` linux-net for ARC port Vineet Gupta
2013-02-01 12:05 ` Stephen Rothwell
2013-02-01 12:33 ` Geert Uytterhoeven
2013-02-01 12:59 ` Stephen Rothwell
2013-02-05 13:54 ` [PATCH v3 00/44] Meta Linux Kernel Port Vineet Gupta
2013-02-05 23:40 ` rkuo
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=50EFDEA8.2070505@imgtec.com \
--to=james.hogan@imgtec.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maynardj@us.ibm.com \
--cc=oprofile-list@lists.sf.net \
/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;
as well as URLs for NNTP newsgroup(s).