30 Sep, 2018

1 commit


24 Sep, 2018

1 commit


17 Sep, 2018

2 commits


13 Sep, 2018

1 commit

  • As a Kernel developer, I make heavy use of "make targz-pkg" in order
    to locally compile and remotely install my development Kernels. The
    nice feature I rely on is that after a normal "make", "make targz-pkg"
    only generates the tarball without having to recompile everything.

    That was true until commit f28bc3c32c05 ("tracing: Handle
    CC_FLAGS_FTRACE more accurately"). After it, running "make targz-pkg"
    after "make" will recompile the whole Kernel tree, making my
    development workflow much slower.

    The Kernel is choosing to recompile everything because it claims the
    command line has changed. A diff of the .cmd files show a repeated
    -mfentry in one of the files. That is because "make targz-pkg" calls
    "make modules_install" and the environment is already populated with
    the exported variables, CC_FLAGS_FTRACE being one of them. Then,
    -mfentry gets duplicated because it is not protected behind an ifndef
    block, like -pg.

    To complicate the problem a little bit more, architectures can define
    their own version CC_FLAGS_FTRACE, so our code not only has to
    consider recursive Makefiles, but also architecture overrides.

    So in this patch we move CC_FLAGS_FTRACE up and unconditionally
    define it to -pg. Then we let the architecture Makefiles possibly
    override it, and finally append the extra options later. This ensures
    the variable is always fully redefined at each invocation so recursive
    Makefiles don't keep appending, and hopefully it maintains the
    intended behavior on how architectures can override the defaults..

    Thanks Steven Rostedt and Vasily Gorbik for the help on this
    regression.

    Cc: Michal Marek
    Cc: Ingo Molnar
    Cc: Tvrtko Ursulin
    Cc: linux-kbuild@vger.kernel.org
    Fixes: commit f28bc3c32c05 ("tracing: Handle CC_FLAGS_FTRACE more accurately")
    Acked-by: Vasily Gorbik
    Signed-off-by: Paulo Zanoni
    Signed-off-by: Steven Rostedt (VMware)

    Paulo Zanoni
     

10 Sep, 2018

1 commit


05 Sep, 2018

1 commit

  • If the kernel headers aren't installed we can't build all the tests.
    Add a new make target rule 'khdr' in the file lib.mk to generate the
    kernel headers and that gets include for every test-dir Makefile that
    includes lib.mk If the testdir in turn have its own sub-dirs the
    top_srcdir needs to be set to the linux-rootdir to be able to generate
    the kernel headers.

    Signed-off-by: Anders Roxell
    Reviewed-by: Fathi Boudra
    Signed-off-by: Shuah Khan (Samsung OSG)

    Anders Roxell
     

03 Sep, 2018

1 commit


31 Aug, 2018

1 commit


27 Aug, 2018

2 commits

  • Linus Torvalds
     
  • Pull x86 fixes from Thomas Gleixner:

    - Correct the L1TF fallout on 32bit and the off by one in the 'too much
    RAM for protection' calculation.

    - Add a helpful kernel message for the 'too much RAM' case

    - Unbreak the VDSO in case that the compiler desides to use indirect
    jumps/calls and emits retpolines which cannot be resolved because the
    kernel uses its own thunks, which does not work for the VDSO. Make it
    use the builtin thunks.

    - Re-export start_thread() which was unexported when the 32/64bit
    implementation was unified. start_thread() is required by modular
    binfmt handlers.

    - Trivial cleanups

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/speculation/l1tf: Suggest what to do on systems with too much RAM
    x86/speculation/l1tf: Fix off-by-one error when warning that system has too much RAM
    x86/kvm/vmx: Remove duplicate l1d flush definitions
    x86/speculation/l1tf: Fix overflow in l1tf_pfn_limit() on 32bit
    x86/process: Re-export start_thread()
    x86/mce: Add notifier_block forward declaration
    x86/vdso: Fix vDSO build if a retpoline is emitted

    Linus Torvalds
     

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
     
  • This config option should be enabled only when both the compiler and
    the linker support necessary flags. Add proper dependencies to Kconfig.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

22 Aug, 2018

1 commit


21 Aug, 2018

2 commits

  • 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
     
  • Currently, if the vDSO ends up containing an indirect branch or
    call, GCC will emit the "external thunk" style of retpoline, and it
    will fail to link.

    Fix it by building the vDSO with inline retpoline thunks.

    I haven't seen any reports of this triggering on an unpatched
    kernel.

    Fixes: commit 76b043848fd2 ("x86/retpoline: Add initial retpoline support")
    Signed-off-by: Andy Lutomirski
    Signed-off-by: Thomas Gleixner
    Acked-by: Matt Rickard
    Cc: Borislav Petkov
    Cc: Jason Vas Dias
    Cc: David Woodhouse
    Cc: Peter Zijlstra
    Cc: Andi Kleen
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/c76538cd3afbe19c6246c2d1715bc6a60bd63985.1534448381.git.luto@kernel.org

    Andy Lutomirski
     

16 Aug, 2018

5 commits

  • -mcount-nop gcc option generates the calls to the profiling functions
    as nops which allows to avoid patching mcount jump with NOP instructions
    initially.

    -mcount-nop gcc option will be activated if platform selects
    HAVE_NOP_MCOUNT and gcc actually supports it.
    In addition to that CC_USING_NOP_MCOUNT is defined and could be used by
    architectures to adapt ftrace patching behavior.

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

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

    Vasily Gorbik
     
  • 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
     
  • CC_FLAGS_FTRACE is exported and later used to remove ftrace relevant
    build flags from files which should be built without ftrace support.
    For that reason add -mfentry to CC_FLAGS_FTRACE as well. That fixes
    a problem with vdso32 build on s390, where -mfentry could not be used
    together with -m31 flag.

    At the same time flags like -pg and -mfentry are not relevant for asm
    files, so avoid adding them to KBUILD_AFLAGS.

    Introduce CC_FLAGS_USING instead of CC_USING_FENTRY to collect
    -DCC_USING_FENTRY (and future alike) which are relevant for both
    KBUILD_CFLAGS and KBUILD_AFLAGS.

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

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

    Vasily Gorbik
     
  • Pull Kconfig updates from Masahiro Yamada:

    - show clearer error messages where pkg-config is needed, but not
    installed

    - rename SYMBOL_AUTO to SYMBOL_NO_WRITE to reflect its semantics

    - create all necessary directories by Kconfig tool itself instead of
    Makefile

    - update the .config unconditionally when syncconfig is invoked

    - use 'include' directive instead of '-include' where
    include/config/{auto,tristate}.conf is mandatory

    - do not try to update the .config when running install targets

    - add .DELETE_ON_ERROR to delete partially updated files

    - misc cleanups and fixes

    * tag 'kconfig-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kconfig: remove P_ENV property type
    kconfig: remove unused sym_get_env_prop() function
    kconfig: fix the rule of mainmenu_stmt symbol
    init/Kconfig: Use short unix-style option instead of --longname
    Kbuild: Makefile.modbuiltin: include auto.conf and tristate.conf mandatory
    kbuild: remove auto.conf from prerequisite of phony targets
    kbuild: do not update config for 'make kernelrelease'
    kbuild: do not update config when running install targets
    kbuild: add .DELETE_ON_ERROR special target
    kbuild: use 'include' directive to load auto.conf from top Makefile
    kconfig: allow all config targets to write auto.conf if missing
    kconfig: make syncconfig update .config regardless of sym_change_count
    kconfig: create directories needed for syncconfig by itself
    kconfig: remove unneeded directory generation from local*config
    kconfig: split out useful helpers in confdata.c
    kconfig: rename file_write_dep and move it to confdata.c
    kconfig: fix typos in description of "choice" in kconfig-language.txt
    kconfig: handle format string before calling conf_message_callback()
    kconfig: rename SYMBOL_AUTO to SYMBOL_NO_WRITE
    kconfig: check for pkg-config on make {menu,n,g,x}config

    Linus Torvalds
     
  • Pull Kbuild updates from Masahiro Yamada:

    - verify depmod is installed before modules_install

    - support build salt in case build ids must be unique between builds

    - allow users to specify additional host compiler flags via HOST*FLAGS,
    and rename internal variables to KBUILD_HOST*FLAGS

    - update buildtar script to drop vax support, add arm64 support

    - update builddeb script for better debarch support

    - document the pit-fall of if_changed usage

    - fix parallel build of UML with O= option

    - make 'samples' target depend on headers_install to fix build errors

    - remove deprecated host-progs variable

    - add a new coccinelle script for refcount_t vs atomic_t check

    - improve double-test coccinelle script

    - misc cleanups and fixes

    * tag 'kbuild-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (41 commits)
    coccicheck: return proper error code on fail
    Coccinelle: doubletest: reduce side effect false positives
    kbuild: remove deprecated host-progs variable
    kbuild: make samples really depend on headers_install
    um: clean up archheaders recipe
    kbuild: add %asm-generic to no-dot-config-targets
    um: fix parallel building with O= option
    scripts: Add Python 3 support to tracing/draw_functrace.py
    builddeb: Add automatic support for sh{3,4}{,eb} architectures
    builddeb: Add automatic support for riscv* architectures
    builddeb: Add automatic support for m68k architecture
    builddeb: Add automatic support for or1k architecture
    builddeb: Add automatic support for sparc64 architecture
    builddeb: Add automatic support for mips{,64}r6{,el} architectures
    builddeb: Add automatic support for mips64el architecture
    builddeb: Add automatic support for ppc64 and powerpcspe architectures
    builddeb: Introduce functions to simplify kconfig tests in set_debarch
    builddeb: Drop check for 32-bit s390
    builddeb: Change architecture detection fallback to use dpkg-architecture
    builddeb: Skip architecture detection when KBUILD_DEBARCH is set
    ...

    Linus Torvalds
     

13 Aug, 2018

1 commit


09 Aug, 2018

1 commit

  • Kernel headers must be installed into $(objtree)/usr/include to avoid
    the build failure of samples.

    Commit ddea05fa148b ("kbuild: make samples depend on headers_install")
    addressed this, but "samples/" is only used for the single target build.

    "make samples/" properly installs kernel headers, but it does not work
    for general building because a phony target "sample" (no trailing slash)
    is used.

    Reported-by: David Howells
    Signed-off-by: Masahiro Yamada
    Tested-by: David Howells

    Masahiro Yamada
     

07 Aug, 2018

1 commit


06 Aug, 2018

1 commit


30 Jul, 2018

1 commit


28 Jul, 2018

1 commit


25 Jul, 2018

4 commits

  • The top-level Makefile adds include/config/auto.conf as
    prerequisites of 'scripts', 'prepare1', etc.

    They were needed to terminate the build when include/config/auto.conf
    is missing.

    Now that the inclusion of include/config/auto.conf is mandatory
    in the top-level Makefile if dot-config is 1 (Note 'include' directive
    is used instead of '-include').

    Make terminates the build by itself if it fails to create or update
    include/config/auto.conf so we are sure that include/config/auto.conf
    exists in the very first stage of make.

    I am still keeping include/config/auto.conf as the prerequisite of
    %/modules.builtin because modules.builtin is a real file. According
    to commit a6c366324cac ("kbuild: Do not unnecessarily regenerate
    modules.builtin"), it is intentional to compare time-stamps between
    %/modules.builtin and include/config/auto.conf . I moved tristate.conf
    here because it is only included from scripts/Makefile.modbuiltin.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • 'make kernelrelease' depends on CONFIG_LOCALVERSION(_AUTO), but
    for the same reason as install targets, we do not want to update
    the configuration just for printing the kernelrelease string.

    This is likely to happen when you compiled the kernel with
    CROSS_COMPILE, but forget to pass it to 'make kernelrelease'.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • "make syncconfig" is automatically invoked when any of the following
    happens:

    - .config is updated
    - any of Kconfig files is updated
    - any of environment variables referenced in Kconfig is changed

    Then, it updates configuration files such as include/config/auto.conf
    include/generated/autoconf.h, etc.

    Even install targets (install, modules_install, etc.) are no exception.
    However, they should never ever modify the source tree. Install
    targets are often run with root privileges. Once those configuration
    files are owned by root, "make mrproper" would end up with permission
    error.

    Install targets should just copy things blindly. They should not care
    whether the configuration is up-to-date or not. This makes more sense
    because we are interested in the configuration that was used in the
    previous kernel building.

    This issue has existed since before, but rarely happened. I expect
    more chance where people are hit by this; with the new Kconfig syntax
    extension, the .config now contains the compiler information. If you
    cross-compile the kernel with CROSS_COMPILE, but forget to pass it
    for "make install", you meet "any of environment variables referenced
    in Kconfig is changed" because $(CC) is referenced in Kconfig.
    Another scenario is the compiler upgrade before the installation.

    Install targets need the configuration. "make modules_install" refer
    to CONFIG_MODULES etc. "make dtbs_install" also needs CONFIG_ARCH_*
    to decide which dtb files to install. However, the auto-update of
    the configuration files should be avoided. We already do this for
    external modules.

    Now, Make targets are categorized into 3 groups:

    [1] Do not need the kernel configuration at all

    help, coccicheck, headers_install etc.

    [2] Need the latest kernel configuration

    If new config options are added, Kconfig will show prompt to
    ask user's selection.

    Build targets such as vmlinux, in-kernel modules are the cases.

    [3] Need the kernel configuration, but do not want to update it

    Install targets except headers_install, and external modules
    are the cases.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • When you build targets that require the kernel configuration, dot-config
    is set to 1, then the top-level Makefile includes auto.conf. However,
    Make considers its inclusion is optional because the '-include' directive
    is used here.

    If a necessary configuration file is missing for the external module
    building, the following error message is displayed:

    ERROR: Kernel configuration is invalid.
    include/generated/autoconf.h or include/config/auto.conf are missing.
    Run 'make oldconfig && make prepare' on kernel src to fix it.

    However, Make still continues building; /bin/false let the creation of
    'include/config/auto.config' fail, but Make can ignore the error since
    it is included by the '-include' directive.

    I guess the reason of using '-include' directive was to suppress
    the warning when you build the kernel from a pristine source tree:

    Makefile:605: include/config/auto.conf: No such file or directory

    The previous commit made sure include/config/auto.conf exists after
    the 'make *config' stage. Now, we can use the 'include' directive
    without showing the warning.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

23 Jul, 2018

1 commit


18 Jul, 2018

5 commits


16 Jul, 2018

1 commit


14 Jul, 2018

1 commit

  • …t/masahiroy/linux-kbuild

    Pull Kbuild fixes from Masahiro Yamada:

    - update Kbuild and Kconfig documents

    - sanitize -I compiler option handling

    - update extract-vmlinux script to recognize LZ4 and ZSTD

    - fix tools Makefiles

    - update tags.sh to handle __ro_after_init

    - suppress warnings in case getconf does not recognize LFS_* parameters

    * tag 'kbuild-fixes-v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kbuild: suppress warnings from 'getconf LFS_*'
    scripts/tags.sh: add __ro_after_init
    tools: build: Use HOSTLDFLAGS with fixdep
    tools: build: Fixup host c flags
    tools build: fix # escaping in .cmd files for future Make
    scripts: teach extract-vmlinux about LZ4 and ZSTD
    kbuild: remove duplicated comments about PHONY
    kbuild: .PHONY is not a variable, but PHONY is
    kbuild: do not drop -I without parameter
    kbuild: document the KBUILD_KCONFIG env. variable
    kconfig: update user kconfig tools doc.
    kbuild: delete INSTALL_FW_PATH from kbuild documentation
    kbuild: update ARCH alias info for sparc
    kbuild: update ARCH alias info for sh

    Linus Torvalds
     

12 Jul, 2018

1 commit

  • Suppress warnings for systems that do not recognize LFS_*.

    getconf: no such configuration parameter `LFS_CFLAGS'
    getconf: no such configuration parameter `LFS_LDFLAGS'
    getconf: no such configuration parameter `LFS_LIBS'

    Fixes: d7f14c66c273 ("kbuild: Enable Large File Support for hostprogs")
    Reported-by: Chen Feng
    Signed-off-by: Masahiro Yamada
    Acked-by: Uwe Kleine-König

    Masahiro Yamada