[all-commits] [llvm/llvm-project] f0b45f: [BOLT][Instrumentation][NFC] define and use mmap f...

treapster via All-commits all-commits at lists.llvm.org
Thu Jun 29 15:05:11 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f0b45fba4b64ab0b5d6c50d978e02f0d12d4d070
      https://github.com/llvm/llvm-project/commit/f0b45fba4b64ab0b5d6c50d978e02f0d12d4d070
  Author: Denis Revunov <revunov.denis at huawei-partners.com>
  Date:   2023-06-30 (Fri, 30 Jun 2023)

  Changed paths:
    M bolt/runtime/common.h
    M bolt/runtime/instr.cpp

  Log Message:
  -----------
  [BOLT][Instrumentation][NFC] define and use mmap flags

Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D154056


  Commit: 8f7c53ef81c17ae9d773818181d04ef1c3890912
      https://github.com/llvm/llvm-project/commit/8f7c53ef81c17ae9d773818181d04ef1c3890912
  Author: Denis Revunov <revunov.denis at huawei-partners.com>
  Date:   2023-06-30 (Fri, 30 Jun 2023)

  Changed paths:
    M bolt/runtime/instr.cpp

  Log Message:
  -----------
  [BOLT][Instrumentation] Add mmap return value assertions

In a very rare case that mmap call fails, we'll at least get a message
instead of segfault.

Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D154056


  Commit: 02c3724d43840339fdc91d21747e96b5f7405bb0
      https://github.com/llvm/llvm-project/commit/02c3724d43840339fdc91d21747e96b5f7405bb0
  Author: Denis Revunov <revunov.denis at huawei-partners.com>
  Date:   2023-06-30 (Fri, 30 Jun 2023)

  Changed paths:
    M bolt/runtime/instr.cpp

  Log Message:
  -----------
  [BOLT][Instrumentation] Don't share counters when using append-pid

The point of append-pid option is to record separate profiles for
separate forks, which is impossible when counters are the same for
every process. It leads to a sum of all profiles in every file, plus
GlobalWriteProfileMutex located in a shared memory prevents some
processes from dumping their data at all.

Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D153771


  Commit: ad4e0770ca7ebbc4dd6635b17421819b2393aa33
      https://github.com/llvm/llvm-project/commit/ad4e0770ca7ebbc4dd6635b17421819b2393aa33
  Author: Denis Revunov <revunov.denis at huawei-partners.com>
  Date:   2023-06-30 (Fri, 30 Jun 2023)

  Changed paths:
    M bolt/runtime/instr.cpp

  Log Message:
  -----------
  [BOLT][Instrumentation] Put Allocator itslef in shared memory by default

In absence of instrumentation-file-append-pid option,
global allocator uses shared pages for allocation. However, since it is a
global variable, it gets COW'd after fork if instrumentation-sleep-time
is used, or if a process forks by itself. This means it handles the same
pages to every process which causes hash table corruption. Thus, if we
want shared pages, we need to put the allocator itself in a shared page,
which we do in this commit in __bolt_instr_setup.
I also added a couple of assertions to sanity-check the hash table.

Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D153771


  Commit: f6682ad03f29d087f2115be72476b35ec549e36a
      https://github.com/llvm/llvm-project/commit/f6682ad03f29d087f2115be72476b35ec549e36a
  Author: Denis Revunov <revunov.denis at huawei-partners.com>
  Date:   2023-06-30 (Fri, 30 Jun 2023)

  Changed paths:
    M bolt/lib/RuntimeLibs/InstrumentationRuntimeLibrary.cpp

  Log Message:
  -----------
  [BOLT][Instrumentation] Disallow combining append-pid with sleep-time/wait-forks

The point of instrumentation-sleep-time option is to have a watcher
process which shares memory with all other forks and dumps a common
profile each n seconds. Combining it with append-pid suggests that we
should get a private profile of each fork every n seconds, but such
behavior is not implemented currently and is not easy to implement in
general, because we somehow need to intercept each individual fork,
launch a watcher process just for that fork, and also map counters so
that they're only shared with that single fork. Since we're not doing
it, we just disallow such combination of options.

Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D153771


  Commit: 47934c119ee2af943df8b3ddc5d36f1c3d29e6b0
      https://github.com/llvm/llvm-project/commit/47934c119ee2af943df8b3ddc5d36f1c3d29e6b0
  Author: Denis Revunov <revunov.denis at huawei-partners.com>
  Date:   2023-06-30 (Fri, 30 Jun 2023)

  Changed paths:
    M bolt/runtime/common.h
    M bolt/runtime/instr.cpp

  Log Message:
  -----------
  [BOLT][Instrumentation] Add dumping function to instrumentation hash tables

Since there are no other means to debug the instrumentation library
other than using stdout, having a function to print hash table entries
is very useful.

Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D153771


Compare: https://github.com/llvm/llvm-project/compare/4b47c6e018be...47934c119ee2


More information about the All-commits mailing list