mbox series

[v2,0/3] Add some perf support for mips

Message ID 1612409724-3516-1-git-send-email-yangtiezhu@loongson.cn (mailing list archive)
Headers show
Series Add some perf support for mips | expand

Message

Tiezhu Yang Feb. 4, 2021, 3:35 a.m. UTC
v2: add R26 and R27 to the enum perf_event_mips_regs in patch #1

Tiezhu Yang (3):
  MIPS: kernel: Support extracting off-line stack traces from user-space
    with perf
  perf tools: Support mips unwinding and dwarf-regs
  perf tools: Generate mips syscalls_n64.c syscall table

 arch/mips/Kconfig                                  |   2 +
 arch/mips/include/uapi/asm/perf_regs.h             |  40 +++
 arch/mips/kernel/Makefile                          |   2 +-
 arch/mips/kernel/perf_regs.c                       |  68 ++++
 tools/perf/Makefile.config                         |   9 +-
 tools/perf/arch/mips/Makefile                      |  22 ++
 tools/perf/arch/mips/entry/syscalls/mksyscalltbl   |  32 ++
 .../perf/arch/mips/entry/syscalls/syscall_n64.tbl  | 358 +++++++++++++++++++++
 tools/perf/arch/mips/include/dwarf-regs-table.h    |  31 ++
 tools/perf/arch/mips/include/perf_regs.h           |  84 +++++
 tools/perf/arch/mips/util/Build                    |   3 +
 tools/perf/arch/mips/util/dwarf-regs.c             |  38 +++
 tools/perf/arch/mips/util/perf_regs.c              |   6 +
 tools/perf/arch/mips/util/unwind-libunwind.c       |  22 ++
 tools/perf/check-headers.sh                        |   1 +
 tools/perf/util/dwarf-regs.c                       |   3 +
 tools/perf/util/syscalltbl.c                       |   4 +
 17 files changed, 723 insertions(+), 2 deletions(-)
 create mode 100644 arch/mips/include/uapi/asm/perf_regs.h
 create mode 100644 arch/mips/kernel/perf_regs.c
 create mode 100644 tools/perf/arch/mips/Makefile
 create mode 100644 tools/perf/arch/mips/entry/syscalls/mksyscalltbl
 create mode 100644 tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl
 create mode 100644 tools/perf/arch/mips/include/dwarf-regs-table.h
 create mode 100644 tools/perf/arch/mips/include/perf_regs.h
 create mode 100644 tools/perf/arch/mips/util/Build
 create mode 100644 tools/perf/arch/mips/util/dwarf-regs.c
 create mode 100644 tools/perf/arch/mips/util/perf_regs.c
 create mode 100644 tools/perf/arch/mips/util/unwind-libunwind.c

Comments

Tiezhu Yang Feb. 22, 2021, 6:43 a.m. UTC | #1
On 02/04/2021 11:35 AM, Tiezhu Yang wrote:
> v2: add R26 and R27 to the enum perf_event_mips_regs in patch #1
>
> Tiezhu Yang (3):
>    MIPS: kernel: Support extracting off-line stack traces from user-space
>      with perf
>    perf tools: Support mips unwinding and dwarf-regs
>    perf tools: Generate mips syscalls_n64.c syscall table

Hi Arnaldo,

The kernel part patch #1 has been merged.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1ddc96bd42da

Could the perf tool patches #2 and #3 have a chance to be merged before 
5.12-rc1?
If yes, we can use this feature in 5.12-rc1.

https://lore.kernel.org/patchwork/patch/1375476/
https://lore.kernel.org/patchwork/patch/1375475/


Thanks,
Tiezhu

