09 May, 2019

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - allow users to invoke 'make' out of the source tree

    - refactor scripts/mkmakefile

    - deprecate KBUILD_SRC, which was used to track the source tree
    location for O= build.

    - fix recordmcount.pl in case objdump output is localized

    - turn unresolved symbols in external modules to errors from warnings
    by default; pass KBUILD_MODPOST_WARN=1 to get them back to warnings

    - generate modules.builtin.modinfo to collect .modinfo data from
    built-in modules

    - misc Makefile cleanups

    * tag 'kbuild-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (21 commits)
    .gitignore: add more all*.config patterns
    moduleparam: Save information about built-in modules in separate file
    Remove MODULE_ALIAS() calls that take undefined macro
    .gitignore: add leading and trailing slashes to generated directories
    scripts/tags.sh: fix direct execution of scripts/tags.sh
    scripts: override locale from environment when running recordmcount.pl
    samples: kobject: allow CONFIG_SAMPLE_KOBJECT to become y
    samples: seccomp: turn CONFIG_SAMPLE_SECCOMP into a bool option
    kbuild: move Documentation to vmlinux-alldirs
    kbuild: move samples/ to KBUILD_VMLINUX_OBJS
    modpost: make KBUILD_MODPOST_WARN also configurable for external modules
    kbuild: check arch/$(SRCARCH)/include/generated before out-of-tree build
    kbuild: remove unneeded dependency for include/config/kernel.release
    memory: squash drivers/memory/Makefile.asm-offsets
    kbuild: use $(srctree) instead of KBUILD_SRC to check out-of-tree build
    kbuild: mkmakefile: generate a simple wrapper of top Makefile
    kbuild: mkmakefile: do not check the generated Makefile marker
    kbuild: allow Kbuild to start from any directory
    kbuild: pass $(MAKECMDGOALS) to sub-make as is
    kbuild: fix warning "overriding recipe for target 'Makefile'"
    ...

    Linus Torvalds
     

03 Apr, 2019

1 commit

  • It is important that UACCESS regions are as small as possible;
    furthermore the UACCESS state is not scheduled, so doing anything that
    might directly call into the scheduler will cause random code to be
    ran with UACCESS enabled.

    Teach objtool too track UACCESS state and warn about any CALL made
    while UACCESS is enabled. This very much includes the __fentry__()
    and __preempt_schedule() calls.

    Note that exceptions _do_ save/restore the UACCESS state, and therefore
    they can drive preemption. This also means that all exception handlers
    must have an otherwise redundant UACCESS disable instruction;
    therefore ignore this warning for !STT_FUNC code (exception handlers
    are not normal functions).

    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: Josh Poimboeuf
    Cc: Borislav Petkov
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

02 Apr, 2019

1 commit

  • KBUILD_SRC was conventionally used for some different purposes:
    [1] To remember the source tree path
    [2] As a flag to check if sub-make is already done
    [3] As a flag to check if Kbuild runs out of tree

    For [1], we do not need to remember it because the top Makefile
    can compute it by $(realpath $(dir $(lastword $(MAKEFILE_LIST))))

    [2] has been replaced with self-commenting 'sub_make_done'.

    For [3], we can distinguish in-tree/out-of-tree by comparing
    $(srctree) and '.'

    This commit converts [3] to prepare for the KBUILD_SRC removal.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

28 Mar, 2019

