All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ftrace: improve ftrace during compiling
@ 2021-09-11 13:50 Yinan Liu
  2021-09-11 13:50 ` [PATCH 1/2] scripts: ftrace - move the sort-processing in ftrace_init to compile time Yinan Liu
                   ` (8 more replies)
  0 siblings, 9 replies; 66+ messages in thread
From: Yinan Liu @ 2021-09-11 13:50 UTC (permalink / raw)
  To: yinan, rostedt, mark-pk.tsai, peterz, mingo, linux-kernel

Hi,
Some business scenarios require the kernel to start as quickly as possible, 
so recently we are optimizing some processing during the kernel startup phase.
When the kernel is started, ftrace_init() takes 15-20ms to execute. Almost 
all of the overhead belongs to the sorting and replacement of nop instructions, 
and other processing only accounts for about 300us. Advance the processing of 
these two parts to the compile time, and the time saved is very important 
for certain scenarios, such as the quick start of containers.

Yinan Liu (2):
  scripts: ftrace - move the sort-processing in ftrace_init to compile time
  scripts: ftrace - move the nop-processing in ftrace_init to compile time

 kernel/trace/ftrace.c   |   9 +++-
 scripts/link-vmlinux.sh |   6 +--
 scripts/recordmcount.h  |  14 +++++++
 scripts/sorttable.c     |   2 +
 scripts/sorttable.h     | 109 +++++++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 133 insertions(+), 7 deletions(-)

-- 
2.14.4.44.g2045bb6
+++++++++++++++++++++++++++++++++++++++++++++++-

^ permalink raw reply	[flat|nested] 66+ messages in thread
* Re: [PATCH 1/2] scripts: ftrace - move the sort-processing in ftrace_init to compile time
@ 2021-09-11 16:10 ` kernel test robot
  0 siblings, 0 replies; 66+ messages in thread
From: kernel test robot @ 2021-09-11 16:10 UTC (permalink / raw)
  Cc: kbuild-all, llvm

[-- Attachment #1: Type: text/plain, Size: 13391 bytes --]

In-Reply-To: <20210911135043.16014-2-yinan@linux.alibaba.com>
References: <20210911135043.16014-2-yinan@linux.alibaba.com>
TO: Yinan Liu <yinan@linux.alibaba.com>
TO: yinan@linux.alibaba.com
TO: rostedt@goodmis.org
TO: mark-pk.tsai@mediatek.com
TO: peterz@infradead.org
TO: mingo@redhat.com
TO: linux-kernel@vger.kernel.org

Hi Yinan,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tip/perf/core]
[also build test ERROR on kbuild/for-next trace/for-next linus/master v5.14 next-20210910]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Yinan-Liu/ftrace-improve-ftrace-during-compiling/20210911-215230
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 4034fb207e302cc0b1f304084d379640c1fb1436
config: mips-buildonly-randconfig-r002-20210911 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 261cbe98c38f8c1ee1a482fe76511110e790f58a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://github.com/0day-ci/linux/commit/b629528c58117cccbdb70fbded8fd9c4ef2dd9d9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Yinan-Liu/ftrace-improve-ftrace-during-compiling/20210911-215230
        git checkout b629528c58117cccbdb70fbded8fd9c4ef2dd9d9
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=mips prepare

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   error: unknown target CPU 'r5000'
   note: valid target CPU values are: mips1, mips2, mips3, mips4, mips5, mips32, mips32r2, mips32r3, mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5, mips64r6, octeon, octeon+, p5600
   In file included from scripts/sorttable.c:191:
>> scripts/sorttable.h:372:6: warning: variable 'mcount_sort_thread' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:469:6: note: uninitialized use occurs here
           if (mcount_sort_thread) {
               ^~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:372:2: note: remove the 'if' if its condition is always false
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> scripts/sorttable.h:372:6: warning: variable 'mcount_sort_thread' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:469:6: note: uninitialized use occurs here
           if (mcount_sort_thread) {
               ^~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:372:6: note: remove the '||' if its condition is always false
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> scripts/sorttable.h:372:6: warning: variable 'mcount_sort_thread' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:469:6: note: uninitialized use occurs here
           if (mcount_sort_thread) {
               ^~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:372:6: note: remove the '||' if its condition is always false
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:286:30: note: initialize the variable 'mcount_sort_thread' to silence this warning
           pthread_t mcount_sort_thread;
                                       ^
                                        = 0
   In file included from scripts/sorttable.c:193:
>> scripts/sorttable.h:372:6: warning: variable 'mcount_sort_thread' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:469:6: note: uninitialized use occurs here
           if (mcount_sort_thread) {
               ^~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:372:2: note: remove the 'if' if its condition is always false
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> scripts/sorttable.h:372:6: warning: variable 'mcount_sort_thread' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:469:6: note: uninitialized use occurs here
           if (mcount_sort_thread) {
               ^~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:372:6: note: remove the '||' if its condition is always false
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> scripts/sorttable.h:372:6: warning: variable 'mcount_sort_thread' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:469:6: note: uninitialized use occurs here
           if (mcount_sort_thread) {
               ^~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:372:6: note: remove the '||' if its condition is always false
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:286:30: note: initialize the variable 'mcount_sort_thread' to silence this warning
           pthread_t mcount_sort_thread;
                                       ^
                                        = 0
   6 warnings generated.
   /usr/bin/ld: /tmp/sorttable-24d811.o: in function `main':