>
>   arch/mips/Kconfig                                  |   2 +
>   arch/mips/include/uapi/asm/perf_regs.h             |  40 +++
>   arch/mips/kernel/Makefile                          |   2 +-
>   arch/mips/kernel/perf_regs.c                       |  68 ++++
>   tools/perf/Makefile.config                         |   9 +-
>   tools/perf/arch/mips/Makefile                      |  22 ++
>   tools/perf/arch/mips/entry/syscalls/mksyscalltbl   |  32 ++
>   .../perf/arch/mips/entry/syscalls/syscall_n64.tbl  | 358 +++++++++++++++++++++
>   tools/perf/arch/mips/include/dwarf-regs-table.h    |  31 ++
>   tools/perf/arch/mips/include/perf_regs.h           |  84 +++++
>   tools/perf/arch/mips/util/Build                    |   3 +
>   tools/perf/arch/mips/util/dwarf-regs.c             |  38 +++
>   tools/perf/arch/mips/util/perf_regs.c              |   6 +
>   tools/perf/arch/mips/util/unwind-libunwind.c       |  22 ++
>   tools/perf/check-headers.sh                        |   1 +
>   tools/perf/util/dwarf-regs.c                       |   3 +
>   tools/perf/util/syscalltbl.c                       |   4 +
>   17 files changed, 723 insertions(+), 2 deletions(-)
>   create mode 100644 arch/mips/include/uapi/asm/perf_regs.h
>   create mode 100644 arch/mips/kernel/perf_regs.c
>   create mode 100644 tools/perf/arch/mips/Makefile
>   create mode 100644 tools/perf/arch/mips/entry/syscalls/mksyscalltbl
>   create mode 100644 tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl
>   create mode 100644 tools/perf/arch/mips/include/dwarf-regs-table.h
>   create mode 100644 tools/perf/arch/mips/include/perf_regs.h
>   create mode 100644 tools/perf/arch/mips/util/Build
>   create mode 100644 tools/perf/arch/mips/util/dwarf-regs.c
>   create mode 100644 tools/perf/arch/mips/util/perf_regs.c
>   create mode 100644 tools/perf/arch/mips/util/unwind-libunwind.c
>
Arnaldo Carvalho de Melo Feb. 24, 2021, 1:16 p.m. UTC | #2
Em Mon, Feb 22, 2021 at 02:43:39PM +0800, Tiezhu Yang escreveu:
> On 02/04/2021 11:35 AM, Tiezhu Yang wrote:
> > v2: add R26 and R27 to the enum perf_event_mips_regs in patch #1
> > 
> > Tiezhu Yang (3):
> >    MIPS: kernel: Support extracting off-line stack traces from user-space
> >      with perf
> >    perf tools: Support mips unwinding and dwarf-regs
> >    perf tools: Generate mips syscalls_n64.c syscall table
> 
> Hi Arnaldo,
> 
> The kernel part patch #1 has been merged.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1ddc96bd42da
> 
> Could the perf tool patches #2 and #3 have a chance to be merged before
> 5.12-rc1?
> If yes, we can use this feature in 5.12-rc1.

Thanks, applied, should make it into 5.12-rc1.

- Arnaldo
 
> https://lore.kernel.org/patchwork/patch/1375476/
> https://lore.kernel.org/patchwork/patch/1375475/
> 
> 
> Thanks,
> Tiezhu
> 
> > 
> >   arch/mips/Kconfig                                  |   2 +
> >   arch/mips/include/uapi/asm/perf_regs.h             |  40 +++
> >   arch/mips/kernel/Makefile                          |   2 +-
> >   arch/mips/kernel/perf_regs.c                       |  68 ++++
> >   tools/perf/Makefile.config                         |   9 +-
> >   tools/perf/arch/mips/Makefile                      |  22 ++
> >   tools/perf/arch/mips/entry/syscalls/mksyscalltbl   |  32 ++
> >   .../perf/arch/mips/entry/syscalls/syscall_n64.tbl  | 358 +++++++++++++++++++++
> >   tools/perf/arch/mips/include/dwarf-regs-table.h    |  31 ++
> >   tools/perf/arch/mips/include/perf_regs.h           |  84 +++++
> >   tools/perf/arch/mips/util/Build                    |   3 +
> >   tools/perf/arch/mips/util/dwarf-regs.c             |  38 +++
> >   tools/perf/arch/mips/util/perf_regs.c              |   6 +
> >   tools/perf/arch/mips/util/unwind-libunwind.c       |  22 ++
> >   tools/perf/check-headers.sh                        |   1 +
> >   tools/perf/util/dwarf-regs.c                       |   3 +
> >   tools/perf/util/syscalltbl.c                       |   4 +
> >   17 files changed, 723 insertions(+), 2 deletions(-)
> >   create mode 100644 arch/mips/include/uapi/asm/perf_regs.h
> >   create mode 100644 arch/mips/kernel/perf_regs.c
> >   create mode 100644 tools/perf/arch/mips/Makefile
> >   create mode 100644 tools/perf/arch/mips/entry/syscalls/mksyscalltbl
> >   create mode 100644 tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl
> >   create mode 100644 tools/perf/arch/mips/include/dwarf-regs-table.h
> >   create mode 100644 tools/perf/arch/mips/include/perf_regs.h
> >   create mode 100644 tools/perf/arch/mips/util/Build
> >   create mode 100644 tools/perf/arch/mips/util/dwarf-regs.c
> >   create mode 100644 tools/perf/arch/mips/util/perf_regs.c
> >   create mode 100644 tools/perf/arch/mips/util/unwind-libunwind.c
> > 
>
Arnaldo Carvalho de Melo Feb. 25, 2021, 12:49 p.m. UTC | #3
Em Wed, Feb 24, 2021 at 10:16:55AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Feb 22, 2021 at 02:43:39PM +0800, Tiezhu Yang escreveu:
> > On 02/04/2021 11:35 AM, Tiezhu Yang wrote:
> > > v2: add R26 and R27 to the enum perf_event_mips_regs in patch #1
> > > 
> > > Tiezhu Yang (3):
> > >    MIPS: kernel: Support extracting off-line stack traces from user-space
> > >      with perf
> > >    perf tools: Support mips unwinding and dwarf-regs
> > >    perf tools: Generate mips syscalls_n64.c syscall table
> > 
> > Hi Arnaldo,
> > 
> > The kernel part patch #1 has been merged.
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1ddc96bd42da
> > 
> > Could the perf tool patches #2 and #3 have a chance to be merged before
> > 5.12-rc1?
> > If yes, we can use this feature in 5.12-rc1.
> 
> Thanks, applied, should make it into 5.12-rc1.

