1. 30 12月, 2022 4 次提交
  2. 29 12月, 2022 1 次提交
  3. 17 12月, 2022 1 次提交
  4. 14 12月, 2022 6 次提交
  5. 13 12月, 2022 6 次提交
    • M
      kbuild: use .NOTINTERMEDIATE for future GNU Make versions · 875ef1a5
      Masahiro Yamada 提交于
      In Kbuild, some files are generated by chains of pattern/implicit rules.
      For example, *.dtb.o files in drivers/of/unittest-data/Makefile are
      generated by the chain of 3 pattern rules, like this:
      
        %.dts  ->  %.dtb  ->  %.dtb.S  ->  %.dtb.o
      
      Here, %.dts is the real source, %.dtb.o is the final target.
      %.dtb and %.dtb.S are called "intermediate files".
      
      As GNU Make manual [1] says, intermediate files are treated differently
      in two ways:
      
       (a) The first difference is what happens if the intermediate file does
         not exist. If an ordinary file 'b' does not exist, and make considers
         a target that depends on 'b', it invariably creates 'b' and then
         updates the target from 'b'. But if 'b' is an intermediate file, then
         make can leave well enough alone: it won't create 'b' unless one of
         its prerequisites is out of date. This means the target depending
         on 'b' won't be rebuilt either, unless there is some other reason
         to update that target: for example the target doesn't exist or a
         different prerequisite is newer than the target.
      
       (b) The second difference is that if make does create 'b' in order to
         update something else, it deletes 'b' later on after it is no longer
         needed. Therefore, an intermediate file which did not exist before
         make also does not exist after make. make reports the deletion to
         you by printing a 'rm' command showing which file it is deleting.
      
      The combination of these is problematic for Kbuild because most of the
      build rules depend on FORCE and the if_changed* macros really determine
      if the target should be updated. So, all missing files, whether they
      are intermediate or not, are always rebuilt.
      
      To see the problem, delete ".SECONDARY:" from scripts/Kbuild.include,
      and repeat this command:
      
        $ make allmodconfig drivers/of/unittest-data/
      
      The intermediate files will be deleted, which results in rebuilding
      intermediate and final objects in the next run of make.
      
      In the old days, people suppressed (b) in inconsistent ways.
      As commit 54a702f7 ("kbuild: mark $(targets) as .SECONDARY and
      remove .PRECIOUS markers") noted, you should not use .PRECIOUS because
      .PRECIOUS has the following behavior (c), which is not likely what you
      want.
      
       (c) If make is killed or interrupted during the execution of their
         recipes, the target is not deleted. Also, the target is not deleted
         on error even if .DELETE_ON_ERROR is specified.
      
      .SECONDARY is a much better way to disable (b), but a small problem
      is that .SECONDARY enables (a), which gives a side-effect to $?;
      prerequisites marked as .SECONDARY do not appear in $?. This is a
      drawback for Kbuild.
      
      I thought it was a bug and opened a bug report. As Paul, the GNU Make
      maintainer, concluded in [2], this is not a bug.
      
      A good news is that, GNU Make 4.4 added the perfect solution,
      .NOTINTERMEDIATE, which cancels both (a) and (b).
      
      For clarificaton, my understanding of .INTERMEDIATE, .SECONDARY,
      .PRECIOUS and .NOTINTERMEDIATE are as follows:
      
                              (a)         (b)         (c)
        .INTERMEDIATE        enable      enable      disable
        .SECONDARY           enable      disable     disable
        .PRECIOUS            disable     disable     enable
        .NOTINTERMEDIATE     disable     disable     disable
      
      However, GNU Make 4.4 has a bug for the global .NOTINTERMEDIATE. [3]
      It was fixed by commit 6164608900ad ("[SV 63417] Ensure global
      .NOTINTERMEDIATE disables all intermediates"), and will be available
      in the next release of GNU Make.
      
      The following is the gain for .NOTINTERMEDIATE:
      
        [Current Make]
      
            $ make allnoconfig vmlinux
                [ full build ]
            $ rm include/linux/device.h
            $ make vmlinux
              CALL    scripts/checksyscalls.sh
      
        Make does not notice the removal of <linux/device.h>.
      
        [Future Make]
      
            $ make-latest allnoconfig vmlinux
                [ full build ]
            $ rm include/linux/device.h
            $ make-latest vmlinux
              CC      arch/x86/kernel/asm-offsets.s
            In file included from ./include/linux/writeback.h:13,
                             from ./include/linux/memcontrol.h:22,
                             from ./include/linux/swap.h:9,
                             from ./include/linux/suspend.h:5,
                             from arch/x86/kernel/asm-offsets.c:13:
            ./include/linux/blk_types.h:11:10: fatal error: linux/device.h: No such file or directory
               11 | #include <linux/device.h>
                  |          ^~~~~~~~~~~~~~~~
            compilation terminated.
            make-latest[1]: *** [scripts/Makefile.build:114: arch/x86/kernel/asm-offsets.s] Error 1
            make-latest: *** [Makefile:1282: prepare0] Error 2
      
        Make notices the removal of <linux/device.h>, and rebuilds objects
        that depended on <linux/device.h>. There exists a source file that
        includes <linux/device.h>, and it raises an error.
      
      To see detailed background information, refer to commit 2d3b1b8f
      ("kbuild: drop $(wildcard $^) check in if_changed* for faster rebuild").
      
      [1]: https://www.gnu.org/software/make/manual/make.html#Chained-Rules
      [2]: https://savannah.gnu.org/bugs/?55532
      [3]: https://savannah.gnu.org/bugs/?63417Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      875ef1a5
    • M
      kconfig: refactor Makefile to reduce process forks · 3122c844
      Masahiro Yamada 提交于
      Refactor Makefile and use read-file macro. For Make >= 4.2, it can read
      out a file by using the built-in function.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
      3122c844
    • M
      kbuild: add read-file macro · 6768fa4b
      Masahiro Yamada 提交于
      Since GNU Make 4.2, $(file ...) supports the read operater '<', which
      is useful to read a file without forking a new process. No warning is
      shown even if the input file is missing.
      
      For older Make versions, it falls back to the cat command.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
      Reviewed-by: NAlexander Lobakin <alexandr.lobakin@intel.com>
      Tested-by: NAlexander Lobakin <alexandr.lobakin@intel.com>
      6768fa4b
    • M
      kbuild: do not sort after reading modules.order · a5db80c6
      Masahiro Yamada 提交于
      modules.order lists modules in the deterministic order (that is why
      "modules order"), and there is no duplication in the list.
      
      $(sort ) is pointless.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
      a5db80c6
    • M
      kbuild: add test-{ge,gt,le,lt} macros · fccb3d3e
      Masahiro Yamada 提交于
      GNU Make 4.4 introduced $(intcmp ...), which is useful to compare two
      integers without forking a new process.
      
      Add test-{ge,gt,le,lt} macros, which work more efficiently with GNU
      Make >= 4.4. For older Make versions, they fall back to the 'test'
      shell command.
      
      The first two parameters to $(intcmp ...) must not be empty. To avoid
      the syntax error, I appended '0' to them. Fortunately, '00' is treated
      as '0'. This is needed because CONFIG options may expand to an empty
      string when the kernel configuration is not included.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: Palmer Dabbelt <palmer@rivosinc.com> # RISC-V
      Reviewed-by: NNathan Chancellor <nathan@kernel.org>
      Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
      fccb3d3e
    • M
      Documentation: raise minimum supported version of binutils to 2.25 · e4412739
      Masahiro Yamada 提交于
      Binutils 2.23 was released in 2012. Almost 10 years old.
      
      We already require GCC 5.1, released in 2015.
      
      Bump the binutils version to 2.25, which was released some months
      before GCC 5.1.
      
      With this applied, some subsystems can start to clean up code.
      Examples:
        arch/arm/Kconfig.assembler
        arch/mips/vdso/Kconfig
        arch/powerpc/Makefile
        arch/x86/Kconfig.assembler
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      e4412739
  6. 11 12月, 2022 1 次提交
  7. 09 12月, 2022 1 次提交
    • K
      bpf: Rework process_dynptr_func · 27060531
      Kumar Kartikeya Dwivedi 提交于
      Recently, user ringbuf support introduced a PTR_TO_DYNPTR register type
      for use in callback state, because in case of user ringbuf helpers,
      there is no dynptr on the stack that is passed into the callback. To
      reflect such a state, a special register type was created.
      
      However, some checks have been bypassed incorrectly during the addition
      of this feature. First, for arg_type with MEM_UNINIT flag which
      initialize a dynptr, they must be rejected for such register type.
      Secondly, in the future, there are plans to add dynptr helpers that
      operate on the dynptr itself and may change its offset and other
      properties.
      
      In all of these cases, PTR_TO_DYNPTR shouldn't be allowed to be passed
      to such helpers, however the current code simply returns 0.
      
      The rejection for helpers that release the dynptr is already handled.
      
      For fixing this, we take a step back and rework existing code in a way
      that will allow fitting in all classes of helpers and have a coherent
      model for dealing with the variety of use cases in which dynptr is used.
      
      First, for ARG_PTR_TO_DYNPTR, it can either be set alone or together
      with a DYNPTR_TYPE_* constant that denotes the only type it accepts.
      
      Next, helpers which initialize a dynptr use MEM_UNINIT to indicate this
      fact. To make the distinction clear, use MEM_RDONLY flag to indicate
      that the helper only operates on the memory pointed to by the dynptr,
      not the dynptr itself. In C parlance, it would be equivalent to taking
      the dynptr as a point to const argument.
      
      When either of these flags are not present, the helper is allowed to
      mutate both the dynptr itself and also the memory it points to.
      Currently, the read only status of the memory is not tracked in the
      dynptr, but it would be trivial to add this support inside dynptr state
      of the register.
      
      With these changes and renaming PTR_TO_DYNPTR to CONST_PTR_TO_DYNPTR to
      better reflect its usage, it can no longer be passed to helpers that
      initialize a dynptr, i.e. bpf_dynptr_from_mem, bpf_ringbuf_reserve_dynptr.
      
      A note to reviewers is that in code that does mark_stack_slots_dynptr,
      and unmark_stack_slots_dynptr, we implicitly rely on the fact that
      PTR_TO_STACK reg is the only case that can reach that code path, as one
      cannot pass CONST_PTR_TO_DYNPTR to helpers that don't set MEM_RDONLY. In
      both cases such helpers won't be setting that flag.
      
      The next patch will add a couple of selftest cases to make sure this
      doesn't break.
      
      Fixes: 20571567 ("bpf: Add bpf_user_ringbuf_drain() helper")
      Acked-by: NJoanne Koong <joannelkoong@gmail.com>
      Signed-off-by: NKumar Kartikeya Dwivedi <memxor@gmail.com>
      Link: https://lore.kernel.org/r/20221207204141.308952-4-memxor@gmail.comSigned-off-by: NAlexei Starovoitov <ast@kernel.org>
      27060531
  8. 04 12月, 2022 1 次提交
    • G
      rust: add `build_error` crate · ecaa6ddf
      Gary Guo 提交于
      The `build_error` crate provides a function `build_error` which
      will panic at compile-time if executed in const context and,
      by default, will cause a build error if not executed at compile
      time and the optimizer does not optimise away the call.
      
      The `CONFIG_RUST_BUILD_ASSERT_ALLOW` kernel option allows to
      relax the default build failure and convert it to a runtime
      check. If the runtime check fails, `panic!` will be called.
      
      Its functionality will be exposed to users as a couple macros in
      the `kernel` crate in the following patch, thus some documentation
      here refers to them for simplicity.
      Signed-off-by: NGary Guo <gary@garyguo.net>
      Reviewed-by: NWei Liu <wei.liu@kernel.org>
      [Reworded, adapted for upstream and applied latest changes]
      Signed-off-by: NMiguel Ojeda <ojeda@kernel.org>
      ecaa6ddf
  9. 01 12月, 2022 1 次提交
  10. 30 11月, 2022 1 次提交
  11. 27 11月, 2022 1 次提交
  12. 24 11月, 2022 2 次提交
  13. 23 11月, 2022 1 次提交
  14. 22 11月, 2022 2 次提交
    • M
      kbuild: warn objects shared among multiple modules · 598afa05
      Masahiro Yamada 提交于
      If an object is shared among multiple modules, and some of them are
      configured as 'm', but the others as 'y', the shared object is built
      as modular, then linked to the modules and vmlinux. This is a potential
      issue because the expected CFLAGS are different between modules and
      builtins.
      
      Commit 637a642f ("zstd: Fixing mixed module-builtin objects")
      reported that this could be even more fatal in some cases such as
      Clang LTO.
      
      That commit fixed lib/zlib/zstd_{compress,decompress}, but there are
      still more instances of breakage.
      
      This commit adds a W=1 warning for shared objects, so that the kbuild
      test robot, which provides build tests with W=1, will avoid a new
      breakage slipping in.
      
      Quick compile tests on v6.1-rc4 detected the following:
      
      scripts/Makefile.build:252: ./drivers/block/rnbd/Makefile: rnbd-common.o is added to multiple modules: rnbd-client rnbd-server
      scripts/Makefile.build:252: ./drivers/crypto/marvell/octeontx2/Makefile: cn10k_cpt.o is added to multiple modules: rvu_cptpf rvu_cptvf
      scripts/Makefile.build:252: ./drivers/crypto/marvell/octeontx2/Makefile: otx2_cptlf.o is added to multiple modules: rvu_cptpf rvu_cptvf
      scripts/Makefile.build:252: ./drivers/crypto/marvell/octeontx2/Makefile: otx2_cpt_mbox_common.o is added to multiple modules: rvu_cptpf rvu_cptvf
      scripts/Makefile.build:252: ./drivers/edac/Makefile: skx_common.o is added to multiple modules: i10nm_edac skx_edac
      scripts/Makefile.build:252: ./drivers/gpu/drm/bridge/imx/Makefile: imx-ldb-helper.o is added to multiple modules: imx8qm-ldb imx8qxp-ldb
      scripts/Makefile.build:252: ./drivers/mfd/Makefile: rsmu_core.o is added to multiple modules: rsmu-i2c rsmu-spi
      scripts/Makefile.build:252: ./drivers/mtd/tests/Makefile: mtd_test.o is added to multiple modules: mtd_nandbiterrs mtd_oobtest mtd_pagetest mtd_readtest mtd_speedtest mtd_stresstest mtd_subpagetest mtd_torturetest
      scripts/Makefile.build:252: ./drivers/net/dsa/ocelot/Makefile: felix.o is added to multiple modules: mscc_felix mscc_seville
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: cn23xx_pf_device.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: cn23xx_vf_device.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: cn66xx_device.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: cn68xx_device.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: lio_core.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: lio_ethtool.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: octeon_device.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: octeon_droq.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: octeon_mailbox.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: octeon_mem_ops.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: octeon_nic.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: request_manager.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: response_manager.o is added to multiple modules: liquidio liquidio_vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/freescale/dpaa2/Makefile: dpaa2-mac.o is added to multiple modules: fsl-dpaa2-eth fsl-dpaa2-switch
      scripts/Makefile.build:252: ./drivers/net/ethernet/freescale/dpaa2/Makefile: dpmac.o is added to multiple modules: fsl-dpaa2-eth fsl-dpaa2-switch
      scripts/Makefile.build:252: ./drivers/net/ethernet/freescale/enetc/Makefile: enetc_cbdr.o is added to multiple modules: fsl-enetc fsl-enetc-vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/freescale/enetc/Makefile: enetc_ethtool.o is added to multiple modules: fsl-enetc fsl-enetc-vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/freescale/enetc/Makefile: enetc.o is added to multiple modules: fsl-enetc fsl-enetc-vf
      scripts/Makefile.build:252: ./drivers/net/ethernet/hisilicon/hns3/Makefile: hns3_common/hclge_comm_cmd.o is added to multiple modules: hclge hclgevf
      scripts/Makefile.build:252: ./drivers/net/ethernet/hisilicon/hns3/Makefile: hns3_common/hclge_comm_rss.o is added to multiple modules: hclge hclgevf
      scripts/Makefile.build:252: ./drivers/net/ethernet/hisilicon/hns3/Makefile: hns3_common/hclge_comm_tqp_stats.o is added to multiple modules: hclge hclgevf
      scripts/Makefile.build:252: ./drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_dcbnl.o is added to multiple modules: rvu_nicpf rvu_nicvf
      scripts/Makefile.build:252: ./drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_devlink.o is added to multiple modules: rvu_nicpf rvu_nicvf
      scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: cpsw_ale.o is added to multiple modules: keystone_netcp keystone_netcp_ethss ti_cpsw ti_cpsw_new
      scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: cpsw_ethtool.o is added to multiple modules: ti_cpsw ti_cpsw_new
      scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: cpsw_priv.o is added to multiple modules: ti_cpsw ti_cpsw_new
      scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: cpsw_sl.o is added to multiple modules: ti_cpsw ti_cpsw_new
      scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: davinci_cpdma.o is added to multiple modules: ti_cpsw ti_cpsw_new ti_davinci_emac
      scripts/Makefile.build:252: ./drivers/platform/x86/intel/int3472/Makefile: common.o is added to multiple modules: intel_skl_int3472_discrete intel_skl_int3472_tps68470
      scripts/Makefile.build:252: ./sound/soc/codecs/Makefile: wcd-clsh-v2.o is added to multiple modules: snd-soc-wcd9335 snd-soc-wcd934x snd-soc-wcd938x
      
      Once all the warnings are fixed, it can become an error without the
      W= option.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NAlexander Lobakin <alobakin@pm.me>
      Tested-by: NAlexander Lobakin <alobakin@pm.me>
      Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
      598afa05
    • M
      kbuild: add kbuild-file macro · a2430b25
      Masahiro Yamada 提交于
      While building, installing, cleaning, Kbuild visits sub-directories
      and includes 'Kbuild' or 'Makefile' that exists there.
      
      Add 'kbuild-file' macro, and reuse it from scripts/Makefie.*
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
      Reviewed-by: NAlexander Lobakin <alobakin@pm.me>
      Tested-by: NAlexander Lobakin <alobakin@pm.me>
      a2430b25
  15. 21 11月, 2022 8 次提交
  16. 19 11月, 2022 3 次提交