>> sorttable.c:(.text+0x716): undefined reference to `pthread_create'
>> /usr/bin/ld: sorttable.c:(.text+0xb2c): undefined reference to `pthread_create'
>> /usr/bin/ld: sorttable.c:(.text+0xe90): undefined reference to `pthread_join'
>> clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
   make[2]: *** [scripts/Makefile.host:95: scripts/sorttable] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [Makefile:1196: scripts] Error 2
   make[1]: Target 'modules_prepare' not remade because of errors.
   make: *** [Makefile:220: __sub-make] Error 2
   make: Target 'modules_prepare' not remade because of errors.
--
   error: unknown target CPU 'r5000'
   note: valid target CPU values are: mips1, mips2, mips3, mips4, mips5, mips32, mips32r2, mips32r3, mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5, mips64r6, octeon, octeon+, p5600
   scripts/genksyms/parse.y: warning: 9 shift/reduce conflicts [-Wconflicts-sr]
   scripts/genksyms/parse.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr]
   In file included from scripts/sorttable.c:191:
>> scripts/sorttable.h:372:6: warning: variable 'mcount_sort_thread' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:469:6: note: uninitialized use occurs here
           if (mcount_sort_thread) {
               ^~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:372:2: note: remove the 'if' if its condition is always false
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> scripts/sorttable.h:372:6: warning: variable 'mcount_sort_thread' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:469:6: note: uninitialized use occurs here
           if (mcount_sort_thread) {
               ^~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:372:6: note: remove the '||' if its condition is always false
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> scripts/sorttable.h:372:6: warning: variable 'mcount_sort_thread' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:469:6: note: uninitialized use occurs here
           if (mcount_sort_thread) {
               ^~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:372:6: note: remove the '||' if its condition is always false
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:286:30: note: initialize the variable 'mcount_sort_thread' to silence this warning
           pthread_t mcount_sort_thread;
                                       ^
                                        = 0
   In file included from scripts/sorttable.c:193:
>> scripts/sorttable.h:372:6: warning: variable 'mcount_sort_thread' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:469:6: note: uninitialized use occurs here
           if (mcount_sort_thread) {
               ^~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:372:2: note: remove the 'if' if its condition is always false
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> scripts/sorttable.h:372:6: warning: variable 'mcount_sort_thread' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:469:6: note: uninitialized use occurs here
           if (mcount_sort_thread) {
               ^~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:372:6: note: remove the '||' if its condition is always false
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> scripts/sorttable.h:372:6: warning: variable 'mcount_sort_thread' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:469:6: note: uninitialized use occurs here
           if (mcount_sort_thread) {
               ^~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:372:6: note: remove the '||' if its condition is always false
           if (!mstruct.init_data_sec || !_start_mcount_loc || !_stop_mcount_loc) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   scripts/sorttable.h:286:30: note: initialize the variable 'mcount_sort_thread' to silence this warning
           pthread_t mcount_sort_thread;
                                       ^
                                        = 0
   6 warnings generated.
   /usr/bin/ld: /tmp/sorttable-db52b1.o: in function `main':
