Skip to content

ARC Perf implementation incomplete, disallowing to profile applications #175

@jzbydniewski

Description

@jzbydniewski

I'm trying to run "perf record" to profile an application built with "-g -fno-omit-frame-pointer" flags. This works as expected with ARM target (tested on Rasbperry Pi) but when using the ARC platform (HS58, toolchain 2023.09) I don't get names of functions inside the application. I only get names of kernel symbols. As a result, it's not possible to profile application with perf.

Test app:
app.zip

Compiled with
gcc app.c -g -Og -fno-omit-frame-pointer -o app

How I run the perf:

app 1000000 &
perf record -a -g -- sleep 5

After that, I'm getting the report with
perf report > report.txt

Result with ARC HS58:

    11.14%     0.00%  app              app                  [.] 0x40000612
            |
            ---0x40000612

    11.14%    11.14%  app              app                  [.] 0x00000612
            |
            ---0x40000612

    11.10%     0.00%  app              app                  [.] 0x40000616
            |
            ---0x40000616

    11.10%    11.10%  app              app                  [.] 0x00000616
            |
            ---0x40000616

    11.04%     0.00%  app              app                  [.] 0x40000618
            |
            ---0x40000618

    11.04%    11.04%  app              app                  [.] 0x00000618
            |
            ---0x40000618

Result with Rasbperry Pi

    99.82%     0.00%  app              app                                   [.] bar1
            |
             --99.82%--bar1
                       foo1

    99.82%     0.00%  app              libc.so.6                             [.] __libc_start_main@@GLIBC_2.34
            |
            ---__libc_start_main@@GLIBC_2.34
               __libc_start_call_main
               main
               bar1
               |
                --99.82%--foo1

    99.82%     0.00%  app              libc.so.6                             [.] __libc_start_call_main
            |
            ---__libc_start_call_main
               main
               bar1
               |
                --99.82%--foo1

    99.82%     0.00%  app              app                                   [.] main
            |
            ---main
               bar1
               |
                --99.82%--foo1

    99.82%    99.82%  app              app                                   [.] foo1
            |
            ---_start
               __libc_start_main@@GLIBC_2.34
               __libc_start_call_main
               main
               bar1
               foo1

From what I see the https://github.com/foss-for-synopsys-dwc-arc-processors/linux/blob/arc64/arch/arc/kernel/perf_event.c looks like is missing features, for example:

void perf_callchain_user(struct perf_callchain_entry_ctx *entry,
			 struct pt_regs *regs)
{
	/*
	 * User stack can't be unwound trivially with kernel dwarf unwinder
	 * So for now just record the user PC
	 */
	perf_callchain_store(entry, instruction_pointer(regs));
}

Is this expected ? Can you add the missing functionality ?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions