1. 09 11月, 2017 1 次提交
  2. 13 10月, 2017 1 次提交
  3. 06 10月, 2017 1 次提交
  4. 23 9月, 2017 2 次提交
    • J
      x86/asm: Fix inline asm call constraints for Clang · f5caf621
      Josh Poimboeuf 提交于
      For inline asm statements which have a CALL instruction, we list the
      stack pointer as a constraint to convince GCC to ensure the frame
      pointer is set up first:
      
        static inline void foo()
        {
      	register void *__sp asm(_ASM_SP);
      	asm("call bar" : "+r" (__sp))
        }
      
      Unfortunately, that pattern causes Clang to corrupt the stack pointer.
      
      The fix is easy: convert the stack pointer register variable to a global
      variable.
      
      It should be noted that the end result is different based on the GCC
      version.  With GCC 6.4, this patch has exactly the same result as
      before:
      
      	defconfig	defconfig-nofp	distro		distro-nofp
       before	9820389		9491555		8816046		8516940
       after	9820389		9491555		8816046		8516940
      
      With GCC 7.2, however, GCC's behavior has changed.  It now changes its
      behavior based on the conversion of the register variable to a global.
      That somehow convinces it to *always* set up the frame pointer before
      inserting *any* inline asm.  (Therefore, listing the variable as an
      output constraint is a no-op and is no longer necessary.)  It's a bit
      overkill, but the performance impact should be negligible.  And in fact,
      there's a nice improvement with frame pointers disabled:
      
      	defconfig	defconfig-nofp	distro		distro-nofp
       before	9796316		9468236		9076191		8790305
       after	9796957		9464267		9076381		8785949
      
      So in summary, while listing the stack pointer as an output constraint
      is no longer necessary for newer versions of GCC, it's still needed for
      older versions.
      Suggested-by: NAndrey Ryabinin <aryabinin@virtuozzo.com>
      Reported-by: NMatthias Kaehlcke <mka@chromium.org>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/3db862e970c432ae823cf515c52b54fec8270e0e.1505942196.git.jpoimboe@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      f5caf621
    • J
      objtool: Handle another GCC stack pointer adjustment bug · 0d0970ee
      Josh Poimboeuf 提交于
      The kbuild bot reported the following warning with GCC 4.4 and a
      randconfig:
      
        net/socket.o: warning: objtool: compat_sock_ioctl()+0x1083: stack state mismatch: cfa1=7+160 cfa2=-1+0
      
      This is caused by another GCC non-optimization, where it backs up and
      restores the stack pointer for no apparent reason:
      
          2f91:       48 89 e0                mov    %rsp,%rax
          2f94:       4c 89 e7                mov    %r12,%rdi
          2f97:       4c 89 f6                mov    %r14,%rsi
          2f9a:       ba 20 00 00 00          mov    $0x20,%edx
          2f9f:       48 89 c4                mov    %rax,%rsp
      
      This issue would have been happily ignored before the following commit:
      
        dd88a0a0 ("objtool: Handle GCC stack pointer adjustment bug")
      
      But now that objtool is paying attention to such stack pointer writes
      to/from a register, it needs to understand them properly.  In this case
      that means recognizing that the "mov %rsp, %rax" instruction is
      potentially a backup of the stack pointer.
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: dd88a0a0 ("objtool: Handle GCC stack pointer adjustment bug")
      Link: http://lkml.kernel.org/r/8c7aa8e9a36fbbb6655d9d8e7cea58958c912da8.1505942196.git.jpoimboe@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      0d0970ee
  5. 19 9月, 2017 1 次提交
  6. 16 9月, 2017 1 次提交
  7. 15 9月, 2017 3 次提交
  8. 14 9月, 2017 1 次提交
    • M
      mm: treewide: remove GFP_TEMPORARY allocation flag · 0ee931c4
      Michal Hocko 提交于
      GFP_TEMPORARY was introduced by commit e12ba74d ("Group short-lived
      and reclaimable kernel allocations") along with __GFP_RECLAIMABLE.  It's
      primary motivation was to allow users to tell that an allocation is
      short lived and so the allocator can try to place such allocations close
      together and prevent long term fragmentation.  As much as this sounds
      like a reasonable semantic it becomes much less clear when to use the
      highlevel GFP_TEMPORARY allocation flag.  How long is temporary? Can the
      context holding that memory sleep? Can it take locks? It seems there is
      no good answer for those questions.
      
      The current implementation of GFP_TEMPORARY is basically GFP_KERNEL |
      __GFP_RECLAIMABLE which in itself is tricky because basically none of
      the existing caller provide a way to reclaim the allocated memory.  So
      this is rather misleading and hard to evaluate for any benefits.
      
      I have checked some random users and none of them has added the flag
      with a specific justification.  I suspect most of them just copied from
      other existing users and others just thought it might be a good idea to
      use without any measuring.  This suggests that GFP_TEMPORARY just
      motivates for cargo cult usage without any reasoning.
      
      I believe that our gfp flags are quite complex already and especially
      those with highlevel semantic should be clearly defined to prevent from
      confusion and abuse.  Therefore I propose dropping GFP_TEMPORARY and
      replace all existing users to simply use GFP_KERNEL.  Please note that
      SLAB users with shrinkers will still get __GFP_RECLAIMABLE heuristic and
      so they will be placed properly for memory fragmentation prevention.
      
      I can see reasons we might want some gfp flag to reflect shorterm
      allocations but I propose starting from a clear semantic definition and
      only then add users with proper justification.
      
      This was been brought up before LSF this year by Matthew [1] and it
      turned out that GFP_TEMPORARY really doesn't have a clear semantic.  It
      seems to be a heuristic without any measured advantage for most (if not
      all) its current users.  The follow up discussion has revealed that
      opinions on what might be temporary allocation differ a lot between
      developers.  So rather than trying to tweak existing users into a
      semantic which they haven't expected I propose to simply remove the flag
      and start from scratch if we really need a semantic for short term
      allocations.
      
      [1] http://lkml.kernel.org/r/20170118054945.GD18349@bombadil.infradead.org
      
      [akpm@linux-foundation.org: fix typo]
      [akpm@linux-foundation.org: coding-style fixes]
      [sfr@canb.auug.org.au: drm/i915: fix up]
        Link: http://lkml.kernel.org/r/20170816144703.378d4f4d@canb.auug.org.au
      Link: http://lkml.kernel.org/r/20170728091904.14627-1-mhocko@kernel.orgSigned-off-by: NMichal Hocko <mhocko@suse.com>
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Acked-by: NMel Gorman <mgorman@suse.de>
      Acked-by: NVlastimil Babka <vbabka@suse.cz>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Neil Brown <neilb@suse.de>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0ee931c4
  9. 12 9月, 2017 9 次提交
    • M
      perf stat: Wait for the correct child · dfc9eec7
      Milian Wolff 提交于
      When packaging the perf userland application into an AppImage, the
      wait() call in perf stat returned too early. It turned out that some
      other child process exited, but not the one perf stat launched:
      
        $ sudo strace -e fork,execve,clone,wait4 -f ./perf-x86_64.AppImage stat sleep 1
        execve("./perf-git.3a73b7f9-x86_64.AppImage", ["./perf-git.3a73b7f9-x86_64.AppIm"..., "stat", "sleep", "1"], 0x7ffec1bbf050 /* 18 vars */) = 0
        clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f6a6e7efe50) = 3912
        strace: Process 3912 attached
        [pid  3912] clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f6a6e7efe50) = 3914
        strace: Process 3914 attached
        [pid  3912] +++ exited with 0 +++
        [pid  3911] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3912, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
        [pid  3914] clone(strace: Process 3915 attached
        child_stack=0x7f6a6d9fefb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f6a6d9ff9d0, tls=0x7f6a6d9ff700, child_tidptr=0x7f6a6d9ff9d0) = 3915
        [pid  3911] execve("/tmp/.mount_perf-g6VYMpl/AppRun", ["./perf-git.3a73b7f9-x86_64.AppIm"..., "stat", "sleep", "1"], 0x14aab70 /* 21 vars */) = 0
        [pid  3911] clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f4ae113c4d0) = 3916
        strace: Process 3916 attached
        [pid  3911] wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 3912
        [pid  3916] execve("/usr/libexec/perf-core/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/tmp/./sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/home/milian/.bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/usr/lib/icecream/libexec/icecc/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/ssd2/milian/projects/compiled/other/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/home/milian/.bin/kf5/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/ssd2/milian/projects/compiled/kf5/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/home/milian/projects/compiled/other/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/home/milian/projects/compiled/kf5/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/usr/local/sbin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/usr/local/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */) = -1 ENOENT (No such file or directory)
        [pid  3916] execve("/usr/bin/sleep", ["sleep", "1"], 0x27d3650 /* 22 vars */
         Performance counter stats for 'sleep 1':
      
             <not counted>	task-clock
             <not counted>	context-switches
             <not counted>	cpu-migrations
             <not counted>	page-faults
             <not counted>	cycles
             <not counted>	instructions
             <not counted>      branches
             <not counted>      branch-misses
      
               0.000047194 seconds time elapsed
      
        [pid  3916] --- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=3911, si_uid=0} ---
        [pid  3916] +++ killed by SIGTERM +++
        [pid  3911] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=3916, si_uid=0, si_status=SIGTERM, si_utime=0, si_stime=0} ---
        [pid  3915] --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=3914, si_uid=0} ---
        [pid  3911] +++ exited with 0 +++
        [pid  3915] --- SIGHUP {si_signo=SIGHUP, si_code=SI_USER, si_pid=3914, si_uid=0} ---
        [pid  3915] +++ exited with 0 +++
        +++ exited with 0 +++
      
      This patch uses waitpid instead to ensure the call waits for the
      debuggee application launched by 'perf stat'. This fixes 'perf stat'
      when launched from an AppImage:
      
        $ ./perf-x86_64.AppImage stat sleep 1
      
         Performance counter stats for 'sleep 1':
      
                0.357235      task-clock (msec)         #    0.000 CPUs utilized
                       1      context-switches          #    0.003 M/sec
                       0      cpu-migrations            #    0.000 K/sec
                      50      page-faults               #    0.140 M/sec
                 1269602      cycles                    #    3.554 GHz
                  654278      instructions              #    0.52  insn per cycle
                  129963      branches                  #  363.803 M/sec
                    7082      branch-misses             #    5.45% of all branches
      
             1.000633420 seconds time elapsed
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20170912152523.4497-1-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dfc9eec7
    • M
      perf tools: Support running perf binaries with a dash in their name · 3192f1ed
      Milian Wolff 提交于
      Previously the part behind "perf-" was interpreted as an internal perf
      command. If the suffix could not be handled, the execution was stopped.
      This makes it impossible to launch perf binaries that got renamed to
      have the `perf-` prefix. This is e.g. the case for appimages (e.g.
      "perf-x86_64.AppImage"), but would also apply to all other scenarios
      where users symlink or rename perf themselves:
      
      Status quo with the broken behavior:
      
        $ ln -s ./perf ./perf-custom-suffix
        $ ./perf-custom-suffix list
        cannot handle custom-suffix internally$
      
      Also note the missing newline at the end of the error message.
      
      With this patch applied, the above works properly:
      
        $ ./perf-custom-suffix list
      
        List of pre-defined events (to be used in -e):
        ...
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20170911111422.31903-1-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3192f1ed
    • T
      perf config: Check not only section->from_system_config but also item's · cba225d6
      Taeung Song 提交于
      Currently section->from_system_config is being checked multiple times.
      item->from_system_config should be checked instead, when iterating thru
      the items in a section. Fix it.
      Signed-off-by: NTaeung Song <treeze.taeung@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1504754325-9724-1-git-send-email-treeze.taeung@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cba225d6
    • J
      perf ui progress: Fix progress update · a82bfd04
      Jiri Olsa 提交于
      We currently update the 'next' variable only with a single step value.
      But it's possible the 'adv' update is bigger than single 'step' value.
      This would leave 'next' value under counted and force unnecessary
      ui_progress__ops->update calls.
      
      Calculate the amount of steps we need for 'adv' update and increase the
      'next' with that amounts of steps.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20170908120510.22515-3-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a82bfd04
    • J
      perf ui progress: Make sure we always define step value · 4d286c89
      Jiri Olsa 提交于
      Unlikely, but we could have ui_progress__init being called with total <
      16, which would set the next and step variables to 0. That would force
      unnecessary ui_progress__ops->update calls because 'next' would never
      raise.
      
      Forcing the next and step values to be always > 0.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20170908120510.22515-2-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4d286c89
    • J
      perf tools: Open perf.data with O_CLOEXEC flag · cd6379eb
      Jiri Olsa 提交于
      Do not carry the perf.data file descriptor into the workload process and
      close it when perf executes the workload.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20170908084621.31595-2-jolsa@kernel.org
      [ Add definitions for O_CLOEXEC for older systems ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cd6379eb
    • J
      tools lib api: Fix make DEBUG=1 build · 58b79186
      Jiri Olsa 提交于
      Do not use -D_FORTIFY_SOURCE=2 for DEBUG build as it seems to mess up
      with debuginfo, which results in bad gdb experience.
      
      We already do that for tools/perf/.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20170908084621.31595-1-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      58b79186
    • M
      perf tests: Fix compile when libunwind's unwind.h is available · df90cc41
      Milian Wolff 提交于
      When cross compiling perf and I want to link against a self-compiled
      libunwind, I usually make the custom path where the libunwind headers
      exist visible by adding the libunwind prefix to the include path when
      compiling perf, i.e.:
      
      ~~~~~
      $ ls $HOME/projects/compiled/other/include/
      libunwind-coredump.h  libunwind.h         libunwind-x86_64.h
      libunwind-common.h  libunwind-dynamic.h   libunwind-ptrace.h
      unwind.h
      $ make EXTRA_CFLAGS="-I$HOME/projects/compiled/other/include/
      ~~~~~~
      
      Note the `unwind.h` header from libunwind which leads to compile
      errors when compiling tests/dwarf-unwind.c, since it shadows perf's
      util/unwind.h:
      
      ~~~~~
      tests/dwarf-unwind.c:41:32: error: ‘struct unwind_entry’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
       static int unwind_entry(struct unwind_entry *entry, void *arg)
                                      ^~~~~~~~~~~~
      tests/dwarf-unwind.c: In function ‘unwind_entry’:
      tests/dwarf-unwind.c:44:22: error: dereferencing pointer to incomplete type ‘struct unwind_entry’
        char *symbol = entry->sym ? entry->sym->name : NULL;
                            ^~
      tests/dwarf-unwind.c: In function ‘unwind_thread’:
      tests/dwarf-unwind.c:92:8: error: implicit declaration of function ‘unwind__get_entries’; did you mean ‘unwind_entry’? [-Werror=implicit-function-declaration]
        err = unwind__get_entries(unwind_entry, &cnt, thread,
              ^~~~~~~~~~~~~~~~~~~
              unwind_entry
      tests/dwarf-unwind.c:92:8: error: nested extern declaration of ‘unwind__get_entries’ [-Werror=nested-externs]
      ~~~~~~
      
      Fix this compile error by specificing an explicit include of perf's
      unwind.h in the util folder.
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20170906150209.12579-1-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      df90cc41
    • A
      tools include linux: Guard against redefinition of some macros · 259d4077
      Arnaldo Carvalho de Melo 提交于
      When cross building to android r15c (and older versions) on Fedora 26
      we notice these:
      
      /opt/android-ndk-r15c/platforms/android-24/arch-arm/usr/include/sys/cdefs.h:332:0: note: this is the location of the previous definition
      
      For __aligned, __packed and __noreturn, so guard those with ifdefs to
      avoid drowning useful warnings in these.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-d7w3fa9c22dtmrwbedos6ie1@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      259d4077
  10. 09 9月, 2017 2 次提交
  11. 07 9月, 2017 5 次提交
  12. 06 9月, 2017 1 次提交
  13. 02 9月, 2017 12 次提交