>> sorttable.c:(.text+0x716): undefined reference to `pthread_create'
>> /usr/bin/ld: sorttable.c:(.text+0xb2c): undefined reference to `pthread_create'
>> /usr/bin/ld: sorttable.c:(.text+0xe90): undefined reference to `pthread_join'
>> clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
   make[2]: *** [scripts/Makefile.host:95: scripts/sorttable] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [Makefile:1196: scripts] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:220: __sub-make] Error 2
   make: Target 'prepare' not remade because of errors.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26637 bytes --]

^ permalink raw reply	[flat|nested] 66+ messages in thread

end of thread, other threads:[~2022-01-22  9:17 UTC | newest]

Thread overview: 66+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-11 13:50 [PATCH 0/2] ftrace: improve ftrace during compiling Yinan Liu
2021-09-11 13:50 ` [PATCH 1/2] scripts: ftrace - move the sort-processing in ftrace_init to compile time Yinan Liu
2021-09-11 13:59   ` Steven Rostedt
2021-10-03 13:42     ` Yinan Liu
2021-10-08 23:48       ` Steven Rostedt
2021-10-09  2:56         ` Yinan Liu
2021-10-25 13:20           ` Yinan Liu
2021-10-25 15:00             ` Steven Rostedt
2021-09-11 13:50 ` [PATCH 2/2] scripts: ftrace - move the nop-processing " Yinan Liu
2021-09-11 14:12   ` Steven Rostedt
2021-09-11 15:28     ` Yinan Liu
2021-09-11 16:07       ` Peter Zijlstra
2021-09-11 14:33   ` Peter Zijlstra
2021-09-11 17:15   ` kernel test robot
2021-09-11 17:15     ` kernel test robot
2021-09-11 18:04   ` kernel test robot
2021-09-11 18:04     ` kernel test robot
2021-11-16  2:49 ` [PATCH v2 0/2] ftrace optimization at " Yinan Liu
2021-11-16  2:49   ` [PATCH v2 1/2] scripts: ftrace - move the sort-processing in ftrace_init to " Yinan Liu
2021-11-16  8:07     ` Peter Zijlstra
2021-11-16 12:42       ` Yinan Liu
2021-11-16 13:05         ` Peter Zijlstra
2021-11-16 14:46           ` Yinan Liu
2021-11-17 13:34     ` kernel test robot
2021-11-17 13:34       ` kernel test robot
2021-11-16  2:49   ` [PATCH v2 2/2] scripts: ftrace - move the nop-processing " Yinan Liu
2021-11-16  8:10     ` Peter Zijlstra
2021-11-16 12:51       ` Yinan Liu
2021-11-16 13:07       ` Steven Rostedt
2021-11-16 15:02         ` Yinan Liu
2021-11-16 16:06     ` Steven Rostedt
2021-11-22 13:43 ` [PATCH v3] scripts: ftrace - move the sort-processing " Yinan Liu
2021-11-23 10:54 ` [PATCH v4] ftrace sorting optimization changelog Yinan Liu
2021-11-23 10:54   ` [PATCH v4] scripts: ftrace - move the sort-processing in ftrace_init to compile time Yinan Liu
2021-11-29  2:13     ` Yinan Liu
2021-11-29  3:51       ` Steven Rostedt
2021-11-29  6:52         ` Yinan Liu
2021-11-30 17:08     ` Steven Rostedt
2021-12-01  5:32 ` [PATCH v5 0/2] ftrace sorting optimization changelog Yinan Liu
2021-12-01  5:32   ` [PATCH v5 1/2] scripts: ftrace - move the sort-processing in ftrace_init to compile time Yinan Liu
2021-12-01 21:45     ` Steven Rostedt
2021-12-05 12:35     ` [scripts] 12955fb1c5: kernel-selftests.livepatch.test-ftrace.sh.fail kernel test robot
2021-12-05 12:35       ` kernel test robot
2021-12-01  5:32   ` [PATCH v5 2/2] script/sorttable: code style improvements Yinan Liu
2021-12-02  2:16 ` [PATCH v6 0/2] ftrace sorting optimization changelog Yinan Liu
2021-12-02  2:16   ` [PATCH v6 1/2] scripts: ftrace - move the sort-processing in ftrace_init Yinan Liu
2021-12-02 17:58     ` Steven Rostedt
2021-12-05 12:45       ` Masami Hiramatsu
2021-12-06 20:18       ` Steven Rostedt
2021-12-07  1:29         ` Yinan Liu
2021-12-02  2:16   ` [PATCH v6 2/2] script/sorttable: code style improvements Yinan Liu
2021-12-02 15:30   ` [PATCH v6 0/2] ftrace sorting optimization changelog Peter Zijlstra
2021-12-07 15:13 ` [PATCH v7 0/2] ftrace sorting optimization Yinan Liu
2021-12-07 15:13   ` [PATCH v7 1/2] scripts: ftrace - move the sort-processing in ftrace_init Yinan Liu
2021-12-11 14:50     ` Steven Rostedt
2021-12-07 15:13   ` [PATCH v7 2/2] script/sorttable: code style improvements Yinan Liu
2021-12-12 11:33 ` [PATCH v8 0/1] change log Yinan Liu
2021-12-12 11:33   ` [PATCH v8] scripts: ftrace - move the sort-processing in ftrace_init Yinan Liu
2022-01-21  9:46     ` Sven Schnelle
2022-01-21 10:42       ` Heiko Carstens
2022-01-21 11:14         ` Sven Schnelle
2022-01-21 11:29           ` Sven Schnelle
2022-01-21 18:11         ` Steven Rostedt
2022-01-22  9:17           ` Heiko Carstens
2021-09-11 16:10 [PATCH 1/2] scripts: ftrace - move the sort-processing in ftrace_init to compile time kernel test robot
2021-09-11 16:10 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.