← Back to team overview

kernel-packages team mailing list archive

[Bug 1410673] Comment bridged from LTC Bugzilla

 

------- Comment From zhlbj@xxxxxxxxxx 2015-02-02 03:15 EDT-------
(In reply to comment #25)
> It appears that all fds get  POLLHUP and hence get filtered out
> by  the perf_evlist__filter_pollfd(evlist, POLLERR|POLLHUP), check.
> This happens most of the time but not always. When this happens
> the mmap is freed (in perf_evlist__munmap_filtered()), but then we
> do the "goto again" which tries to read from the freed mmap.
>
> With the following patch, I was able to run the 'perf trace sleep 1'
> several hundred times, but this defeats the purpose of the "draining"
> check.
>
>
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index fb12645..ac25e16 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -2173,8 +2173,10 @@ next_event:
>                 int timeout = done ? 100 : -1;
>
>                 if (!draining && perf_evlist__poll(evlist, timeout) > 0) {
> -                       if (perf_evlist__filter_pollfd(evlist, POLLERR |
> POLLHUP) == 0)
> +                       if (perf_evlist__filter_pollfd(evlist, POLLERR |
> POLLHUP) == 0) {
>                                 draining = true;
> +                               goto out_disable;
> +                       }
>
>                         goto again;
>                 }
>
> Li, can you look into why they added the 'draining' check (IOW, why
> do they go back and read even if perf_evlist___filter_pollfd() returns
> 0 ?

Sure, still looking at this and your discussion with community.  :)

>
> It maybe interesting to see if the mainline code, which at a quick
> glance seems similar to this code in Ubuntu Vivid, behaves the same
> way on this system.

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1410673

Title:
  perf trace sleep 1 is throwing segmentation fault

Status in linux package in Ubuntu:
  New

Bug description:
  == Comment: #0 - PAVAMAN SUBRAMANIYAM <pavsubra@xxxxxxxxxx> - 2015-01-12 02:21:16 ==
  ---Problem Description---
  perf trace sleep 1 is throwing segmentation fault
   
  Contact Information = pavsubra@xxxxxxxxxx 
   
  ---uname output---
  Linux ubuntu 3.18.0-8-generic #9-Ubuntu SMP Mon Jan 5 22:52:15 UTC 2015 ppc64le ppc64le ppc64le GNU/Linux
   
  Machine Type = P8 
   
  ---Debugger---
  A debugger is not configured
   
  ---Steps to Reproduce---
  Install a Ubuntu 15.04 guest VM on Power KVM host on a P8 machine.
  Then execute the below command on the same:

  root@ubuntu:~# perf trace sleep 1
  Segmentation fault (core dumped)
  root@ubuntu:~# echo $?
  139

  root@ubuntu:~# perf trace -v sleep 1
  mmap size 67174400B
  Problems reading syscall 3 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 11 information
  Problems reading syscall 0 information
  Problems reading syscall 45 information
  Problems reading syscall 45 information
  Problems reading syscall 33 information
  Problems reading syscall 33 information
  Problems reading syscall 90 information
  Problems reading syscall 90 information
  Problems reading syscall 33 information
  Problems reading syscall 33 information
  Problems reading syscall 5 information
  Problems reading syscall 5 information
  Problems reading syscall 108 information
  Problems reading syscall 108 information
  Problems reading syscall 90 information
  Problems reading syscall 90 information
  Problems reading syscall 6 information
  Problems reading syscall 6 information
  Problems reading syscall 33 information
  Problems reading syscall 33 information
  Problems reading syscall 5 information
  Problems reading syscall 5 information
  Problems reading syscall 3 information
  Problems reading syscall 3 information
  Problems reading syscall 108 information
  Problems reading syscall 108 information
  Problems reading syscall 90 information
  Problems reading syscall 90 information
  Problems reading syscall 90 information
  Problems reading syscall 90 information
  Problems reading syscall 6 information
  Problems reading syscall 6 information
  Problems reading syscall 91 information
  Problems reading syscall 91 information
  Problems reading syscall 45 information
  Problems reading syscall 45 information
  Problems reading syscall 45 information
  Problems reading syscall 45 information
  Problems reading syscall 5 information
  Problems reading syscall 5 information
  Problems reading syscall 108 information
  Problems reading syscall 108 information
  Problems reading syscall 90 information
  Problems reading syscall 90 information
  Problems reading syscall 6 information
  Problems reading syscall 6 information
  Problems reading syscall 162 information
  Problems reading syscall 162 information
  Segmentation fault (core dumped)

   
  Stack trace output:
   no
   
  Oops output:
   no
   
  Userspace tool common name: /usr/bin/perf 
   
  The userspace tool has the following bit modes: 64-bit 
   
  System Dump Info:
    The system is not configured to capture a system dump.

  Userspace rpm: linux-tools-common

  Userspace tool obtained from project website:  na 
   
  *Additional Instructions for pavsubra@xxxxxxxxxx: 
  -Post a private note with access information to the machine that the bug is occuring on. 
  -Attach sysctl -a output output to the bug.
  -Attach ltrace and strace of userspace application.

  == Comment: #3 - SANDHYA VENUGOPALA <vsandhya@xxxxxxxxxx> - 2015-01-13 06:00:18 ==
  Segmentation Fault happens intermittently. Execute "perf trace sleep 1" multiple times to ensure there is no segmentation fault on the version you are testing.

  This failure is seen on the upstream version(3.19) also. GDB output -

  root@ubuntu:~/linux/tools/perf# ./perf trace sleep 1
  Segmentation fault (core dumped)
  root@ubuntu:~/linux/tools/perf# gdb ./perf core
  GNU gdb (Ubuntu 7.8.1-1ubuntu2) 7.8.1
  Copyright (C) 2014 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
  and "show warranty" for details.
  This GDB was configured as "powerpc64le-linux-gnu".
  Type "show configuration" for configuration details.
  For bug reporting instructions, please see:
  <http://www.gnu.org/software/gdb/bugs/>.
  Find the GDB manual and other documentation resources online at:
  <http://www.gnu.org/software/gdb/documentation/>.
  For help, type "help".
  Type "apropos word" to search for commands related to "word"...
  Reading symbols from ./perf...done.
  [New LWP 24493]
  [Thread debugging using libthread_db enabled]
  Using host libthread_db library "/lib/powerpc64le-linux-gnu/libthread_db.so.1".
  Core was generated by `./perf trace sleep 1 '.
  Program terminated with signal SIGSEGV, Segmentation fault.
  #0  perf_mmap__read_head (mm=0x3fff95730058) at util/evlist.h:193
  193		int head = ACCESS_ONCE(pc->data_head);
  (gdb) bt
  #0  perf_mmap__read_head (mm=0x3fff95730058) at util/evlist.h:193
  #1  perf_evlist__mmap_read (evlist=0x1000f851e70, idx=<optimized out>) at util/evlist.c:638
  #2  0x000000001004318c in trace__run (argv=<optimized out>, argc=<optimized out>, trace=0x3fffdca33668) at builtin-trace.c:2123
  #3  cmd_trace (argc=<optimized out>, argv=<optimized out>, prefix=<optimized out>) at builtin-trace.c:2601
  #4  0x0000000010009328 in run_builtin (p=0x10178210 <commands+504>, argc=3, argv=0x3fffdca36800) at perf.c:341
  #5  0x00000000100085c8 in handle_internal_command (argv=0x3fffdca36800, argc=3) at perf.c:400
  #6  run_argv (argv=0x3fffdca36220, argcp=0x3fffdca3622c) at perf.c:444
  #7  main (argc=3, argv=0x3fffdca36800) at perf.c:559

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1410673/+subscriptions