1. 28 Sep, 2022 9 commits
    • Masahiro Yamada's avatar
      kbuild: move 'PHONY += modules_prepare' to the common part · 7f371813
      Masahiro Yamada authored
      Unify the code between in-tree builds and external module builds.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      7f371813
    • Masahiro Yamada's avatar
      kbuild: refactor single builds of *.ko · f110e5a2
      Masahiro Yamada authored
      Remove the potentially invalid modules.order instead of using
      the temporary file.
      
      Also, KBUILD_MODULES is don't care for single builds. No need to
      cancel it.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      f110e5a2
    • Masahiro Yamada's avatar
      kbuild: remove duplicated dependency between modules and modules_check · f75a0334
      Masahiro Yamada authored
      The dependency, "modules: modules_check" is specified twice.
      Commit 1a998be6 ("kbuild: check module name conflict for external
      modules as well") missed to clean it up.
      
      'PHONY += modules' also appears twice.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      f75a0334
    • Masahiro Yamada's avatar
      nios2: move core-y in arch/nios2/Makefile to arch/nios2/Kbuild · e30d4487
      Masahiro Yamada authored
      Use obj-y to clean up Makefile.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      e30d4487
    • Masahiro Yamada's avatar
      kbuild: do not deduplicate modules.order · d724b578
      Masahiro Yamada authored
      The AWK code was added to deduplicate modules.order in case $(obj-m)
      contains the same module multiple times, but it is actually unneeded
      since commit b2c88554 ("kbuild: update modules.order only when
      contained modules are updated").
      
      The list is already deduplicated before being processed by AWK because
      $^ is the deduplicated list of prerequisites.
      (Please note the real-prereqs macro uses $^)
      
      Yet, modules.order will contain duplication if two different Makefiles
      build the same module:
      
        foo/Makefile:
      
            obj-m += bar/baz.o
      
        foo/bar/Makefile:
      
            obj-m += baz.o
      
      However, the parallel builds cannot properly handle this case in the
      first place. So, it is better to let it fail (as already done by
      scripts/modules-check.sh).
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      d724b578
    • Masahiro Yamada's avatar
      kbuild: check sha1sum just once for each atomic header · b10fdeea
      Masahiro Yamada authored
      It is unneeded to check the sha1sum every time.
      
      Create the timestamp files to manage it.
      
      Add '.' to clean-dirs because 'make clean' must visit ./Kbuild to
      clean up the timestamp files.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      b10fdeea
    • Masahiro Yamada's avatar
      kbuild: hard-code KBUILD_ALLDIRS in scripts/Makefile.package · a3c4d4ab
      Masahiro Yamada authored
      My future plan is to list subdirectories in ./Kbuild. When it occurs,
      $(vmlinux-alldirs) will not contain all subdirectories.
      
      Let's hard-code the directory list until I get around to implementing
      a more sophisticated way for generating a source tarball.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      a3c4d4ab
    • Masahiro Yamada's avatar
      kbuild: add phony targets to ./Kbuild · ed7ceac1
      Masahiro Yamada authored
      missing-syscalls and old-atomics are meant to be phony targets.
      Adding them to always-y is odd. (always-y should generate something).
      
      Add a new phony target 'prepare', which depends on all the other.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      ed7ceac1
    • Masahiro Yamada's avatar
      kbuild: remove the target in signal traps when interrupted · a7f3257d
      Masahiro Yamada authored
      When receiving some signal, GNU Make automatically deletes the target if
      it has already been changed by the interrupted recipe.
      
      If the target is possibly incomplete due to interruption, it must be
      deleted so that it will be remade from scratch on the next run of make.
      Otherwise, the target would remain corrupted permanently because its
      timestamp had already been updated.
      
      Thanks to this behavior of Make, you can stop the build any time by
      pressing Ctrl-C, and just run 'make' to resume it.
      
      Kbuild also relies on this feature, but it is equivalently important
      for any build systems that make decisions based on timestamps (if you
      want to support Ctrl-C reliably).
      
      However, this does not always work as claimed; Make immediately dies
      with Ctrl-C if its stderr goes into a pipe.
      
        [Test Makefile]
      
          foo:
                  echo hello > $@
                  sleep 3
                  echo world >> $@
      
        [Test Result]
      
          $ make                         # hit Ctrl-C
          echo hello > foo
          sleep 3
          ^Cmake: *** Deleting file 'foo'
          make: *** [Makefile:3: foo] Interrupt
      
          $ make 2>&1 | cat              # hit Ctrl-C
          echo hello > foo
          sleep 3
          ^C$                            # 'foo' is often left-over
      
      The reason is because SIGINT is sent to the entire process group.
      In this example, SIGINT kills 'cat', and 'make' writes the message to
      the closed pipe, then dies with SIGPIPE before cleaning the target.
      
      A typical bad scenario (as reported by [1], [2]) is to save build log
      by using the 'tee' command:
      
          $ make 2>&1 | tee log
      
      This can be problematic for any build systems based on Make, so I hope
      it will be fixed in GNU Make. The maintainer of GNU Make stated this is
      a long-standing issue and difficult to fix [3]. It has not been fixed
      yet as of writing.
      
      So, we cannot rely on Make cleaning the target. We can do it by
      ourselves, in signal traps.
      
      As far as I understand, Make takes care of SIGHUP, SIGINT, SIGQUIT, and
      SITERM for the target removal. I added the traps for them, and also for
      SIGPIPE just in case cmd_* rule prints something to stdout or stderr
      (but I did not observe an actual case where SIGPIPE was triggered).
      
      [Note 1]
      
      The trap handler might be worth explaining.
      
          rm -f $@; trap - $(sig); kill -s $(sig) $$
      
      This lets the shell kill itself by the signal it caught, so the parent
      process can tell the child has exited on the signal. Generally, this is
      a proper manner for handling signals, in case the calling program (like
      Bash) may monitor WIFSIGNALED() and WTERMSIG() for WCE although this may
      not be a big deal here because GNU Make handles SIGHUP, SIGINT, SIGQUIT
      in WUE and SIGTERM in IUE.
      
        IUE - Immediate Unconditional Exit
        WUE - Wait and Unconditional Exit
        WCE - Wait and Cooperative Exit
      
      For details, see "Proper handling of SIGINT/SIGQUIT" [4].
      
      [Note 2]
      
      Reverting 392885ee ("kbuild: let fixdep directly write to .*.cmd
      files") would directly address [1], but it only saves if_changed_dep.
      As reported in [2], all commands that use redirection can potentially
      leave an empty (i.e. broken) target.
      
      [Note 3]
      
      Another (even safer) approach might be to always write to a temporary
      file, and rename it to $@ at the end of the recipe.
      
         <command>  > $(tmp-target)
         mv $(tmp-target) $@
      
      It would require a lot of Makefile changes, and result in ugly code,
      so I did not take it.
      
      [Note 4]
      
      A little more thoughts about a pattern rule with multiple targets (or
      a grouped target).
      
          %.x %.y: %.z
                  <recipe>
      
      When interrupted, GNU Make deletes both %.x and %.y, while this solution
      only deletes $@. Probably, this is not a big deal. The next run of make
      will execute the rule again to create $@ along with the other files.
      
      [1]: https://lore.kernel.org/all/YLeot94yAaM4xbMY@gmail.com/
      [2]: https://lore.kernel.org/all/20220510221333.2770571-1-robh@kernel.org/
      [3]: https://lists.gnu.org/archive/html/help-make/2021-06/msg00001.html
      [4]: https://www.cons.org/cracauer/sigint.html
      
      Fixes: 392885ee ("kbuild: let fixdep directly write to .*.cmd files")
      Reported-by: default avatarIngo Molnar <mingo@kernel.org>
      Reported-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: default avatarIngo Molnar <mingo@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      a7f3257d
  2. 25 Sep, 2022 8 commits
  3. 24 Sep, 2022 10 commits
  4. 23 Sep, 2022 13 commits
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · a63f2e7c
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "These are all very simple and self-contained, although the CFI
        jump-table fix touches the generic linker script as that's where the
        problematic macro lives.
      
         - Fix false positive "sleeping while atomic" warning resulting from
           the kPTI rework taking a mutex too early.
      
         - Fix possible overflow in AMU frequency calculation
      
         - Fix incorrect shift in CMN PMU driver which causes problems with
           newer versions of the IP
      
         - Reduce alignment of the CFI jump table to avoid huge kernel images
           and link errors with !4KiB page size configurations"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        vmlinux.lds.h: CFI: Reduce alignment of jump-table to function alignment
        perf/arm-cmn: Add more bits to child node address offset field
        arm64: topology: fix possible overflow in amu_fie_setup()
        arm64: mm: don't acquire mutex when rewriting swapper
      a63f2e7c
    • Masahiro Yamada's avatar
      certs: make system keyring depend on built-in x509 parser · 2154aca2
      Masahiro Yamada authored
      Commit e9088629 ("certs: make system keyring depend on x509 parser")
      is not the right fix because x509_load_certificate_list() can be modular.
      
      The combination of CONFIG_SYSTEM_TRUSTED_KEYRING=y and
      CONFIG_X509_CERTIFICATE_PARSER=m still results in the following error:
      
          LD      .tmp_vmlinux.kallsyms1
        ld: certs/system_keyring.o: in function `load_system_certificate_list':
        system_keyring.c:(.init.text+0x8c): undefined reference to `x509_load_certificate_list'
        make: *** [Makefile:1169: vmlinux] Error 1
      
      Fixes: e9088629 ("certs: make system keyring depend on x509 parser")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: default avatarAdam Borowski <kilobyte@angband.pl>
      2154aca2
    • Zeng Heng's avatar
      Kconfig: remove unused function 'menu_get_root_menu' · 03764b30
      Zeng Heng authored
      There is nowhere calling `menu_get_root_menu` function,
      so remove it.
      Signed-off-by: default avatarZeng Heng <zengheng4@huawei.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      03764b30
    • yangxingwu's avatar
      scripts/clang-tools: remove unused module · 237fe727
      yangxingwu authored
      Remove unused imported 'os' module.
      Signed-off-by: default avataryangxingwu <xingwu.yang@gmail.com>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      237fe727
    • Ming Lei's avatar
      cgroup: cgroup_get_from_id() must check the looked-up kn is a directory · df02452f
      Ming Lei authored
      cgroup has to be one kernfs dir, otherwise kernel panic is caused,
      especially cgroup id is provide from userspace.
      Reported-by: default avatarMarco Patalano <mpatalan@redhat.com>
      Fixes: 6b658c48 ("scsi: cgroup: Add cgroup_get_from_id()")
      Cc: Muneendra <muneendra.kumar@broadcom.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Acked-by: default avatarMukesh Ojha <quic_mojha@quicinc.com>
      Cc: stable@vger.kernel.org # v5.14+
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      df02452f
    • Linus Torvalds's avatar
      Merge tag 'driver-core-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core · 1707c39a
      Linus Torvalds authored
      Pull driver core fixes from Greg KH:
       "Here are two tiny driver core fixes for 6.0-rc7 that resolve some
        oft-reported problems.
      
        The first is a revert of the "fw_devlink.strict=1" default option that
        we keep trying to enable, but we keep finding platforms that this just
        breaks everything on. So again, we need it reverted and hopefully it
        can be worked on in future releases.
      
        The second is a sysfs file-size bugfix that resolves an issue that
        many people are starting to hit as the fix it is fixing also was
        backported to stable kernels. The util-linux developers are starting
        to get bugreports about sysfs files that contain no data because of
        this problem, and this fix which has been in linux-next in the
        bitfield tree for a long time, resolves it. I'm submitting it here as
        it needs to be merged for 6.0-final, not for 6.1-rc1.
      
        Both of these have been in linux-next with no reported issues, only
        reports were that these fixed problems"
      
      * tag 'driver-core-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        drivers/base: Fix unsigned comparison to -1 in CPUMAP_FILE_MAX_BYTES
        Revert "driver core: Set fw_devlink.strict=1 by default"
      1707c39a
    • Linus Torvalds's avatar
      Merge tag 'usb-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 33a4e37e
      Linus Torvalds authored
      Pull USB / Thunderbolt driver fixes and ids from Greg KH:
       "Here are a few small USB and Thunderbolt driver fixes and new device
        ids for 6.0-rc7.
      
        They contain:
      
         - new usb-serial driver ids
      
         - documentation build warning fix in USB hub code
      
         - flexcop-usb long-posted bugfix (the v4l maintainer for this is MIA
           so I have finally picked this up as it is a fix for a reported
           problem.)
      
         - dwc3 64bit DMA bugfix
      
         - new thunderbolt device ids
      
         - typec build error fix
      
        All of these have been in linux-next with no reported issues"
      
      * tag 'usb-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: typec: anx7411: Fix build error without CONFIG_POWER_SUPPLY
        media: flexcop-usb: fix endpoint type check
        USB: serial: option: add Quectel RM520N
        USB: serial: option: add Quectel BG95 0x0203 composition
        thunderbolt: Add support for Intel Maple Ridge single port controller
        usb: dwc3: core: leave default DMA if the controller does not support 64-bit DMA
        USB: core: Fix RST error in hub.c
      33a4e37e
    • Linus Torvalds's avatar
      Merge tag 'landlock-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux · 9395cd7c
      Linus Torvalds authored
      Pull landlock fix from Mickaël Salaün:
       "Fix out-of-tree builds for Landlock tests"
      
      * tag 'landlock-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux:
        selftests/landlock: Fix out-of-tree builds
      9395cd7c
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · a7b7751a
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - A handful of build fixes for the T-Head errata, including some
         functional issues the compilers found
      
       - A fix for a nasty sigreturn bug
      
      * tag 'riscv-for-linus-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        RISC-V: Avoid coupling the T-Head CMOs and Zicbom
        riscv: fix a nasty sigreturn bug...
        riscv: make t-head erratas depend on MMU
        riscv: fix RISCV_ISA_SVPBMT kconfig dependency warning
        RISC-V: Clean up the Zicbom block size probing
      a7b7751a
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 317fab7e
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "As everyone back came back from conferences, here are the pending
        patches for Linux 6.0.
      
        ARM:
      
         - Fix for kmemleak with pKVM
      
        s390:
      
         - Fixes for VFIO with zPCI
      
         - smatch fix
      
        x86:
      
         - Ensure XSAVE-capable hosts always allow FP and SSE state to be
           saved and restored via KVM_{GET,SET}_XSAVE
      
         - Fix broken max_mmu_rmap_size stat
      
         - Fix compile error with old glibc that doesn't have gettid()"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: x86: Inject #UD on emulated XSETBV if XSAVES isn't enabled
        KVM: x86: Always enable legacy FP/SSE in allowed user XFEATURES
        KVM: x86: Reinstate kvm_vcpu_arch.guest_supported_xcr0
        KVM: x86/mmu: add missing update to max_mmu_rmap_size
        selftests: kvm: Fix a compile error in selftests/kvm/rseq_test.c
        KVM: s390: pci: register pci hooks without interpretation
        KVM: s390: pci: fix GAIT physical vs virtual pointers usage
        KVM: s390: Pass initialized arg even if unused
        KVM: s390: pci: fix plain integer as NULL pointer warnings
        KVM: arm64: Use kmemleak_free_part_phys() to unregister hyp_mem_base
      317fab7e
    • Linus Torvalds's avatar
      Merge tag 'for-linus-6.0-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 526e8262
      Linus Torvalds authored
      Pull xen fix from Juergen Gross:
       "A single fix for an issue in the xenbus driver (initialization of
        multi-page rings for Xen PV devices)"
      
      * tag 'for-linus-6.0-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen/xenbus: fix xenbus_setup_ring()
      526e8262
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2022-09-23-1' of git://anongit.freedesktop.org/drm/drm · 22565ae7
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Regular fixes for the week, i915, mediatek, hisilicon, mgag200 and
        panel have some small fixes.
      
        amdgpu has more stack size fixes for clang build, and fixes for new
        IPs, but all with low regression chances since they are for stuff new
        in v6.0.
      
        i915:
         - avoid a general protection failure when using perf/OA
         - avoid kernel warnings on driver release
      
        amdgpu:
         - SDMA 6.x fix
         - GPUVM TF fix
         - DCN 3.2.x fixes
         - DCN 3.1.x fixes
         - SMU 13.x fixes
         - Clang stack size fixes for recently enabled DML code
         - Fix drm dirty callback change on non-atomic cases
         - USB4 display fix
      
        mediatek:
         - dsi: Add atomic {destroy,duplicate}_state, reset callbacks
         - dsi: Move mtk_dsi_stop() call back to mtk_dsi_poweroff()
         - Fix wrong dither settings
      
        hisilicon:
         - Depend on MMU
      
        mgag200:
         - Fix console on G200ER
      
        panel:
         - Fix innolux_g121i1_l01 bus format"
      
      * tag 'drm-fixes-2022-09-23-1' of git://anongit.freedesktop.org/drm/drm: (30 commits)
        MAINTAINERS: switch graphics to airlied other addresses
        drm/mediatek: dsi: Move mtk_dsi_stop() call back to mtk_dsi_poweroff()
        drm/amd/display: Reduce number of arguments of dml314's CalculateFlipSchedule()
        drm/amd/display: Reduce number of arguments of dml314's CalculateWatermarksAndDRAMSpeedChangeSupport()
        drm/amdgpu: don't register a dirty callback for non-atomic
        drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0
        drm/amd/pm: add support for 3794 pptable for SMU13.0.0
        drm/amd/display: correct num_dsc based on HW cap
        drm/amd/display: Disable OTG WA for the plane_state NULL case on DCN314
        drm/amd/display: Add shift and mask for ICH_RESET_AT_END_OF_LINE
        drm/amd/display: increase dcn315 pstate change latency
        drm/amd/display: Fix DP MST timeslot issue when fallback happened
        drm/amd/display: Display distortion after hotplug 5K tiled display
        drm/amd/display: Update dummy P-state search to use DCN32 DML
        drm/amd/display: skip audio setup when audio stream is enabled
        drm/amd/display: update gamut remap if plane has changed
        drm/amd/display: Assume an LTTPR is always present on fixed_vs links
        drm/amd/display: fix dcn315 memory channel count and width read
        drm/amd/display: Fix double cursor on non-video RGB MPO
        drm/amd/display: Only consider pixle rate div policy for DCN32+
        ...
      22565ae7
    • Paolo Bonzini's avatar
      Merge tag 'kvm-s390-master-6.0-2' of... · 69604fe7
      Paolo Bonzini authored
      Merge tag 'kvm-s390-master-6.0-2' of https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD
      
      More pci fixes
      Fix for a code analyser warning
      69604fe7