First we'll have to fix this problem:

  28    12.45 debian:experimental-x-mips64  : FAIL gcc version 10.2.1 20201224 (Debian 10.2.1-3)
                     from builtin-diff.c:12:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/branch.h:15,
                     from util/callchain.h:8,
                     from builtin-record.c:16:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/session.h:6,
                     from builtin-buildid-list.c:17:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/session.h:6,
                     from builtin-evlist.c:16:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/session.h:6,
                     from builtin-buildid-cache.c:24:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from builtin-annotate.c:24:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/thread.h:16,
                     from builtin-sched.c:11:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/branch.h:15,
                     from builtin-report.c:24:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from builtin-stat.c:49:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/thread.h:16,
                     from builtin-timechart.c:24:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
  29    12.79 debian:experimental-x-mipsel  : FAIL gcc version 10.2.1 20201224 (Debian 10.2.1-3)
                     from builtin-diff.c:12:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/branch.h:15,
                     from util/callchain.h:8,
                     from builtin-record.c:16:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/session.h:6,
                     from builtin-buildid-list.c:17:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from builtin-stat.c:49:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from builtin-annotate.c:24:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/session.h:6,
                     from builtin-evlist.c:16:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/thread.h:16,
                     from builtin-sched.c:11:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/thread.h:16,
                     from builtin-timechart.c:24:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/branch.h:15,
                     from builtin-report.c:24:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from util/session.h:6,
                     from builtin-buildid-cache.c:24:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
    In file included from util/perf_regs.h:30,
                     from util/event.h:15,
                     from builtin-top.c:31:
    /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
        7 | #include <asm/perf_regs.h>
          |          ^~~~~~~~~~~~~~~~~
    compilation terminated.
Arnaldo Carvalho de Melo Feb. 25, 2021, 1:10 p.m. UTC | #4
Em Thu, Feb 25, 2021 at 09:49:56AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Feb 24, 2021 at 10:16:55AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Mon, Feb 22, 2021 at 02:43:39PM +0800, Tiezhu Yang escreveu:
> > > On 02/04/2021 11:35 AM, Tiezhu Yang wrote:
> > > > v2: add R26 and R27 to the enum perf_event_mips_regs in patch #1
> > > > 
> > > > Tiezhu Yang (3):
> > > >    MIPS: kernel: Support extracting off-line stack traces from user-space
> > > >      with perf
> > > >    perf tools: Support mips unwinding and dwarf-regs
> > > >    perf tools: Generate mips syscalls_n64.c syscall table
> > > 
> > > Hi Arnaldo,
> > > 
> > > The kernel part patch #1 has been merged.
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1ddc96bd42da
> > > 
> > > Could the perf tool patches #2 and #3 have a chance to be merged before
> > > 5.12-rc1?
> > > If yes, we can use this feature in 5.12-rc1.
> > 
> > Thanks, applied, should make it into 5.12-rc1.
> 
> First we'll have to fix this problem:
> 
>   28    12.45 debian:experimental-x-mips64  : FAIL gcc version 10.2.1 20201224 (Debian 10.2.1-3)
>                      from builtin-diff.c:12:
>     /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
>         7 | #include <asm/perf_regs.h>
>           |          ^~~~~~~~~~~~~~~~~
>     compilation terminated.
>     In file included from util/perf_regs.h:30,
>                      from util/event.h:15,
>                      from util/branch.h:15,
>                      from util/callchain.h:8,
>                      from builtin-record.c:16:
>     /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory

I'm not finding it in the debian cross build packages:

root@d77a78c0aa1c:/# apt-file find perf_regs.h | grep cross
linux-libc-dev-amd64-cross: /usr/x86_64-linux-gnu/include/asm/perf_regs.h
linux-libc-dev-arm64-cross: /usr/aarch64-linux-gnu/include/asm/perf_regs.h
linux-libc-dev-armel-cross: /usr/arm-linux-gnueabi/include/asm/perf_regs.h
linux-libc-dev-armhf-cross: /usr/arm-linux-gnueabihf/include/asm/perf_regs.h
linux-libc-dev-i386-cross: /usr/i686-linux-gnu/include/asm/perf_regs.h
linux-libc-dev-powerpc-cross: /usr/powerpc-linux-gnu/include/asm/perf_regs.h
linux-libc-dev-ppc64-cross: /usr/powerpc64-linux-gnu/include/asm/perf_regs.h
linux-libc-dev-ppc64el-cross: /usr/powerpc64le-linux-gnu/include/asm/perf_regs.h
linux-libc-dev-riscv64-cross: /usr/riscv64-linux-gnu/include/asm/perf_regs.h
linux-libc-dev-s390x-cross: /usr/s390x-linux-gnu/include/asm/perf_regs.h
linux-libc-dev-x32-cross: /usr/x86_64-linux-gnux32/include/asm/perf_regs.h
root@d77a78c0aa1c:/#

Ideas?

- Arnaldo
Arnaldo Carvalho de Melo Feb. 25, 2021, 1:12 p.m. UTC | #5
Em Thu, Feb 25, 2021 at 10:10:12AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Feb 25, 2021 at 09:49:56AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Wed, Feb 24, 2021 at 10:16:55AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Mon, Feb 22, 2021 at 02:43:39PM +0800, Tiezhu Yang escreveu:
> > > > On 02/04/2021 11:35 AM, Tiezhu Yang wrote:
> > > > > v2: add R26 and R27 to the enum perf_event_mips_regs in patch #1
> > > > > 
> > > > > Tiezhu Yang (3):
> > > > >    MIPS: kernel: Support extracting off-line stack traces from user-space
> > > > >      with perf
> > > > >    perf tools: Support mips unwinding and dwarf-regs
> > > > >    perf tools: Generate mips syscalls_n64.c syscall table
> > > > 
> > > > Hi Arnaldo,
> > > > 
> > > > The kernel part patch #1 has been merged.
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1ddc96bd42da
> > > > 
> > > > Could the perf tool patches #2 and #3 have a chance to be merged before
> > > > 5.12-rc1?
> > > > If yes, we can use this feature in 5.12-rc1.
> > > 
> > > Thanks, applied, should make it into 5.12-rc1.
> > 
> > First we'll have to fix this problem:
> > 
> >   28    12.45 debian:experimental-x-mips64  : FAIL gcc version 10.2.1 20201224 (Debian 10.2.1-3)
> >                      from builtin-diff.c:12:
> >     /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
> >         7 | #include <asm/perf_regs.h>
> >           |          ^~~~~~~~~~~~~~~~~
> >     compilation terminated.
> >     In file included from util/perf_regs.h:30,
> >                      from util/event.h:15,
> >                      from util/branch.h:15,
> >                      from util/callchain.h:8,
> >                      from builtin-record.c:16:
> >     /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
> 
> I'm not finding it in the debian cross build packages:
> 
> root@d77a78c0aa1c:/# apt-file find perf_regs.h | grep cross
> linux-libc-dev-amd64-cross: /usr/x86_64-linux-gnu/include/asm/perf_regs.h
> linux-libc-dev-arm64-cross: /usr/aarch64-linux-gnu/include/asm/perf_regs.h
> linux-libc-dev-armel-cross: /usr/arm-linux-gnueabi/include/asm/perf_regs.h
> linux-libc-dev-armhf-cross: /usr/arm-linux-gnueabihf/include/asm/perf_regs.h
> linux-libc-dev-i386-cross: /usr/i686-linux-gnu/include/asm/perf_regs.h
> linux-libc-dev-powerpc-cross: /usr/powerpc-linux-gnu/include/asm/perf_regs.h
> linux-libc-dev-ppc64-cross: /usr/powerpc64-linux-gnu/include/asm/perf_regs.h
> linux-libc-dev-ppc64el-cross: /usr/powerpc64le-linux-gnu/include/asm/perf_regs.h
> linux-libc-dev-riscv64-cross: /usr/riscv64-linux-gnu/include/asm/perf_regs.h
> linux-libc-dev-s390x-cross: /usr/s390x-linux-gnu/include/asm/perf_regs.h
> linux-libc-dev-x32-cross: /usr/x86_64-linux-gnux32/include/asm/perf_regs.h
> root@d77a78c0aa1c:/#
> 
> Ideas?

