1. 29 9月, 2017 2 次提交
  2. 12 8月, 2017 1 次提交
    • T
      perf report: Fix module symbol adjustment for s390x · 4a084ecf
      Thomas Richter 提交于
      The 'perf report' tool does not display the addresses of kernel module
      symbols correctly.
      
      For example symbol qeth_send_ipa_cmd in kernel module qeth.ko has this
      relative address for function qeth_send_ipa_cmd():
      
        [root@s8360047 linux]# nm -g drivers/s390/net/qeth.ko | fgrep send_ipa_cmd
        0000000000013088 T qeth_send_ipa_cmd
      
      The module is loaded at address:
      
        [root@s8360047 linux]# cat /sys/module/qeth/sections/.text
        0x000003ff80296d20
        [root@s8360047 linux]#
      
      This should result in a start address of:
      
        0x13088 + 0x3ff80296d20 = 0x3ff802a9da8
      
      Using crash to verify the address on a live system:
      
        [root@s8360046 linux]# crash vmlinux
      
        crash 7.1.9++
        Copyright (C) 2002-2016  Red Hat, Inc.
        Copyright (C) 2004, 2005, 2006, 2010  IBM Corporation
      
        [...]
      
        crash> mod -s qeth drivers/s390/net/qeth.ko
             MODULE       NAME        SIZE  OBJECT FILE
             3ff8028d700  qeth      151552  drivers/s390/net/qeth.ko
        crash> sym qeth_send_ipa_cmd
        3ff802a9da8 (T) qeth_send_ipa_cmd [qeth] /root/linux/drivers/s390/net/qeth_core_main.c: 2944
        crash>
      
      Now perf report displays the address of symbol qeth_send_ipa_cmd:
      symbol__new:
      
        qeth_send_ipa_cmd 0x130f0-0x132ce
      
      There is a difference of 0x68 between the entry in the symbol table (see
      nm command above) and perf. The difference is from the offset the .text
      segment of qeth.ko:
      
        [root@s8360047 perf]# readelf -a drivers/s390/net/qeth.ko
        Section Headers:
        [Nr] Name              Type             Address           Offset
             Size              EntSize          Flags  Link  Info  Align
        [ 0]                   NULL             0000000000000000  00000000
             0000000000000000  0000000000000000           0     0     0
        [ 1] .note.gnu.build-i NOTE             0000000000000000  00000040
             0000000000000024  0000000000000000   A       0     0     4
        [ 2] .text             PROGBITS         0000000000000000  00000068
             000000000001c8a0  0000000000000000  AX       0     0     8
      
      As seen the .text segment has an offset of 0x68 with start address 0x0.
      Therefore 0x68 is added to the address of qeth_send_ipa_cmd and thus
      0x13088 + 0x68 = 0x130f0 is displayed.
      
      This is wrong, perf report needs to display the start address of symbol
      qeth_send_ipa_cmd at 0x13088 + qeth.ko.text section start address.
      
      The qeth.ko module .text start address is available in the qeth.ko DSO
      map. Just identify the kernel module symbols and correct the addresses.
      
      With the fix I see this correct address for symbol: symbol__new:
      qeth_send_ipa_cmd 0x3ff802a9da8-0x3ff802a9f86
      Signed-off-by: NThomas-Mich Richter <tmricht@linux.vnet.ibm.com>
      Reviewed-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
      Cc: Zvonko Kosic <zvonko.kosic@de.ibm.com>
      LPU-Reference: 20170803134902.47207-1-tmricht@linux.vnet.ibm.com
      Link: http://lkml.kernel.org/n/tip-q8lktlpoxb5e3dj52u1s1rw4@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4a084ecf
  3. 25 7月, 2017 1 次提交
    • T
      perf report: Fix kernel symbol adjustment for s390x · cf6383f7
      Thomas Richter 提交于
      On s390x the kernel text segment starts at address 0x0.  When perf
      report reads kernel symbols from vmlinux file it adds an offset of
      0x1000.
      
      For example see symbol set_reset_devices:
      
        [root@s8360047 linux-devel]# nm -A vmlinux| fgrep set_reset_devices
        vmlinux:0000000001379000 t set_reset_devices
        [root@s8360047 linux-devel]#
      
        [root@s8360047 linux-devel]# fgrep set_reset_devices /proc/kallsyms
        0000000001379000 t set_reset_devices
        [root@s8360047 linux-devel]#
      
      The kernel symbol table and the vmlinux file have the same address for
      symbol set_reset_devices namely 1379000.
      
      When perf report reads this symbols it displays it with address
      symbol__new: set_reset_devices 0x137a000-0x137a018
      
      There is a difference between perf report and vmlinux of 0x1000.
      
      The reason for the difference is at kernel symbol load time in function
      dso__load_sym(). The vmlinux file is investigated with its ELF header.
      Command readelf shows this:
      
        Section Headers:
        [Nr] Name              Type             Address           Offset
             Size              EntSize          Flags  Link  Info  Align
        [ 0]                   NULL             0000000000000000  00000000
             0000000000000000  0000000000000000           0     0     0
        [ 1] .text             PROGBITS         0000000000000000  00001000
             0000000000b0e0c2  0000000000000000  AX       0     0     128
      
      This leads to an invalid calculation of the symbol start address, see
      file utit/symbol-elf.c line 974:
      
              /* Adjust symbol to map to file offset */
              if (adjust_kernel_syms)
                      sym.st_value -= shdr.sh_addr - shdr.sh_offset;
      
      With shdr.sh_addr set to 0x0 and shdr.sh_offset set to 0x1000 as read
      from the ELF .text section 0x1000 is added to the symbol address.
      
      I would like to fix this by introducing an archticture specific function
      named elf__needs_adjust_symbols(). This is the same approach as done by
      PowerPC.  The function currently does not exist for s390x and the
      default weak one is used.  The s390x specific one returns false when
      symsrc_init() is invoked for kernel symbols and results in variable
      adjust_kernel_syms being false.  This omits the adjustment and the
      correct address is displayed (when symbol resolvement does not work).
      
      The s390x specific function returns false for kernel symbol adjustment
      and returns true for kernel modules, processes and shared libraries.
      Signed-off-by: NThomas-Mich Richter <tmricht@linux.vnet.ibm.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
      LPU-Reference: 20170713130252.6167-1-tmricht@linux.vnet.ibm.com
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cf6383f7
  4. 20 4月, 2017 1 次提交
  5. 27 7月, 2016 1 次提交
  6. 30 1月, 2016 2 次提交
  7. 13 2月, 2015 1 次提交
  8. 17 7月, 2014 1 次提交
  9. 08 7月, 2014 1 次提交
  10. 16 3月, 2013 1 次提交
  11. 05 1月, 2011 1 次提交