1 commit

  • CC_FLAGS_FTRACE may contain trailing whitespace that interferes with
    findstring.

    For example, commit 6977f95e63b9 ("powerpc: avoid -mno-sched-epilog on
    GCC 4.9 and newer") introduced a change such that on my ppc64le box,
    CC_FLAGS_FTRACE="-pg -mprofile-kernel ". (Note the trailing space.)
    When cmd_record_mcount is now invoked, findstring fails as the ftrace
    flags were found at very end of _c_flags, without the trailing space.

    _c_flags=" ... -pg -mprofile-kernel"
    CC_FLAGS_FTRACE="-pg -mprofile-kernel "
    ^
    findstring is looking for this extra space

    Remove the redundant whitespaces from CC_FLAGS_FTRACE in
    cmd_record_mcount to avoid this problem.

    [masahiro.yamada: This issue only happens in the released versions
    of GNU Make. CC_FLAGS_FTRACE will not contain the trailing space if
    you use the latest GNU Make, which contains commit b90fabc8d6f3
    ("* NEWS: Do not insert a space during '+=' if the value is empty.") ]

    Suggested-by: Masahiro Yamada (refactoring)
    Fixes: 6977f95e63b9 ("powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer").
    Signed-off-by: Joe Lawrence
    Acked-by: Steven Rostedt (VMware)
    Signed-off-by: Masahiro Yamada

    Joe Lawrence
     

14 Mar, 2019

1 commit


27 Feb, 2019

1 commit

  • The genksyms source was integrated into the kernel tree in 2003.

    I do not expect anybody still using the external /sbin/genksyms.
    Kbuild does not need to provide the ability to override GENKSYMS.

    Let's remove the GENKSYMS variable, and use the hardcoded path.

    Since it occurred in the pre-git era, I attached the commit message
    in case somebody is interested in the historical background.

    | Author: Kai Germaschewski
    | Date: Wed Feb 19 04:17:28 2003 -0600
    |
    | kbuild: [PATCH] put genksyms in scripts dir
    |
    | This puts genksyms into scripts/genksyms/.
    |
    | genksyms used to be maintained externally, though the only possible user
    | was the kernel build. Moving it into the kernel sources makes it easier to
    | keep it uptodate, like for example updating it to generate linker scripts
    | directly instead of postprocessing the generated header file fragments
    | with sed, as we do currently.
    |
    | Also, genksyms does not handle __typeof__, which needs to be fixed since
    | some of the exported symbol in the kernel are defined using __typeof__.
    |
    | (Rusty Russell/me)

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

20 Feb, 2019

2 commits

  • Do not generate pointless modules.order when the module support is
    disabled.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Modern gcc adds view assignments, reset assertion checking in .loc
    directives and a couple more additional debug markers, which clutters
    the asm output unnecessarily:

    For example:

    bsp_resume:
    .LFB3466:
    .loc 1 1868 1 is_stmt 1 view -0
    .cfi_startproc
    .loc 1 1869 2 view .LVU73
    # arch/x86/kernel/cpu/common.c:1869: if (this_cpu->c_bsp_resume)
    .loc 1 1869 14 is_stmt 0 view .LVU74
    movq this_cpu(%rip), %rax # this_cpu, this_cpu
    movq 64(%rax), %rax # this_cpu.94_1->c_bsp_resume, _2
    # arch/x86/kernel/cpu/common.c:1869: if (this_cpu->c_bsp_resume)
    .loc 1 1869 5 view .LVU75
    testq %rax, %rax # _2
    je .L8 #,
    .loc 1 1870 3 is_stmt 1 view .LVU76
    movq $boot_cpu_data, %rdi #,
    jmp __x86_indirect_thunk_rax

    or
    .loc 2 57 9 view .LVU478
    .loc 2 57 9 view .LVU479
    .loc 2 57 9 view .LVU480
    .loc 2 57 9 view .LVU481
    .LBB1385:
    .LBB1383:
    .LBB1379:
    .LBB1377:
    .LBB1375:
    .loc 2 57 9 view .LVU482
    .loc 2 57 9 view .LVU483
    movl %edi, %edx # cpu, cpu
    .LVL87:
    .loc 2 57 9 is_stmt 0 view .LVU484

    That MOV in there is drowned in debugging information and latter makes
    it hard to follow the asm. And that DWARF info is not really needed for
    asm output staring.

    Disable the debug information generation which clutters the asm output
    unnecessarily:

    bsp_resume:
    # arch/x86/kernel/cpu/common.c:1869: if (this_cpu->c_bsp_resume)
    movq this_cpu(%rip), %rax # this_cpu, this_cpu
    movq 64(%rax), %rax # this_cpu.94_1->c_bsp_resume, _2
    # arch/x86/kernel/cpu/common.c:1869: if (this_cpu->c_bsp_resume)
    testq %rax, %rax # _2
    je .L8 #,
    # arch/x86/kernel/cpu/common.c:1870: this_cpu->c_bsp_resume(&boot_cpu_data);
    movq $boot_cpu_data, %rdi #,
    jmp __x86_indirect_thunk_rax
    .L8:
    # arch/x86/kernel/cpu/common.c:1871: }
    rep ret
    .size bsp_resume, .-bsp_resume

    [ bp: write commit message. ]

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Borislav Petkov

    Masahiro Yamada
     

28 Jan, 2019

3 commits

  • The commands surrounded by ( ) are executed in a subshell, but in
    most cases, we do not need to spawn an extra subshell.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • In Kbuild, if_changed and friends must have FORCE as a prerequisite.

    Hence, $(filter-out FORCE,$^) or $(filter-out $(PHONY),$^) is a common
    idiom to get the names of all the prerequisites except phony targets.

    Add real-prereqs as a shorthand.

    Note:
    We cannot replace $(filter %.o,$^) in cmd_link_multi-m because $^ may
    include auto-generated dependencies from the .*.cmd file when a single
    object module is changed into a multi object module. Refer to commit
    69ea912fda74 ("kbuild: remove unneeded link_multi_deps"). I added some
    comment to avoid accidental breakage.

    Signed-off-by: Masahiro Yamada
    Acked-by: Rob Herring

    Masahiro Yamada
     
  • The symbol table in the final archive is unneeded; the linker does not
    require the symbol table after the --whole-archive option. Every object
    file in the archive is included in the link anyway.

    Pass thin archives from subdirectories directly to the linker, and
    remove the final archiving step.

    Fix up the document and comments as well.

    Signed-off-by: Masahiro Yamada
    Acked-by: Nicholas Piggin

    Masahiro Yamada
     

30 Dec, 2018

1 commit

  • Pull Kbuild updates from Masahiro Yamada:
    "Kbuild core:
    - remove unneeded $(call cc-option,...) switches
    - consolidate Clang compiler flags into CLANG_FLAGS
    - announce the deprecation of SUBDIRS
    - fix single target build for external module
    - simplify the dependencies of 'prepare' stage targets
    - allow fixdep to directly write to .*.cmd files
    - simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS
    - change if_changed_rule to accept multi-line recipe
    - move .SECONDARY special target to scripts/Kbuild.include
    - remove redundant 'set -e'
    - improve parallel execution for CONFIG_HEADERS_CHECK
    - misc cleanups

    Treewide fixes and cleanups
    - set Clang flags correctly for PowerPC boot images
    - fix UML build error with CONFIG_GCC_PLUGINS
    - remove unneeded patterns from .gitignore files
    - refactor firmware/Makefile
    - remove unneeded rules for *offsets.s
    - avoid unneeded regeneration of intermediate .s files
    - clean up ./Kbuild

    Modpost:
    - remove unused -M, -K options
    - fix false positive warnings about section mismatch
    - use simple devtable lookup instead of linker magic
    - misc cleanups

    Coccinelle:
    - relax boolinit.cocci checks for overall consistency
    - fix warning messages of boolinit.cocci

    Other tools:
    - improve -dirty check of scripts/setlocalversion
    - add a tool to generate compile_commands.json from .*.cmd files"

    * tag 'kbuild-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (51 commits)
    kbuild: remove unused cmd_gentimeconst
    kbuild: remove $(obj)/ prefixes in ./Kbuild
    treewide: add intermediate .s files to targets
    treewide: remove explicit rules for *offsets.s
    firmware: refactor firmware/Makefile
    firmware: remove unnecessary patterns from .gitignore
    scripts: remove unnecessary ihex2fw and check-lc_ctypes from .gitignore
    um: remove unused filechk_gen_header in Makefile
    scripts: add a tool to produce a compile_commands.json file
    kbuild: add -Werror=implicit-int flag unconditionally
    kbuild: add -Werror=strict-prototypes flag unconditionally
    kbuild: add -fno-PIE flag unconditionally
    scripts: coccinelle: Correct warning message
    scripts: coccinelle: only suggest true/false in files that already use them
    kbuild: handle part-of-module correctly for *.ll and *.symtypes
    kbuild: refactor part-of-module
    kbuild: refactor quiet_modtag
    kbuild: remove redundant quiet_modtag for $(obj-m)
    kbuild: refactor Makefile.asm-generic
    user/Makefile: Fix typo and capitalization in comment section
    ...

    Linus Torvalds
     

16 Dec, 2018

4 commits


02 Dec, 2018

1 commit

  • In commit 54a702f70589 ("kbuild: mark $(targets) as .SECONDARY and
    remove .PRECIOUS markers"), I missed one important feature of the
    .SECONDARY target:

    .SECONDARY with no prerequisites causes all targets to be
    treated as secondary.

    ... which agrees with the policy of Kbuild.

    Let's move it to scripts/Kbuild.include, with no prerequisites.

    Note:
    If an intermediate file is generated by $(call if_changed,...), you
    still need to add it to "targets" so its .*.cmd file is included.

    The arm/arm64 crypto files are generated by $(call cmd,shipped),
    so they do not need to be added to "targets", but need to be added
    to "clean-files" so "make clean" can properly clean them away.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

01 Dec, 2018

7 commits

  • These three cmd_* are invoked in the $(call cmd,*) form.

    Now that 'set -e' moved to the 'cmd' macro, they do not need to
    explicitly give 'set -e'.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • With the change of rule_cc_o_c / rule_as_o_S in the last commit, each
    command is executed in a separate subshell. Rip off unneeded semicolons.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The 'define' ... 'endef' directive is useful to confine a series of
    shell commands into a single macro:

    define foo
    [action1]
    [action2]
    [action3]
    endif

    Each action is executed in a separate subshell.

    However, rule_cc_o_c and rule_as_o_S in scripts/Makefile.build are
    written as follows (with a trailing semicolon in each cmd_*):

    define rule_cc_o_c
    [action1] ; \
    [action2] ; \
    [action3] ;
    endef

    All shell commands are concatenated with '; \' so that it looks like
    a single command from the Makefile point of view. This does not
    exploit the benefits of 'define' ... 'endef' form because a single
    shell command can be more simply written, like this:

    rule_cc_o_c = \
    [action1] ; \
    [action2] ; \
    [action3] ;

    I guess the intention for the command concatenation was to let the
    '@set -e' in if_changed_rule cover all the commands.

    We can improve the readability by moving '@set -e' to the 'cmd' macro.
    The combo of $(call echo-cmd,*) $(cmd_*) in rule_cc_o_c and rule_as_o_S
    have been replaced with $(call cmd,*). The trailing back-slashes have
    been removed.

    Here is a note about the performance: the commands in rule_cc_o_c and
    rule_as_o_S were previously executed all together in a single subshell,
    but now each line in a separate subshell. This means Make will spawn
    extra subshells [1]. I measured the build performance for
    x86_64_defconfig + CONFIG_MODVERSIONS + CONFIG_TRIM_UNUSED_KSYMS
    and I saw slight performance regression, but I believe code readability
    and maintainability wins.

    [1] Precisely, GNU Make may optimize this by executing the command
    directly instead of forking a subshell, if no shell special
    characters are found in the command line and omitting the subshell
    will not change the behavior.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • My main motivation of this commit is to clean up scripts/Kbuild.include
    and scripts/Makefile.build.

    Currently, CONFIG_TRIM_UNUSED_KSYMS works with a tricky gimmick;
    possibly exported symbols are detected by letting $(CPP) replace
    EXPORT_SYMBOL* with a special string '=== __KSYM_*===', which is
    post-processed by sed, and passed to fixdep. The extra preprocessing
    is costly, and hacking cmd_and_fixdep is ugly.

    I came up with a new way to find exported symbols; insert a dummy
    symbol __ksym_marker_* to each potentially exported symbol. Those
    dummy symbols are picked up by $(NM), post-processed by sed, then
    appended to .*.cmd files. I collected the post-process part to a
    new shell script scripts/gen_ksymdeps.sh for readability. The dummy
    symbols are put into the .discard.* section so that the linker
    script rips them off the final vmlinux or modules.

    A nice side-effect is building with CONFIG_TRIM_UNUSED_KSYMS will
    be much faster.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Nicolas Pitre

    Masahiro Yamada
     
  • Let $(CC) compile objects into normal files *.o instead of .tmp_*.o
    whether CONFIG_MODVERSIONS is enabled or not. With this, the input
    file for objtool is always *.o so objtool_o can go away.

    I guess the reason of using .tmp_*.o for intermediate objects was
    to avoid leaving incomplete *.o file (, whose timestamp says it is
    up-to-date) when the genksyms tool failed for some reasons.

    It no longer matters because any targets are deleted on errors since
    commit 9c2af1c7377a ("kbuild: add .DELETE_ON_ERROR special target").

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • This is executed inside the if_changed_rule, which already sets
    'set -e'.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Currently, fixdep writes dependencies to .*.tmp, which is renamed to
    .*.cmd after everything succeeds. This is a very safe way to avoid
    corrupted .*.cmd files. The if_changed_dep has carried this safety
    mechanism since it was added in 2002.

    If fixdep fails for some reasons or a user terminates the build while
    fixdep is running, the incomplete output from the fixdep could be
    troublesome.

    This is my insight about some bad scenarios:

    [1] If the compiler succeeds to generate *.o file, but fixdep fails
    to write necessary dependencies to .*.cmd file, Make will miss
    to rebuild the object when headers or CONFIG options are changed.
    In this case, fixdep should not generate .*.cmd file at all so
    that 'arg-check' will surely trigger the rebuild of the object.

    [2] A partially constructed .*.cmd file may not be a syntactically
    correct makefile. The next time Make runs, it would include it,
    then fail to parse it. Once this happens, 'make clean' is be the
    only way to fix it.

    In fact, [1] is no longer a problem since commit 9c2af1c7377a ("kbuild:
    add .DELETE_ON_ERROR special target"). Make deletes a target file on
    any failure in its recipe. Because fixdep is a part of the recipe of
    *.o target, if it fails, the *.o is deleted anyway. However, I am a
    bit worried about the slight possibility of [2].

    So, here is a solution. Let fixdep directly write to a .*.cmd file,
    but allow makefiles to include it only when its corresponding target
    exists.

    This effectively reverts commit 2982c953570b ("kbuild: remove redundant
    $(wildcard ...) for cmd_files calculation"), and commit 00d78ab2ba75
    ("kbuild: remove dead code in cmd_files calculation in top Makefile")
    because now we must check the presence of targets.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

28 Nov, 2018

1 commit

  • Since retpoline capable compilers are widely available, make
    CONFIG_RETPOLINE hard depend on the compiler capability.

    Break the build when CONFIG_RETPOLINE is enabled and the compiler does not
    support it. Emit an error message in that case:

    "arch/x86/Makefile:226: *** You are building kernel with non-retpoline
    compiler, please update your compiler.. Stop."

    [dwmw: Fail the build with non-retpoline compiler]

    Suggested-by: Peter Zijlstra
    Signed-off-by: Zhenzhong Duan
    Signed-off-by: Thomas Gleixner
    Cc: David Woodhouse
    Cc: Borislav Petkov
    Cc: Daniel Borkmann
    Cc: H. Peter Anvin
    Cc: Konrad Rzeszutek Wilk
    Cc: Andy Lutomirski
    Cc: Masahiro Yamada
    Cc: Michal Marek
    Cc:
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/cca0cb20-f9e2-4094-840b-fb0f8810cd34@default

    Zhenzhong Duan
     

29 Oct, 2018

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - optimize kallsyms slightly

    - remove check for old CFLAGS usage

    - add some compiler flags unconditionally instead of evaluating
    $(call cc-option,...)

    - fix variable shadowing in host tools

    - refactor scripts/mkmakefile

    - refactor various makefiles

    * tag 'kbuild-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    modpost: Create macro to avoid variable shadowing
    ASN.1: Remove unnecessary shadowed local variable
    kbuild: use 'else ifeq' for checksrc to improve readability
    kbuild: remove unneeded link_multi_deps
    kbuild: add -Wno-unused-but-set-variable flag unconditionally
    kbuild: add -Wdeclaration-after-statement flag unconditionally
    kbuild: add -Wno-pointer-sign flag unconditionally
    modpost: remove leftover symbol prefix handling for module device table
    kbuild: simplify command line creation in scripts/mkmakefile
    kbuild: do not pass $(objtree) to scripts/mkmakefile
    kbuild: remove user ID check in scripts/mkmakefile
    kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile
    kbuild: add --include-dir flag only for out-of-tree build
    kbuild: remove dead code in cmd_files calculation in top Makefile
    kbuild: hide most of targets when running config or mixed targets
    kbuild: remove old check for CFLAGS use
    kbuild: prefix Makefile.dtbinst path with $(srctree) unconditionally
    kallsyms: remove left-over Blackfin code
    kallsyms: reduce size a little on 64-bit

    Linus Torvalds
     

19 Oct, 2018

2 commits

  • 'ifeq ... else ifeq ... endif' notation is supported by GNU Make 3.81
    or later, which is the requirement for building the kernel since
    commit 37d69ee30808 ("docs: bump minimal GNU Make version to 3.81").

    Use it to improve the readability.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Since commit c8589d1e9e01 ("kbuild: handle multi-objs dependency
    appropriately"), $^ really represents all the prerequisite of the
    composite object being built.

    Hence, $(filter %.o,$^) contains all the objects to link together,
    which is much simpler than link_multi_deps calculation.

    Please note $(filter-out FORCE,$^) does not work here. When a single
    object module is turned into a multi object module, $^ will contain
    header files that were previously included for building the single
    object, and recorded in the .*.cmd file. To filter out such headers,
    $(filter %.o,$^) should be used here.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

19 Sep, 2018

1 commit


12 Sep, 2018

1 commit


30 Aug, 2018

1 commit

  • Commit cafa0010cd51 ("Raise the minimum required gcc version to 4.6")
    bumped the minimum GCC version to 4.6 for all architectures.

    This effectively reverts commit da541b20021c ("objtool: Skip unreachable
    warnings for GCC 4.4 and older"), which was a workaround for GCC 4.4 or
    older.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Thomas Gleixner
    Acked-by: Josh Poimboeuf
    Cc: Peter Zijlstra
    Cc: Michal Marek
    Cc: linux-kbuild@vger.kernel.org
    Link: https://lkml.kernel.org/r/1535341183-19994-1-git-send-email-yamada.masahiro@socionext.com

    Masahiro Yamada
     

24 Aug, 2018

2 commits

  • Commit a0f97e06a43c ("kbuild: enable 'make CFLAGS=...' to add
    additional options to CC") renamed CFLAGS to KBUILD_CFLAGS.

    Commit 222d394d30e7 ("kbuild: enable 'make AFLAGS=...' to add
    additional options to AS") renamed AFLAGS to KBUILD_AFLAGS.

    Commit 06c5040cdb13 ("kbuild: enable 'make CPPFLAGS=...' to add
    additional options to CPP") renamed CPPFLAGS to KBUILD_CPPFLAGS.

    For some reason, LDFLAGS was not renamed.

    Using a well-known variable like LDFLAGS may result in accidental
    override of the variable.

    Kbuild generally uses KBUILD_ prefixed variables for the internally
    appended options, so here is one more conversion to sanitize the
    naming convention.

    I did not touch Makefiles under tools/ since the tools build system
    is a different world.

    Signed-off-by: Masahiro Yamada
    Acked-by: Kirill A. Shutemov
    Reviewed-by: Palmer Dabbelt

    Masahiro Yamada
     
  • Since commit 0fbe9a245c60 ("microblaze: add endianness options to
    LDFLAGS instead of LD"), you cannot build the kernel for microblaze
    with CONFIG_DYNAMIC_FTRACE.

    Fixes: 0fbe9a245c60 ("microblaze: add endianness options to LDFLAGS instead of LD")
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

21 Aug, 2018

1 commit

  • Pull tracing updates from Steven Rostedt:

    - Restructure of lockdep and latency tracers

    This is the biggest change. Joel Fernandes restructured the hooks
    from irqs and preemption disabling and enabling. He got rid of a lot
    of the preprocessor #ifdef mess that they caused.

    He turned both lockdep and the latency tracers to use trace events
    inserted in the preempt/irqs disabling paths. But unfortunately,
    these started to cause issues in corner cases. Thus, parts of the
    code was reverted back to where lockdep and the latency tracers just
    get called directly (without using the trace events). But because the
    original change cleaned up the code very nicely we kept that, as well
    as the trace events for preempt and irqs disabling, but they are
    limited to not being called in NMIs.

    - Have trace events use SRCU for "rcu idle" calls. This was required
    for the preempt/irqs off trace events. But it also had to not allow
    them to be called in NMI context. Waiting till Paul makes an NMI safe
    SRCU API.

    - New notrace SRCU API to allow trace events to use SRCU.

    - Addition of mcount-nop option support

    - SPDX headers replacing GPL templates.

    - Various other fixes and clean ups.

    - Some fixes are marked for stable, but were not fully tested before
    the merge window opened.

    * tag 'trace-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (44 commits)
    tracing: Fix SPDX format headers to use C++ style comments
    tracing: Add SPDX License format tags to tracing files
    tracing: Add SPDX License format to bpf_trace.c
    blktrace: Add SPDX License format header
    s390/ftrace: Add -mfentry and -mnop-mcount support
    tracing: Add -mcount-nop option support
    tracing: Avoid calling cc-option -mrecord-mcount for every Makefile
    tracing: Handle CC_FLAGS_FTRACE more accurately
    Uprobe: Additional argument arch_uprobe to uprobe_write_opcode()
    Uprobes: Simplify uprobe_register() body
    tracepoints: Free early tracepoints after RCU is initialized
    uprobes: Use synchronize_rcu() not synchronize_sched()
    tracing: Fix synchronizing to event changes with tracepoint_synchronize_unregister()
    ftrace: Remove unused pointer ftrace_swapper_pid
    tracing: More reverting of "tracing: Centralize preemptirq tracepoints and unify their usage"
    tracing/irqsoff: Handle preempt_count for different configs
    tracing: Partial revert of "tracing: Centralize preemptirq tracepoints and unify their usage"
    tracing: irqsoff: Account for additional preempt_disable
    trace: Use rcu_dereference_raw for hooks from trace-event subsystem
    tracing/kprobes: Fix within_notrace_func() to check only notrace functions
    ...

    Linus Torvalds
     

16 Aug, 2018

1 commit

  • Currently if CONFIG_FTRACE_MCOUNT_RECORD is enabled -mrecord-mcount
    compiler flag support is tested for every Makefile.

    Top 4 cc-option usages:
    511 -mrecord-mcount
    11 -fno-stack-protector
    9 -Wno-override-init
    2 -fsched-pressure

    To address that move cc-option from scripts/Makefile.build to top Makefile
    and export CC_USING_RECORD_MCOUNT to be used in original place.

    While doing that also add -mrecord-mcount to CC_FLAGS_FTRACE (if gcc
    actually supports it).

    Link: http://lkml.kernel.org/r/patch-2.thread-aa7b8d.git-de935bace15a.your-ad-here.call-01533557518-ext-9465@work.hours

    Acked-by: Andi Kleen
    Signed-off-by: Vasily Gorbik
    Signed-off-by: Steven Rostedt (VMware)

    Vasily Gorbik
     

09 Aug, 2018

1 commit

  • The host-progs has been kept as an alias of hostprogs-y for a long time
    (at least since the beginning of Git era), with the clear prompt:
    Usage of host-progs is deprecated. Please replace with hostprogs-y!

    Enough time for the migration has passed.

    Signed-off-by: Masahiro Yamada
    Acked-by: Max Filippov

    Masahiro Yamada
     

06 Jul, 2018

1 commit


22 Jun, 2018

1 commit

  • Non gcc-5 builds with CONFIG_STACK_VALIDATION=y and
    SKIP_STACK_VALIDATION=1 fail.
    Example output:
    /bin/sh: init/.tmp_main.o: Permission denied

    commit 96f60dfa5819 ("trace: Use -mcount-record for dynamic ftrace"),
    added a mismatched endif. This causes cmd_objtool to get mistakenly
    set.

    Relocate endif to balance the newly added -record-mcount check.

    Link: http://lkml.kernel.org/r/20180608214746.136554-1-gthelen@google.com

    Fixes: 96f60dfa5819 ("trace: Use -mcount-record for dynamic ftrace")
    Acked-by: Andi Kleen
    Tested-by: David Rientjes
    Signed-off-by: Greg Thelen
    Signed-off-by: Steven Rostedt (VMware)

    Greg Thelen
     

07 Jun, 2018

1 commit

  • Pull tracing updates from Steven Rostedt:
    "One new feature was added to ftrace, which is the trace_marker now
    supports triggers. For example:

    # cd /sys/kernel/debug/tracing
    # echo 'snapshot' > events/ftrace/print/trigger
    # echo 'cause snapshot' > trace_marker

    The rest of the changes are various clean ups and also one stable fix
    that was added late in the cycle"

    * tag 'trace-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (21 commits)
    tracing: Use match_string() instead of open coding it in trace_set_options()
    branch-check: fix long->int truncation when profiling branches
    ring-buffer: Fix typo in comment
    ring-buffer: Fix a bunch of typos in comments
    tracing/selftest: Add test to test simple snapshot trigger for trace_marker
    tracing/selftest: Add test to test hist trigger between kernel event and trace_marker
    tracing/selftest: Add selftests to test trace_marker histogram triggers
    ftrace/selftest: Fix reset_trigger() to handle triggers with filters
    ftrace/selftest: Have the reset_trigger code be a bit more careful
    tracing: Document trace_marker triggers
    tracing: Allow histogram triggers to access ftrace internal events
    tracing: Prevent further users of zero size static arrays in trace events
    tracing: Have zero size length in filter logic be full string
    tracing: Add trigger file for trace_markers tracefs/ftrace/print
    tracing: Do not show filter file for ftrace internal events
    tracing: Add brackets in ftrace event dynamic arrays
    tracing: Have event_trace_init() called by trace_init_tracefs()
    tracing: Add __find_event_file() to find event files without restrictions
    tracing: Do not reference event data in post call triggers
    tracepoints: Fix the descriptions of tracepoint_probe_register{_prio}
    ...

    Linus Torvalds
     

29 May, 2018

1 commit

  • gcc 5 supports a new -mcount-record option to generate ftrace
    tables directly. This avoids the need to run record_mcount
    manually.

    Use this option when available.

    So far doesn't use -mcount-nop, which also exists now.

    This is needed to make ftrace work with LTO because the
    normal record-mcount script doesn't run over the link
    time output.

    It should also improve build times slightly in the general
    case.
    Link: http://lkml.kernel.org/r/20171127213423.27218-12-andi@firstfloor.org

    Signed-off-by: Andi Kleen
    Signed-off-by: Steven Rostedt (VMware)

    Andi Kleen