Trying with:

[perfbuilder@five x-mips]$ db
acmel/linux-perf-tools-build-ubuntu:19.10-x-mips
STEP 1: FROM ubuntu:21.04
STEP 2: MAINTAINER Arnaldo Carvalho de Melo <acme@kernel.org>
STEP 3: ENV ARCH mips
STEP 4: ENV TARGET mips-linux-gnu
STEP 5: ENV CROSS_COMPILE=${TARGET}-
STEP 6: RUN apt-get -y update &&     apt-get -y install make gcc-${TARGET} g++-${TARGET} flex bison git python3 &&     apt-get -y install curl wget bzip2 xz-utils file &&     export ELFUTILS_VER=0.173 &&     export ZLIB_VER=1.2.11 &&     export INSTALLDIR=/usr/${TARGET} &&     export PATH=$INSTALLDIR/bin:$PATH &&     export TARGETMACH=${TARGET} &&     export CROSS=${TARGET}- &&     export CC=${CROSS}gcc &&     export LD=${CROSS}ld &&     export AS=${CROSS}as &&     wget -q http://zlib.net/zlib-${ZLIB_VER}.tar.gz &&     wget -q https://fedorahosted.org/releases/e/l/elfutils/${ELFUTILS_VER}/elfutils-${ELFUTILS_VER}.tar.bz2 &&     tar xf zlib-${ZLIB_VER}.tar.gz &&     cd zlib-${ZLIB_VER} &&     ./configure --prefix=${INSTALLDIR} &&     make &&     make install &&     cd .. &&     rm -rf zlib-${ZLIB_VER} &&     rm -f zlib-${ZLIB_VER}.tar.gz &&     tar xf elfutils-${ELFUTILS_VER}.tar.bz2 &&     cd elfutils-${ELFUTILS_VER} &&     ./configure --host=${TARGET} --prefix=${INSTALLDIR} &&     make &&     make install &&     cd .. &&     rm -rf elfutils-${ELFUTILS_VER}* &&     git clone https://github.com/Linaro/OpenCSD.git &&     make -C OpenCSD/decoder/build/linux/ CROSS_COMPILE=${CROSS} install &&     rm -rf OpenCSD &&     apt-get -y remove wget bzip2 &&     apt-get -y clean &&     unset TARGET INSTALLDIR TARGETMACH CROSS CC LD AS &&     mkdir -m 777 -p /git /tmp/build/perf /tmp/build/objtool /tmp/build/linux &&     groupadd -r perfbuilder &&     useradd -m -r -g perfbuilder perfbuilder &&     chown -R perfbuilder.perfbuilder /tmp/build/ /git/
Tiezhu Yang Feb. 26, 2021, 1:11 a.m. UTC | #6
On 02/25/2021 09:12 PM, Arnaldo Carvalho de Melo wrote:
> Em Thu, Feb 25, 2021 at 10:10:12AM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Thu, Feb 25, 2021 at 09:49:56AM -0300, Arnaldo Carvalho de Melo escreveu:
>>> Em Wed, Feb 24, 2021 at 10:16:55AM -0300, Arnaldo Carvalho de Melo escreveu:
>>>> Em Mon, Feb 22, 2021 at 02:43:39PM +0800, Tiezhu Yang escreveu:
>>>>> On 02/04/2021 11:35 AM, Tiezhu Yang wrote:
>>>>>> v2: add R26 and R27 to the enum perf_event_mips_regs in patch #1
>>>>>>
>>>>>> Tiezhu Yang (3):
>>>>>>     MIPS: kernel: Support extracting off-line stack traces from user-space
>>>>>>       with perf
>>>>>>     perf tools: Support mips unwinding and dwarf-regs
>>>>>>     perf tools: Generate mips syscalls_n64.c syscall table
>>>>> Hi Arnaldo,
>>>>>
>>>>> The kernel part patch #1 has been merged.
>>>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1ddc96bd42da
>>>>>
>>>>> Could the perf tool patches #2 and #3 have a chance to be merged before
>>>>> 5.12-rc1?
>>>>> If yes, we can use this feature in 5.12-rc1.
>>>> Thanks, applied, should make it into 5.12-rc1.
>>> First we'll have to fix this problem:
>>>
>>>    28    12.45 debian:experimental-x-mips64  : FAIL gcc version 10.2.1 20201224 (Debian 10.2.1-3)
>>>                       from builtin-diff.c:12:
>>>      /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
>>>          7 | #include <asm/perf_regs.h>
>>>            |          ^~~~~~~~~~~~~~~~~
>>>      compilation terminated.
>>>      In file included from util/perf_regs.h:30,
>>>                       from util/event.h:15,
>>>                       from util/branch.h:15,
>>>                       from util/callchain.h:8,
>>>                       from builtin-record.c:16:
>>>      /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory

