1. 10 Jun, 2023 30 commits
    • Douglas Anderson's avatar
      watchdog/hardlockup: move perf hardlockup checking/panic to common watchdog.c · 81972551
      Douglas Anderson authored
      The perf hardlockup detector works by looking at interrupt counts and
      seeing if they change from run to run.  The interrupt counts are managed
      by the common watchdog code via its watchdog_timer_fn().
      
      Currently the API between the perf detector and the common code is a
      function: is_hardlockup().  When the hard lockup detector sees that
      function return true then it handles printing out debug info and inducing
      a panic if necessary.
      
      Let's change the API a little bit in preparation for the buddy hardlockup
      detector.  The buddy hardlockup detector wants to print nearly the same
      debug info and have nearly the same panic behavior.  That means we want to
      move all that code to the common file.  For now, the code in the common
      file will only be there if the perf hardlockup detector is enabled, but
      eventually it will be selected by a common config.
      
      Right now, this _just_ moves the code from the perf detector file to the
      common file and changes the names.  It doesn't make the changes that the
      buddy hardlockup detector will need and doesn't do any style cleanups.  A
      future patch will do cleanup to make it more obvious what changed.
      
      With the above, we no longer have any callers of is_hardlockup() outside
      of the "watchdog.c" file, so we can remove it from the header, make it
      static, and move it to the same "#ifdef" block as our new
      watchdog_hardlockup_check().  While doing this, it can be noted that even
      if no hardlockup detectors were configured the existing code used to still
      have the code for counting/checking "hrtimer_interrupts" even if the perf
      hardlockup detector wasn't configured.  We didn't need to do that, so move
      all the "hrtimer_interrupts" counting to only be there if the perf
      hardlockup detector is configured as well.
      
      This change is expected to be a no-op.
      
      Link: https://lkml.kernel.org/r/20230519101840.v5.8.Id4133d3183e798122dc3b6205e7852601f289071@changeidSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Colin Cross <ccross@android.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Guenter Roeck <groeck@chromium.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Lecopzer Chen <lecopzer.chen@mediatek.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masayoshi Mizuma <msys.mizuma@gmail.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Pingfan Liu <kernelfans@gmail.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
      Cc: Ricardo Neri <ricardo.neri@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Boyd <swboyd@chromium.org>
      Cc: Sumit Garg <sumit.garg@linaro.org>
      Cc: Tzung-Bi Shih <tzungbi@chromium.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      81972551
    • Douglas Anderson's avatar
      watchdog/perf: rename watchdog_hld.c to watchdog_perf.c · 6ea0d042
      Douglas Anderson authored
      The code currently in "watchdog_hld.c" is for detecting hardlockups using
      perf, as evidenced by the line in the Makefile that only compiles this
      file if CONFIG_HARDLOCKUP_DETECTOR_PERF is defined.  Rename the file to
      prepare for the buddy hardlockup detector, which doesn't use perf.
      
      It could be argued that the new name makes it less obvious that this is a
      hardlockup detector.  While true, it's not hard to remember that the
      "perf" detector is always a hardlockup detector and it's nice not to have
      names that are too convoluted.
      
      Link: https://lkml.kernel.org/r/20230519101840.v5.7.Ice803cb078d0e15fb2cbf49132f096ee2bd4199d@changeidSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Acked-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Colin Cross <ccross@android.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Guenter Roeck <groeck@chromium.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Lecopzer Chen <lecopzer.chen@mediatek.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masayoshi Mizuma <msys.mizuma@gmail.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Pingfan Liu <kernelfans@gmail.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
      Cc: Ricardo Neri <ricardo.neri@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Boyd <swboyd@chromium.org>
      Cc: Sumit Garg <sumit.garg@linaro.org>
      Cc: Tzung-Bi Shih <tzungbi@chromium.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      6ea0d042
    • Douglas Anderson's avatar
      watchdog/hardlockup: add comments to touch_nmi_watchdog() · 8b5c59a9
      Douglas Anderson authored
      In preparation for the buddy hardlockup detector, add comments to
      touch_nmi_watchdog() to make it obvious that it touches the configured
      hardlockup detector regardless of whether it's backed by an NMI.  Also
      note that arch_touch_nmi_watchdog() may not be architecture-specific.
      
      Ideally, we'd like to rename these functions but that is a fairly
      disruptive change touching a lot of drivers.  After discussion [1] the
      plan is to defer this until a good time.
      
      [1] https://lore.kernel.org/r/ZFy0TX1tfhlH8gxj@alley
      
      [akpm@linux-foundation.org: comment changes, per Petr]
        Link: https://lkml.kernel.org/r/ZGyONWPXpE1DcxA5@alley
      Link: https://lkml.kernel.org/r/20230519101840.v5.6.I4e47cbfa1bb2ebbcdb5ca16817aa2887f15dc82c@changeidSigned-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Colin Cross <ccross@android.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Guenter Roeck <groeck@chromium.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Lecopzer Chen <lecopzer.chen@mediatek.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masayoshi Mizuma <msys.mizuma@gmail.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Pingfan Liu <kernelfans@gmail.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
      Cc: Ricardo Neri <ricardo.neri@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Boyd <swboyd@chromium.org>
      Cc: Sumit Garg <sumit.garg@linaro.org>
      Cc: Tzung-Bi Shih <tzungbi@chromium.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      8b5c59a9
    • Pingfan Liu's avatar
      watchdog/perf: ensure CPU-bound context when creating hardlockup detector event · 1fafaa77
      Pingfan Liu authored
      hardlockup_detector_event_create() should create perf_event on the current
      CPU.  Preemption could not get disabled because
      perf_event_create_kernel_counter() allocates memory.  Instead, the CPU
      locality is achieved by processing the code in a per-CPU bound kthread.
      
      Add a check to prevent mistakes when calling the code in another code
      path.
      
      Link: https://lkml.kernel.org/r/20230519101840.v5.5.I654063e53782b11d53e736a8ad4897ffd207406a@changeidSigned-off-by: default avatarPingfan Liu <kernelfans@gmail.com>
      Co-developed-by: default avatarLecopzer Chen <lecopzer.chen@mediatek.com>
      Signed-off-by: default avatarLecopzer Chen <lecopzer.chen@mediatek.com>
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Colin Cross <ccross@android.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Guenter Roeck <groeck@chromium.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masayoshi Mizuma <msys.mizuma@gmail.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
      Cc: Ricardo Neri <ricardo.neri@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Boyd <swboyd@chromium.org>
      Cc: Sumit Garg <sumit.garg@linaro.org>
      Cc: Tzung-Bi Shih <tzungbi@chromium.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      1fafaa77
    • Lecopzer Chen's avatar
      watchdog/hardlockup: change watchdog_nmi_enable() to void · 73021118
      Lecopzer Chen authored
      Nobody cares about the return value of watchdog_nmi_enable(), changing its
      prototype to void.
      
      Link: https://lkml.kernel.org/r/20230519101840.v5.4.Ic3a19b592eb1ac4c6f6eade44ffd943e8637b6e5@changeidSigned-off-by: default avatarPingfan Liu <kernelfans@gmail.com>
      Signed-off-by: default avatarLecopzer Chen <lecopzer.chen@mediatek.com>
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Acked-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Colin Cross <ccross@android.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Guenter Roeck <groeck@chromium.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masayoshi Mizuma <msys.mizuma@gmail.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
      Cc: Ricardo Neri <ricardo.neri@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Boyd <swboyd@chromium.org>
      Cc: Sumit Garg <sumit.garg@linaro.org>
      Cc: Tzung-Bi Shih <tzungbi@chromium.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      73021118
    • Lecopzer Chen's avatar
      watchdog: remove WATCHDOG_DEFAULT · 810b560e
      Lecopzer Chen authored
      No reference to WATCHDOG_DEFAULT, remove it.
      
      Link: https://lkml.kernel.org/r/20230519101840.v5.3.I6a729209a1320e0ad212176e250ff945b8f91b2a@changeidSigned-off-by: default avatarPingfan Liu <kernelfans@gmail.com>
      Signed-off-by: default avatarLecopzer Chen <lecopzer.chen@mediatek.com>
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Colin Cross <ccross@android.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Guenter Roeck <groeck@chromium.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masayoshi Mizuma <msys.mizuma@gmail.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
      Cc: Ricardo Neri <ricardo.neri@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Boyd <swboyd@chromium.org>
      Cc: Sumit Garg <sumit.garg@linaro.org>
      Cc: Tzung-Bi Shih <tzungbi@chromium.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      810b560e
    • Douglas Anderson's avatar
      watchdog/perf: more properly prevent false positives with turbo modes · 4379e59f
      Douglas Anderson authored
      Currently, in the watchdog_overflow_callback() we first check to see if
      the watchdog had been touched and _then_ we handle the workaround for
      turbo mode.  This order should be reversed.
      
      Specifically, "touching" the hardlockup detector's watchdog should avoid
      lockups being detected for one period that should be roughly the same
      regardless of whether we're running turbo or not.  That means that we
      should do the extra accounting for turbo _before_ we look at (and clear)
      the global indicating that we've been touched.
      
      NOTE: this fix is made based on code inspection.  I am not aware of any
      reports where the old code would have generated false positives.  That
      being said, this order seems more correct and also makes it easier down
      the line to share code with the "buddy" hardlockup detector.
      
      Link: https://lkml.kernel.org/r/20230519101840.v5.2.I843b0d1de3e096ba111a179f3adb16d576bef5c7@changeid
      Fixes: 7edaeb68 ("kernel/watchdog: Prevent false positives with turbo modes")
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Colin Cross <ccross@android.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Guenter Roeck <groeck@chromium.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Lecopzer Chen <lecopzer.chen@mediatek.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masayoshi Mizuma <msys.mizuma@gmail.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Pingfan Liu <kernelfans@gmail.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
      Cc: Ricardo Neri <ricardo.neri@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Boyd <swboyd@chromium.org>
      Cc: Sumit Garg <sumit.garg@linaro.org>
      Cc: Tzung-Bi Shih <tzungbi@chromium.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      4379e59f
    • Douglas Anderson's avatar
      watchdog/perf: define dummy watchdog_update_hrtimer_threshold() on correct config · 5e008df1
      Douglas Anderson authored
      Patch series "watchdog/hardlockup: Add the buddy hardlockup detector", v5.
      
      This patch series adds the "buddy" hardlockup detector.  In brief, the
      buddy hardlockup detector can detect hardlockups without arch-level
      support by having CPUs checkup on a "buddy" CPU periodically.
      
      Given the new design of this patch series, testing all combinations is
      fairly difficult. I've attempted to make sure that all combinations of
      CONFIG_ options are good, but it wouldn't surprise me if I missed
      something. I apologize in advance and I'll do my best to fix any
      problems that are found.
      
      
      This patch (of 18):
      
      The real watchdog_update_hrtimer_threshold() is defined in
      kernel/watchdog_hld.c.  That file is included if
      CONFIG_HARDLOCKUP_DETECTOR_PERF and the function is defined in that file
      if CONFIG_HARDLOCKUP_CHECK_TIMESTAMP.
      
      The dummy version of the function in "nmi.h" didn't get that quite right. 
      While this doesn't appear to be a huge deal, it's nice to make it
      consistent.
      
      It doesn't break builds because CHECK_TIMESTAMP is only defined by x86 so
      others don't get a double definition, and x86 uses perf lockup detector,
      so it gets the out of line version.
      
      Link: https://lkml.kernel.org/r/20230519101840.v5.18.Ia44852044cdcb074f387e80df6b45e892965d4a1@changeid
      Link: https://lkml.kernel.org/r/20230519101840.v5.1.I8cbb2f4fa740528fcfade4f5439b6cdcdd059251@changeid
      Fixes: 7edaeb68 ("kernel/watchdog: Prevent false positives with turbo modes")
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Guenter Roeck <groeck@chromium.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Lecopzer Chen <lecopzer.chen@mediatek.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masayoshi Mizuma <msys.mizuma@gmail.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Pingfan Liu <kernelfans@gmail.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
      Cc: Ricardo Neri <ricardo.neri@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Boyd <swboyd@chromium.org>
      Cc: Sumit Garg <sumit.garg@linaro.org>
      Cc: Tzung-Bi Shih <tzungbi@chromium.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Colin Cross <ccross@android.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      5e008df1
    • Arnd Bergmann's avatar
      decompressor: provide missing prototypes · 00444448
      Arnd Bergmann authored
      The entry points for the decompressor don't always have a prototype
      included in the .c file:
      
      lib/decompress_inflate.c:42:17: error: no previous prototype for '__gunzip' [-Werror=missing-prototypes]
      lib/decompress_unxz.c:251:17: error: no previous prototype for 'unxz' [-Werror=missing-prototypes]
      lib/decompress_unzstd.c:331:17: error: no previous prototype for 'unzstd' [-Werror=missing-prototypes]
      
      Include the correct headers for unxz and unzstd, and mark the inflate
      function above as unconditionally 'static' to avoid these warnings.
      
      Link: https://lkml.kernel.org/r/20230517131936.936840-1-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Nick Terrell <terrelln@fb.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      00444448
    • Angus Chen's avatar
      init: add bdev fs printk if mount_block_root failed · 6aee6723
      Angus Chen authored
      Booting with the QEMU command line:
      "qemu-system-x86_64 -append root=/dev/vda rootfstype=ext4 ..."
      will panic if ext4 is not builtin and a request to load the ext4 module
      fails.
      
      [    1.729006] VFS: Cannot open root device "vda" or unknown-block(253,0): error -19
      [    1.730603] Please append a correct "root=" boot option; here are the available partitions:
      [    1.732323] fd00          256000 vda
      [    1.732329]  driver: virtio_blk
      [    1.734194] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(253,0)
      [    1.734771] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.4.0-rc2+ #53
      [    1.735194] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.10.2-1ubuntu1 04/01/2014
      [    1.735772] Call Trace:
      [    1.735950]  <TASK>
      [    1.736113]  dump_stack_lvl+0x32/0x50
      [    1.736367]  panic+0x108/0x310
      [    1.736570]  mount_block_root+0x161/0x310
      [    1.736849]  ? rdinit_setup+0x40/0x40
      [    1.737088]  prepare_namespace+0x10c/0x180
      [    1.737393]  kernel_init_freeable+0x354/0x450
      [    1.737707]  ? rest_init+0xd0/0xd0
      [    1.737945]  kernel_init+0x16/0x130
      [    1.738196]  ret_from_fork+0x1f/0x30
      
      As a hint, print all the bdev fstypes which are available.
      
      [akpm@linux-foundation.org: fix spelling in printk message]
      Link: https://lkml.kernel.org/r/20230518035321.1672-1-angus.chen@jaguarmicro.comSigned-off-by: default avatarAngus Chen <angus.chen@jaguarmicro.com>
      Acked-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Mike Rapoport (IBM) <rppt@kernel.org>
      Cc: Paul E. McKenney <paulmck@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      6aee6723
    • Arnd Bergmann's avatar
      kcov: add prototypes for helper functions · e0ddec73
      Arnd Bergmann authored
      A number of internal functions in kcov are only called from generated code
      and don't technically need a declaration, but 'make W=1' warns about
      global symbols without a prototype:
      
      kernel/kcov.c:199:14: error: no previous prototype for '__sanitizer_cov_trace_pc' [-Werror=missing-prototypes]
      kernel/kcov.c:264:14: error: no previous prototype for '__sanitizer_cov_trace_cmp1' [-Werror=missing-prototypes]
      kernel/kcov.c:270:14: error: no previous prototype for '__sanitizer_cov_trace_cmp2' [-Werror=missing-prototypes]
      kernel/kcov.c:276:14: error: no previous prototype for '__sanitizer_cov_trace_cmp4' [-Werror=missing-prototypes]
      kernel/kcov.c:282:14: error: no previous prototype for '__sanitizer_cov_trace_cmp8' [-Werror=missing-prototypes]
      kernel/kcov.c:288:14: error: no previous prototype for '__sanitizer_cov_trace_const_cmp1' [-Werror=missing-prototypes]
      kernel/kcov.c:295:14: error: no previous prototype for '__sanitizer_cov_trace_const_cmp2' [-Werror=missing-prototypes]
      kernel/kcov.c:302:14: error: no previous prototype for '__sanitizer_cov_trace_const_cmp4' [-Werror=missing-prototypes]
      kernel/kcov.c:309:14: error: no previous prototype for '__sanitizer_cov_trace_const_cmp8' [-Werror=missing-prototypes]
      kernel/kcov.c:316:14: error: no previous prototype for '__sanitizer_cov_trace_switch' [-Werror=missing-prototypes]
      
      Adding prototypes for these in a header solves that problem, but now there
      is a mismatch between the built-in type and the prototype on 64-bit
      architectures because they expect some functions to take a 64-bit
      'unsigned long' argument rather than an 'unsigned long long' u64 type:
      
      include/linux/kcov.h:84:6: error: conflicting types for built-in function '__sanitizer_cov_trace_switch'; expected 'void(long long unsigned int,  void *)' [-Werror=builtin-declaration-mismatch]
         84 | void __sanitizer_cov_trace_switch(u64 val, u64 *cases);
            |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Avoid this as well with a custom type definition.
      
      Link: https://lkml.kernel.org/r/20230517124944.929997-1-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Rong Tao <rongtao@cestc.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      e0ddec73
    • Arnd Bergmann's avatar
      time_namespace: always provide arch_get_vdso_data() prototype for vdso · 3403bb4e
      Arnd Bergmann authored
      The arch_get_vdso_data() function is defined separately on each
      architecture, but only called when CONFIG_TIME_NS is set.  If the
      definition is a global function, this causes a W=1 warning without
      TIME_NS:
      
      arch/x86/entry/vdso/vma.c:35:19: error: no previous prototype for 'arch_get_vdso_data' [-Werror=missing-prototypes]
      
      Move the prototype out of the #ifdef block to reliably turn off that
      warning.
      
      Link: https://lkml.kernel.org/r/20230517131102.934196-15-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      3403bb4e
    • Arnd Bergmann's avatar
      thread_info: move function declarations to linux/thread_info.h · af0a76e1
      Arnd Bergmann authored
      There are a few __weak functions in kernel/fork.c, which architectures
      can override. If there is no prototype, the compiler warns about them:
      
      kernel/fork.c:164:13: error: no previous prototype for 'arch_release_task_struct' [-Werror=missing-prototypes]
      kernel/fork.c:991:20: error: no previous prototype for 'arch_task_cache_init' [-Werror=missing-prototypes]
      kernel/fork.c:1086:12: error: no previous prototype for 'arch_dup_task_struct' [-Werror=missing-prototypes]
      
      There are already prototypes in a number of architecture specific headers
      that have addressed those warnings before, but it's much better to have
      these in a single place so the warning no longer shows up anywhere.
      
      Link: https://lkml.kernel.org/r/20230517131102.934196-14-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      af0a76e1
    • Arnd Bergmann's avatar
      init: move cifs_root_data() prototype into linux/mount.h · 73648e6f
      Arnd Bergmann authored
      cifs_root_data() is defined in cifs and called from early init code, but
      lacks a global prototype:
      
      fs/cifs/cifsroot.c:83:12: error: no previous prototype for 'cifs_root_data'
      
      Move the declaration from do_mounts.c into an appropriate header.
      
      Link: https://lkml.kernel.org/r/20230517131102.934196-13-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      73648e6f
    • Arnd Bergmann's avatar
      init: consolidate prototypes in linux/init.h · ad1a4830
      Arnd Bergmann authored
      The init/main.c file contains some extern declarations for functions
      defined in architecture code, and it defines some other functions that are
      called from architecture code with a custom prototype.  Both of those
      result in warnings with 'make W=1':
      
      init/calibrate.c:261:37: error: no previous prototype for 'calibrate_delay_is_known' [-Werror=missing-prototypes]
      init/main.c:790:20: error: no previous prototype for 'mem_encrypt_init' [-Werror=missing-prototypes]
      init/main.c:792:20: error: no previous prototype for 'poking_init' [-Werror=missing-prototypes]
      arch/arm64/kernel/irq.c:122:13: error: no previous prototype for 'init_IRQ' [-Werror=missing-prototypes]
      arch/arm64/kernel/time.c:55:13: error: no previous prototype for 'time_init' [-Werror=missing-prototypes]
      arch/x86/kernel/process.c:935:13: error: no previous prototype for 'arch_post_acpi_subsys_init' [-Werror=missing-prototypes]
      init/calibrate.c:261:37: error: no previous prototype for 'calibrate_delay_is_known' [-Werror=missing-prototypes]
      kernel/fork.c:991:20: error: no previous prototype for 'arch_task_cache_init' [-Werror=missing-prototypes]
      
      Add prototypes for all of these in include/linux/init.h or another
      appropriate header, and remove the duplicate declarations from
      architecture specific code.
      
      [sfr@canb.auug.org.au: declare time_init_early()]
        Link: https://lkml.kernel.org/r/20230519124311.5167221c@canb.auug.org.au
      Link: https://lkml.kernel.org/r/20230517131102.934196-12-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      ad1a4830
    • Arnd Bergmann's avatar
      kunit: include debugfs header file · 23108f6a
      Arnd Bergmann authored
      An extra #include statement is needed to ensure the prototypes for debugfs
      interfaces are visible, avoiding this warning:
      
      lib/kunit/debugfs.c:28:6: error: no previous prototype for 'kunit_debugfs_cleanup' [-Werror=missing-prototypes]
      lib/kunit/debugfs.c:33:6: error: no previous prototype for 'kunit_debugfs_init' [-Werror=missing-prototypes]
      lib/kunit/debugfs.c:102:6: error: no previous prototype for 'kunit_debugfs_create_suite' [-Werror=missing-prototypes]
      lib/kunit/debugfs.c:118:6: error: no previous prototype for 'kunit_debugfs_destroy_suite' [-Werror=missing-prototypes]
      
      Link: https://lkml.kernel.org/r/20230517131102.934196-10-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarDavid Gow <davidgow@google.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      23108f6a
    • Arnd Bergmann's avatar
      panic: make function declarations visible · d9cdb431
      Arnd Bergmann authored
      A few panic() related functions have a global definition but not
      declaration, which causes a warning with W=1:
      
      kernel/panic.c:710:6: error: no previous prototype for '__warn_printk' [-Werror=missing-prototypes]
      kernel/panic.c:756:24: error: no previous prototype for '__stack_chk_fail' [-Werror=missing-prototypes]
      kernel/exit.c:1917:32: error: no previous prototype for 'abort' [-Werror=missing-prototypes]
      
      __warn_printk() is called both as a global function when CONFIG_BUG
      is enabled, and as a local function in other configs. The other
      two here are called indirectly from generated or assembler code.
      
      Add prototypes for all of these.
      
      Link: https://lkml.kernel.org/r/20230517131102.934196-9-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      d9cdb431
    • Arnd Bergmann's avatar
      panic: hide unused global functions · 525bb813
      Arnd Bergmann authored
      Building with W=1 shows warnings about two functions that have no
      declaration or caller in certain configurations:
      
      kernel/panic.c:688:6: error: no previous prototype for 'warn_slowpath_fmt' [-Werror=missing-prototypes]
      kernel/panic.c:710:6: error: no previous prototype for '__warn_printk' [-Werror=missing-prototypes]
      
      Enclose the definition in the same #ifdef check as the declaration.
      
      Link: https://lkml.kernel.org/r/20230517131102.934196-8-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      525bb813
    • Arnd Bergmann's avatar
      locking: add lockevent_read() prototype · ff713881
      Arnd Bergmann authored
      lockevent_read() has a __weak definition and the only caller in
      kernel/locking/lock_events.c, plus a strong definition in qspinlock_stat.h
      that overrides it, but no other declaration.  This causes a W=1 warning:
      
      kernel/locking/lock_events.c:61:16: error: no previous prototype for 'lockevent_read' [-Werror=missing-prototypes]
      
      Add shared prototype to avoid the warnings.
      
      Link: https://lkml.kernel.org/r/20230517131102.934196-7-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      ff713881
    • Arnd Bergmann's avatar
      lib: devmem_is_allowed: include linux/io.h · 6b76ca2a
      Arnd Bergmann authored
      The devmem_is_allowed() function is defined in a file of the same name,
      but the declaration is in asm/io.h, which is not included there, causing a
      W=1 warning:
      
      lib/devmem_is_allowed.c:20:5: error: no previous prototype for 'devmem_is_allowed' [-Werror=missing-prototypes]
      
      Include the appropriate header to avoid the warning.
      
      Link: https://lkml.kernel.org/r/20230517131102.934196-6-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      6b76ca2a
    • Arnd Bergmann's avatar
      mm: sparse: mark populate_section_memmap() static · 52bb85d6
      Arnd Bergmann authored
      There are two definitions of this function, but the second one lacks the
      'static' annotation:
      
      mm/sparse.c:704:25: error: no previous prototype for 'populate_section_memmap' [-Werror=missing-prototypes]
      
      Link: https://lkml.kernel.org/r/20230517131102.934196-4-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      52bb85d6
    • Arnd Bergmann's avatar
      mm: page_poison: always declare __kernel_map_pages() function · 8f14a963
      Arnd Bergmann authored
      The __kernel_map_pages() function is mainly used for
      CONFIG_DEBUG_PAGEALLOC, but has a number of architecture specific
      definitions that may also be used in other configurations, as well as a
      global fallback definition for architectures that do not support
      DEBUG_PAGEALLOC.
      
      When the option is disabled, any definitions without the prototype cause a
      warning:
      
      mm/page_poison.c:102:6: error: no previous prototype for '__kernel_map_pages' [-Werror=missing-prototypes]
      
      The function is a trivial nop here, so just declare it anyway
      to avoid the warning.
      
      Link: https://lkml.kernel.org/r/20230517131102.934196-3-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      8f14a963
    • Arnd Bergmann's avatar
      mm: percpu: unhide pcpu_embed_first_chunk prototype · 6ca0f81c
      Arnd Bergmann authored
      Patch series "mm/init/kernel: missing-prototypes warnings".
      
      These are patches addressing -Wmissing-prototypes warnings in common
      kernel code and memory management code files that usually get merged
      through the -mm tree.
      
      
      This patch (of 12):
      
      This function is called whenever CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK or
      CONFIG_HAVE_SETUP_PER_CPU_AREA, but only declared when the former is set:
      
      mm/percpu.c:3055:12: error: no previous prototype for 'pcpu_embed_first_chunk' [-Werror=missing-prototypes]
      
      There is no real point in hiding declarations, so just remove
      the #ifdef here.
      
      Link: https://lkml.kernel.org/r/20230517131102.934196-1-arnd@kernel.org
      Link: https://lkml.kernel.org/r/20230517131102.934196-2-arnd@kernel.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Moore <paul@paul-moore.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      6ca0f81c
    • Vincent Whitchurch's avatar
      squashfs: cache partial compressed blocks · e994f5b6
      Vincent Whitchurch authored
      Before commit 93e72b3c ("squashfs: migrate from ll_rw_block
      usage to BIO"), compressed blocks read by squashfs were cached in the page
      cache, but that is not the case after that commit.  That has lead to
      squashfs having to re-read a lot of sectors from disk/flash.
      
      For example, the first sectors of every metadata block need to be read
      twice from the disk.  Once partially to read the length, and a second time
      to read the block itself.  Also, in linear reads of large files, the last
      sectors of one data block are re-read from disk when reading the next data
      block, since the compressed blocks are of variable sizes and not aligned
      to device blocks.  This extra I/O results in a degrade in read performance
      of, for example, ~16% in one scenario on my ARM platform using squashfs
      with dm-verity and NAND.
      
      Since the decompressed data is cached in the page cache or squashfs'
      internal metadata and fragment caches, caching _all_ compressed pages
      would lead to a lot of double caching and is undesirable.  But make the
      code cache any disk blocks which were only partially requested, since
      these are the ones likely to include data which is needed by other file
      system blocks.  This restores read performance in my test scenario.
      
      The compressed block caching is only applied when the disk block size is
      equal to the page size, to avoid having to deal with caching sub-page
      reads.
      
      [akpm@linux-foundation.org: fs/squashfs/block.c needs linux/pagemap.h]
      [vincent.whitchurch@axis.com: fix page update race]
        Link: https://lkml.kernel.org/r/20230526-squashfs-cache-fixup-v1-1-d54a7fa23e7b@axis.com
      [vincent.whitchurch@axis.com: fix page indices]
        Link: https://lkml.kernel.org/r/20230526-squashfs-cache-fixup-v1-2-d54a7fa23e7b@axis.com
      [akpm@linux-foundation.org: fix layout, per hch]
      Link: https://lkml.kernel.org/r/20230510-squashfs-cache-v4-1-3bd394e1ee71@axis.comSigned-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      e994f5b6
    • Christoph Hellwig's avatar
      squashfs: don't include buffer_head.h · 6b81459c
      Christoph Hellwig authored
      Squashfs has stopped using buffers heads in 93e72b3c
      ("squashfs: migrate from ll_rw_block usage to BIO").
      
      Link: https://lkml.kernel.org/r/20230517071622.245151-1-hch@lst.deSigned-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarPankaj Raghav <p.raghav@samsung.com>
      Reviewed-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      6b81459c
    • Haifeng Xu's avatar
      fork: optimize memcg_charge_kernel_stack() a bit · 4e2f6342
      Haifeng Xu authored
      Since commit f1c1a9ee ("fork: Move memcg_charge_kernel_stack()
      into CONFIG_VMAP_STACK"), memcg_charge_kernel_stack() has been moved
      into CONFIG_VMAP_STACK block, so the CONFIG_VMAP_STACK check can be
      removed.
      
      Furthermore, memcg_charge_kernel_stack() is only invoked by
      alloc_thread_stack_node() instead of dup_task_struct(). If
      memcg_kmem_charge_page() fails, the uncharge process is handled in
      memcg_charge_kernel_stack() itself instead of free_thread_stack(),
      so remove the incorrect comments.
      
      If memcg_charge_kernel_stack() fails to charge pages used by kernel
      stack, only charged pages need to be uncharged. It's unnecessary to
      uncharge those pages which memory cgroup pointer is NULL.
      
      [akpm@linux-foundation.org: remove assertion that PAGE_SIZE is a multiple of 1k]
      Link: https://lkml.kernel.org/r/20230508064458.32855-1-haifeng.xu@shopee.comSigned-off-by: default avatarHaifeng Xu <haifeng.xu@shopee.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Daniel Bristot de Oliveira <bristot@kernel.org>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      4e2f6342
    • Alexey Dobriyan's avatar
      add intptr_t · 3db55767
      Alexey Dobriyan authored
      Add signed intptr_t given that a) it is standard type and b) uintptr_t is
      in tree.
      
      Link: https://lkml.kernel.org/r/ed66b9e4-1fb7-45be-9bb9-d4bc291c691f@p183Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      3db55767
    • Azeem Shaikh's avatar
      procfs: replace all non-returning strlcpy with strscpy · 9e627588
      Azeem Shaikh authored
      strlcpy() reads the entire source buffer first.  This read may exceed the
      destination size limit.  This is both inefficient and can lead to linear
      read overflows if a source string is not NUL-terminated [1].  In an effort
      to remove strlcpy() completely [2], replace strlcpy() here with strscpy().
      No return values were used, so direct replacement is safe.
      
      [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
      [2] https://github.com/KSPP/linux/issues/89
      
      Link: https://lkml.kernel.org/r/20230510212457.3491385-1-azeemshaikh38@gmail.comSigned-off-by: default avatarAzeem Shaikh <azeemshaikh38@gmail.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
      Cc: Liu Shixin <liushixin2@huawei.com>
      Cc: Lorenzo Stoakes <lstoakes@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      9e627588
    • Colin Ian King's avatar
      scripts/spelling.txt: add more spellings to spelling.txt · 35a609a8
      Colin Ian King authored
      Some of the more common spelling mistakes and typos that I've found while
      fixing up spelling mistakes in the kernel over the past couple of
      releases.
      
      Link: https://lkml.kernel.org/r/20230427102835.83482-1-colin.i.king@gmail.comSigned-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      35a609a8
    • Prathu Baronia's avatar
      kthread: fix spelling typo and grammar in comments · 6a25212d
      Prathu Baronia authored
      - `If present` -> `If present,'
      - `reuturn` -> `return`
      - `function exit safely` -> `function to exit safely`
      
      Link: https://lkml.kernel.org/r/20230502090242.3037194-1-quic_pbaronia@quicinc.comSigned-off-by: default avatarPrathu Baronia <quic_pbaronia@quicinc.com>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Jason A. Donenfeld <Jason@zx2c4.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Sami Tolvanen <samitolvanen@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Zqiang <qiang1.zhang@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      6a25212d
  2. 28 May, 2023 8 commits
  3. 27 May, 2023 2 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus-6.4-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 4e893b5a
      Linus Torvalds authored
      Pull xen fixes from Juergen Gross:
      
       - a double free fix in the Xen pvcalls backend driver
      
       - a fix for a regression causing the MSI related sysfs entries to not
         being created in Xen PV guests
      
       - a fix in the Xen blkfront driver for handling insane input data
         better
      
      * tag 'for-linus-6.4-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        x86/pci/xen: populate MSI sysfs entries
        xen/pvcalls-back: fix double frees with pvcalls_new_active_socket()
        xen/blkfront: Only check REQ_FUA for writes
      4e893b5a
    • Linus Torvalds's avatar
      Merge tag 'char-misc-6.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 957f3f8e
      Linus Torvalds authored
      Pull char/misc fixes from Greg KH:
       "Here are some small driver fixes for 6.4-rc4. They are just two
        different types:
      
         - binder fixes and reverts for reported problems and regressions in
           the binder "driver".
      
         - coresight driver fixes for reported problems.
      
        All of these have been in linux-next for over a week with no reported
        problems"
      
      * tag 'char-misc-6.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        binder: fix UAF of alloc->vma in race with munmap()
        binder: add lockless binder_alloc_(set|get)_vma()
        Revert "android: binder: stop saving a pointer to the VMA"
        Revert "binder_alloc: add missing mmap_lock calls when using the VMA"
        binder: fix UAF caused by faulty buffer cleanup
        coresight: perf: Release Coresight path when alloc trace id failed
        coresight: Fix signedness bug in tmc_etr_buf_insert_barrier_packet()
      957f3f8e