Sorry for the late reply. I asked for a leave yesterday.

asm/perf_regs.h is a new added file in the patch #1,
the patch link is:
https://lore.kernel.org/patchwork/patch/1375477/
the commit is:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/mips/include/uapi/asm/perf_regs.h?id=1ddc96bd42da

So we should build patch #2 based on patch #1.

Thanks,
Tiezhu

>> I'm not finding it in the debian cross build packages:
>>
>> root@d77a78c0aa1c:/# apt-file find perf_regs.h | grep cross
>> linux-libc-dev-amd64-cross: /usr/x86_64-linux-gnu/include/asm/perf_regs.h
>> linux-libc-dev-arm64-cross: /usr/aarch64-linux-gnu/include/asm/perf_regs.h
>> linux-libc-dev-armel-cross: /usr/arm-linux-gnueabi/include/asm/perf_regs.h
>> linux-libc-dev-armhf-cross: /usr/arm-linux-gnueabihf/include/asm/perf_regs.h
>> linux-libc-dev-i386-cross: /usr/i686-linux-gnu/include/asm/perf_regs.h
>> linux-libc-dev-powerpc-cross: /usr/powerpc-linux-gnu/include/asm/perf_regs.h
>> linux-libc-dev-ppc64-cross: /usr/powerpc64-linux-gnu/include/asm/perf_regs.h
>> linux-libc-dev-ppc64el-cross: /usr/powerpc64le-linux-gnu/include/asm/perf_regs.h
>> linux-libc-dev-riscv64-cross: /usr/riscv64-linux-gnu/include/asm/perf_regs.h
>> linux-libc-dev-s390x-cross: /usr/s390x-linux-gnu/include/asm/perf_regs.h
>> linux-libc-dev-x32-cross: /usr/x86_64-linux-gnux32/include/asm/perf_regs.h
>> root@d77a78c0aa1c:/#
>>
>> Ideas?
> Trying with:
>
> [perfbuilder@five x-mips]$ db
> acmel/linux-perf-tools-build-ubuntu:19.10-x-mips
> STEP 1: FROM ubuntu:21.04
> STEP 2: MAINTAINER Arnaldo Carvalho de Melo <acme@kernel.org>
> STEP 3: ENV ARCH mips
> STEP 4: ENV TARGET mips-linux-gnu
> STEP 5: ENV CROSS_COMPILE=${TARGET}-
> STEP 6: RUN apt-get -y update &&     apt-get -y install make gcc-${TARGET} g++-${TARGET} flex bison git python3 &&     apt-get -y install curl wget bzip2 xz-utils file &&     export ELFUTILS_VER=0.173 &&     export ZLIB_VER=1.2.11 &&     export INSTALLDIR=/usr/${TARGET} &&     export PATH=$INSTALLDIR/bin:$PATH &&     export TARGETMACH=${TARGET} &&     export CROSS=${TARGET}- &&     export CC=${CROSS}gcc &&     export LD=${CROSS}ld &&     export AS=${CROSS}as &&     wget -q http://zlib.net/zlib-${ZLIB_VER}.tar.gz &&     wget -q https://fedorahosted.org/releases/e/l/elfutils/${ELFUTILS_VER}/elfutils-${ELFUTILS_VER}.tar.bz2 &&     tar xf zlib-${ZLIB_VER}.tar.gz &&     cd zlib-${ZLIB_VER} &&     ./configure --prefix=${INSTALLDIR} &&     make &&     make install &&     cd .. &&     rm -rf zlib-${ZLIB_VER} &&     rm -f zlib-${ZLIB_VER}.tar.gz &&     tar xf elfutils-${ELFUTILS_VER}.tar.bz2 &&     cd elfutils-${ELFUTILS_VER} &&     ./configure --host=${TARGET} --prefix=${INSTALLDIR} &&    
  make &&     make install &&     cd .. &&     rm -rf elfutils-${ELFUTILS_VER}* &&     git clone https://github.com/Linaro/OpenCSD.git &&     make -C OpenCSD/decoder/build/linux/ CROSS_COMPILE=${CROSS} install &&     rm -rf OpenCSD &&     apt-get -y remove wget bzip2 &&     apt-get -y clean &&     unset TARGET INSTALLDIR TARGETMACH CROSS CC LD AS &&     mkdir -m 777 -p /git /tmp/build/perf /tmp/build/objtool /tmp/build/linux &&     groupadd -r perfbuilder &&     useradd -m -r -g perfbuilder perfbuilder &&     chown -R perfbuilder.perfbuilder /tmp/build/ /git/
Arnaldo Carvalho de Melo Feb. 26, 2021, 11:49 p.m. UTC | #7
Em Fri, Feb 26, 2021 at 09:11:17AM +0800, Tiezhu Yang escreveu:
> On 02/25/2021 09:12 PM, Arnaldo Carvalho de Melo wrote:
> > Em Thu, Feb 25, 2021 at 10:10:12AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Thu, Feb 25, 2021 at 09:49:56AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > Em Wed, Feb 24, 2021 at 10:16:55AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > > Em Mon, Feb 22, 2021 at 02:43:39PM +0800, Tiezhu Yang escreveu:
> > > > > > On 02/04/2021 11:35 AM, Tiezhu Yang wrote:
> > > > > > > v2: add R26 and R27 to the enum perf_event_mips_regs in patch #1
> > > > > > > 
> > > > > > > Tiezhu Yang (3):
> > > > > > >     MIPS: kernel: Support extracting off-line stack traces from user-space
> > > > > > >       with perf
> > > > > > >     perf tools: Support mips unwinding and dwarf-regs
> > > > > > >     perf tools: Generate mips syscalls_n64.c syscall table
> > > > > > Hi Arnaldo,
> > > > > > 
> > > > > > The kernel part patch #1 has been merged.
> > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1ddc96bd42da
> > > > > > 
> > > > > > Could the perf tool patches #2 and #3 have a chance to be merged before
> > > > > > 5.12-rc1?
> > > > > > If yes, we can use this feature in 5.12-rc1.
> > > > > Thanks, applied, should make it into 5.12-rc1.
> > > > First we'll have to fix this problem:
> > > > 
> > > >    28    12.45 debian:experimental-x-mips64  : FAIL gcc version 10.2.1 20201224 (Debian 10.2.1-3)
> > > >                       from builtin-diff.c:12:
> > > >      /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
> > > >          7 | #include <asm/perf_regs.h>
> > > >            |          ^~~~~~~~~~~~~~~~~
> > > >      compilation terminated.
> > > >      In file included from util/perf_regs.h:30,
> > > >                       from util/event.h:15,
> > > >                       from util/branch.h:15,
> > > >                       from util/callchain.h:8,
> > > >                       from builtin-record.c:16:
> > > >      /git/linux/tools/perf/arch/mips/include/perf_regs.h:7:10: fatal error: asm/perf_regs.h: No such file or directory
> 
> Sorry for the late reply. I asked for a leave yesterday.
> 
> asm/perf_regs.h is a new added file in the patch #1,
> the patch link is:
> https://lore.kernel.org/patchwork/patch/1375477/
> the commit is:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/mips/include/uapi/asm/perf_regs.h?id=1ddc96bd42da
> 
> So we should build patch #2 based on patch #1.

yeah, my bad, since perf wasn't supported on MIPS, how could cross build
environments have the needed files? Stooooopid me, sorry. :-) I'll
retest after adding the needed files to my test containers.

- Arnaldo
 
> Thanks,
> Tiezhu
> 
> > > I'm not finding it in the debian cross build packages:
> > > 
> > > root@d77a78c0aa1c:/# apt-file find perf_regs.h | grep cross
> > > linux-libc-dev-amd64-cross: /usr/x86_64-linux-gnu/include/asm/perf_regs.h
> > > linux-libc-dev-arm64-cross: /usr/aarch64-linux-gnu/include/asm/perf_regs.h
> > > linux-libc-dev-armel-cross: /usr/arm-linux-gnueabi/include/asm/perf_regs.h
> > > linux-libc-dev-armhf-cross: /usr/arm-linux-gnueabihf/include/asm/perf_regs.h
> > > linux-libc-dev-i386-cross: /usr/i686-linux-gnu/include/asm/perf_regs.h
> > > linux-libc-dev-powerpc-cross: /usr/powerpc-linux-gnu/include/asm/perf_regs.h
> > > linux-libc-dev-ppc64-cross: /usr/powerpc64-linux-gnu/include/asm/perf_regs.h
> > > linux-libc-dev-ppc64el-cross: /usr/powerpc64le-linux-gnu/include/asm/perf_regs.h
> > > linux-libc-dev-riscv64-cross: /usr/riscv64-linux-gnu/include/asm/perf_regs.h
> > > linux-libc-dev-s390x-cross: /usr/s390x-linux-gnu/include/asm/perf_regs.h
> > > linux-libc-dev-x32-cross: /usr/x86_64-linux-gnux32/include/asm/perf_regs.h
> > > root@d77a78c0aa1c:/#
> > > 
> > > Ideas?
> > Trying with:
> > 
> > [perfbuilder@five x-mips]$ db
> > acmel/linux-perf-tools-build-ubuntu:19.10-x-mips
> > STEP 1: FROM ubuntu:21.04
> > STEP 2: MAINTAINER Arnaldo Carvalho de Melo <acme@kernel.org>
> > STEP 3: ENV ARCH mips
> > STEP 4: ENV TARGET mips-linux-gnu
> > STEP 5: ENV CROSS_COMPILE=${TARGET}-
> > STEP 6: RUN apt-get -y update &&     apt-get -y install make gcc-${TARGET} g++-${TARGET} flex bison git python3 &&     apt-get -y install curl wget bzip2 xz-utils file &&     export ELFUTILS_VER=0.173 &&     export ZLIB_VER=1.2.11 &&     export INSTALLDIR=/usr/${TARGET} &&     export PATH=$INSTALLDIR/bin:$PATH &&     export TARGETMACH=${TARGET} &&     export CROSS=${TARGET}- &&     export CC=${CROSS}gcc &&     export LD=${CROSS}ld &&     export AS=${CROSS}as &&     wget -q http://zlib.net/zlib-${ZLIB_VER}.tar.gz &&     wget -q https://fedorahosted.org/releases/e/l/elfutils/${ELFUTILS_VER}/elfutils-${ELFUTILS_VER}.tar.bz2 &&     tar xf zlib-${ZLIB_VER}.tar.gz &&     cd zlib-${ZLIB_VER} &&     ./configure --prefix=${INSTALLDIR} &&     make &&     make install &&     cd .. &&     rm -rf zlib-${ZLIB_VER} &&     rm -f zlib-${ZLIB_VER}.tar.gz &&     tar xf elfutils-${ELFUTILS_VER}.tar.bz2 &&     cd elfutils-${ELFUTILS_VER} &&     ./configure --host=${TARGET} --prefix=${INSTALLDIR} &&     make &&     make install &&     cd .. &&     rm -rf elfutils-${ELFUTILS_VER}* &&     git clone https://github.com/Linaro/OpenCSD.git &&     make -C OpenCSD/decoder/build/linux/ CROSS_COMPILE=${CROSS} install &&     rm -rf OpenCSD &&     apt-get -y remove wget bzip2 &&     apt-get -y clean &&     unset TARGET INSTALLDIR TARGETMACH CROSS CC LD AS &&     mkdir -m 777 -p /git /tmp/build/perf /tmp/build/objtool /tmp/build/linux &&     groupadd -r perfbuilder &&     useradd -m -r -g perfbuilder perfbuilder &&     chown -R perfbuilder.perfbuilder /tmp/build/ /git/
>
Arnaldo Carvalho de Melo March 1, 2021, 5:50 p.m. UTC | #8
Em Fri, Feb 26, 2021 at 08:49:29PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Feb 26, 2021 at 09:11:17AM +0800, Tiezhu Yang escreveu:
> > Sorry for the late reply. I asked for a leave yesterday.

> > asm/perf_regs.h is a new added file in the patch #1,
> > the patch link is:
> > https://lore.kernel.org/patchwork/patch/1375477/
> > the commit is:
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/mips/include/uapi/asm/perf_regs.h?id=1ddc96bd42da
> > 
> > So we should build patch #2 based on patch #1.

> yeah, my bad, since perf wasn't supported on MIPS, how could cross build
> environments have the needed files? Stooooopid me, sorry. :-) I'll
> retest after adding the needed files to my test containers.

Then I had to add this one on top:

Committer notes:

Do it as __perf_reg_name() to cope with:

  067012974c8ae31a ("perf tools: Fix arm64 build error with gcc-11")

- Arnaldo