1. 08 Jan, 2024 3 commits
    • Rafael J. Wysocki's avatar
      Merge branch 'pm-sleep' · f1e5e463
      Rafael J. Wysocki authored
      Merge system-wide power management updates for 6.8-rc1:
      
       - Fix possible deadlocks in the core system-wide PM code that occur if
         device-handling functions cannot be executed asynchronously during
         resune from system-wide suspend (Rafael J. Wysocki).
      
       - Clean up unnecessary local variable initializations in multiple
         places in the hibernation code (Wang chaodong, Li zeming).
      
       - Adjust core hibernation code to avoid missing wakeup events that
         occur after saving an image to persistent storage (Chris Feng).
      
       - Update hibernation code to enforce correct ordering during image
         compression and decompression (Hongchen Zhang).
      
       - Use kmap_local_page() instead of kmap_atomic() in copy_data_page()
         during hibernation and restore (Chen Haonan).
      
       - Adjust documentation and code comments to reflect recent task freezer
         changes (Kevin Hao).
      
       - Repair excess function parameter description warning in the
         hibernation image-saving code (Randy Dunlap).
      
      * pm-sleep:
        PM: sleep: Fix possible deadlocks in core system-wide PM code
        async: Introduce async_schedule_dev_nocall()
        async: Split async_schedule_node_domain()
        PM: hibernate: Repair excess function parameter description warning
        PM: sleep: Remove obsolete comment from unlock_system_sleep()
        Documentation: PM: Adjust freezing-of-tasks.rst to the freezer changes
        PM: hibernate: Use kmap_local_page() in copy_data_page()
        PM: hibernate: Enforce ordering during image compression/decompression
        PM: hibernate: Avoid missing wakeup events during hibernation
        PM: hibernate: Do not initialize error in snapshot_write_next()
        PM: hibernate: Do not initialize error in swap_write_page()
        PM: hibernate: Drop unnecessary local variable initialization
      f1e5e463
    • Rafael J. Wysocki's avatar
      Merge branches 'pm-cpuidle', 'pm-cpufreq' and 'pm-devfreq' · 0b055cf4
      Rafael J. Wysocki authored
      Merge cpuidle, cpufreq and devfreq updates for 6.8-rc1:
      
       - Add support for the Sierra Forest, Grand Ridge and Meteorlake SoCs to
         the intel_idle cpuidle driver (Artem Bityutskiy, Zhang Rui).
      
       - Do not enable interrupts when entering idle in the haltpoll cpuidle
         driver (Borislav Petkov).
      
       - Add Emerald Rapids support in no-HWP mode to the intel_pstate cpufreq
         driver (Zhenguo Yao).
      
       - Use EPP values programmed by the platform firmware as balance
         performance ones by default in intel_pstate (Srinivas Pandruvada).
      
       - Add a missing function return value check to the SCMI cpufreq driver
         to avoid unexpected behavior (Alexandra Diupina).
      
       - Fix parameter type warning in the armada-8k cpufreq driver (Gregory
         CLEMENT).
      
       - Rework trans_stat_show() in the devfreq core code to avoid buffer
         overflows (Christian Marangi).
      
       - Synchronize devfreq_monitor_[start/stop] so as to prevent a timer
         list corruption from occurring when devfreq governors are switched
         frequently (Mukesh Ojha).
      
      * pm-cpuidle:
        cpuidle: haltpoll: Do not enable interrupts when entering idle
        intel_idle: add Sierra Forest SoC support
        intel_idle: add Grand Ridge SoC support
        intel_idle: Add Meteorlake support
      
      * pm-cpufreq:
        cpufreq: intel_pstate: Add Emerald Rapids support in no-HWP mode
        cpufreq: armada-8k: Fix parameter type warning
        cpufreq: scmi: process the result of devm_of_clk_add_hw_provider()
        cpufreq: intel_pstate: Prioritize firmware-provided balance performance EPP
      
      * pm-devfreq:
        PM / devfreq: Synchronize devfreq_monitor_[start/stop]
        PM / devfreq: Convert to use sysfs_emit_at() API
        PM / devfreq: Fix buffer overflow in trans_stat_show
      0b055cf4
    • Rafael J. Wysocki's avatar
      Merge tag 'opp-updates-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm into pm-opp · 4ee4ffcc
      Rafael J. Wysocki authored
      Merge OPP (Operating Performance Points) updates for 6.8 from Viresh
      Kumar:
      
      "- Fix _set_required_opps when opp is NULL (Bryan O'Donoghue).
       - ti: Use device_get_match_data() (Rob Herring).
       - Minor cleanups around OPP level and other parts and call
         dev_pm_opp_set_opp() recursively for required OPPs (Viresh Kumar)."
      
      * tag 'opp-updates-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm:
        OPP: Rename 'rate_clk_single'
        OPP: Pass rounded rate to _set_opp()
        OPP: Relocate dev_pm_opp_sync_regulators()
        OPP: Move dev_pm_opp_icc_bw to internal opp.h
        OPP: Fix _set_required_opps when opp is NULL
        OPP: The level field is always of unsigned int type
        OPP: Check for invalid OPP in dev_pm_opp_find_level_ceil()
        OPP: Don't set OPP recursively for a parent genpd
        OPP: Call dev_pm_opp_set_opp() for required OPPs
        OPP: Use _set_opp_level() for single genpd case
        OPP: Level zero is valid
        opp: ti: Use device_get_match_data()
      4ee4ffcc
  2. 05 Jan, 2024 3 commits
  3. 03 Jan, 2024 5 commits
  4. 31 Dec, 2023 3 commits
  5. 30 Dec, 2023 5 commits
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 453f5db0
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Fix readers that are blocked on the ring buffer when buffer_percent
         is 100%. They are supposed to wake up when the buffer is full, but
         because the sub-buffer that the writer is on is never considered
         "dirty" in the calculation, dirty pages will never equal nr_pages.
         Add +1 to the dirty count in order to count for the sub-buffer that
         the writer is on.
      
       - When a reader is blocked on the "snapshot_raw" file, it is to be
         woken up when a snapshot is done and be able to read the snapshot
         buffer. But because the snapshot swaps the buffers (the main one with
         the snapshot one), and the snapshot reader is waiting on the old
         snapshot buffer, it was not woken up (because it is now on the main
         buffer after the swap). Worse yet, when it reads the buffer after a
         snapshot, it's not reading the snapshot buffer, it's reading the live
         active main buffer.
      
         Fix this by forcing a wakeup of all readers on the snapshot buffer
         when a new snapshot happens, and then update the buffer that the
         reader is reading to be back on the snapshot buffer.
      
       - Fix the modification of the direct_function hash. There was a race
         when new functions were added to the direct_function hash as when it
         moved function entries from the old hash to the new one, a direct
         function trace could be hit and not see its entry.
      
         This is fixed by allocating the new hash, copy all the old entries
         onto it as well as the new entries, and then use rcu_assign_pointer()
         to update the new direct_function hash with it.
      
         This also fixes a memory leak in that code.
      
       - Fix eventfs ownership
      
      * tag 'trace-v6.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        ftrace: Fix modification of direct_function hash while in use
        tracing: Fix blocked reader of snapshot buffer
        ring-buffer: Fix wake ups when buffer_percent is set to 100
        eventfs: Fix file and directory uid and gid ownership
      453f5db0
    • David Laight's avatar
      locking/osq_lock: Clarify osq_wait_next() · b106bcf0
      David Laight authored
      Directly return NULL or 'next' instead of breaking out of the loop.
      Signed-off-by: default avatarDavid Laight <david.laight@aculab.com>
      [ Split original patch into two independent parts  - Linus ]
      Link: https://lore.kernel.org/lkml/7c8828aec72e42eeb841ca0ee3397e9a@AcuMS.aculab.com/Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b106bcf0
    • David Laight's avatar
      locking/osq_lock: Clarify osq_wait_next() calling convention · 563adbfc
      David Laight authored
      osq_wait_next() is passed 'prev' from osq_lock() and NULL from
      osq_unlock() but only needs the 'cpu' value to write to lock->tail.
      
      Just pass prev->cpu or OSQ_UNLOCKED_VAL instead.
      
      Should have no effect on the generated code since gcc manages to assume
      that 'prev != NULL' due to an earlier dereference.
      Signed-off-by: default avatarDavid Laight <david.laight@aculab.com>
      [ Changed 'old' to 'old_cpu' by request from Waiman Long  - Linus ]
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      563adbfc
    • David Laight's avatar
      locking/osq_lock: Move the definition of optimistic_spin_node into osq_lock.c · 7c223098
      David Laight authored
      struct optimistic_spin_node is private to the implementation.
      Move it into the C file to ensure nothing is accessing it.
      Signed-off-by: default avatarDavid Laight <david.laight@aculab.com>
      Acked-by: default avatarWaiman Long <longman@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7c223098
    • Steven Rostedt (Google)'s avatar
      ftrace: Fix modification of direct_function hash while in use · d05cb470
      Steven Rostedt (Google) authored
      Masami Hiramatsu reported a memory leak in register_ftrace_direct() where
      if the number of new entries are added is large enough to cause two
      allocations in the loop:
      
              for (i = 0; i < size; i++) {
                      hlist_for_each_entry(entry, &hash->buckets[i], hlist) {
                              new = ftrace_add_rec_direct(entry->ip, addr, &free_hash);
                              if (!new)
                                      goto out_remove;
                              entry->direct = addr;
                      }
              }
      
      Where ftrace_add_rec_direct() has:
      
              if (ftrace_hash_empty(direct_functions) ||
                  direct_functions->count > 2 * (1 << direct_functions->size_bits)) {
                      struct ftrace_hash *new_hash;
                      int size = ftrace_hash_empty(direct_functions) ? 0 :
                              direct_functions->count + 1;
      
                      if (size < 32)
                              size = 32;
      
                      new_hash = dup_hash(direct_functions, size);
                      if (!new_hash)
                              return NULL;
      
                      *free_hash = direct_functions;
                      direct_functions = new_hash;
              }
      
      The "*free_hash = direct_functions;" can happen twice, losing the previous
      allocation of direct_functions.
      
      But this also exposed a more serious bug.
      
      The modification of direct_functions above is not safe. As
      direct_functions can be referenced at any time to find what direct caller
      it should call, the time between:
      
                      new_hash = dup_hash(direct_functions, size);
       and
                      direct_functions = new_hash;
      
      can have a race with another CPU (or even this one if it gets interrupted),
      and the entries being moved to the new hash are not referenced.
      
      That's because the "dup_hash()" is really misnamed and is really a
      "move_hash()". It moves the entries from the old hash to the new one.
      
      Now even if that was changed, this code is not proper as direct_functions
      should not be updated until the end. That is the best way to handle
      function reference changes, and is the way other parts of ftrace handles
      this.
      
      The following is done:
      
       1. Change add_hash_entry() to return the entry it created and inserted
          into the hash, and not just return success or not.
      
       2. Replace ftrace_add_rec_direct() with add_hash_entry(), and remove
          the former.
      
       3. Allocate a "new_hash" at the start that is made for holding both the
          new hash entries as well as the existing entries in direct_functions.
      
       4. Copy (not move) the direct_function entries over to the new_hash.
      
       5. Copy the entries of the added hash to the new_hash.
      
       6. If everything succeeds, then use rcu_pointer_assign() to update the
          direct_functions with the new_hash.
      
      This simplifies the code and fixes both the memory leak as well as the
      race condition mentioned above.
      
      Link: https://lore.kernel.org/all/170368070504.42064.8960569647118388081.stgit@devnote2/
      Link: https://lore.kernel.org/linux-trace-kernel/20231229115134.08dd5174@gandalf.local.home
      
      Cc: stable@vger.kernel.org
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Fixes: 763e34e7 ("ftrace: Add register_ftrace_direct()")
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      d05cb470
  6. 29 Dec, 2023 11 commits
  7. 28 Dec, 2023 6 commits
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v6.7-2' of... · 505e701c
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v6.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - Revive proper alignment for the ksymtab and kcrctab sections
      
       - Fix gen_compile_commands.py tool to resolve symbolic links
      
       - Fix symbolic links to installed debug VDSO files
      
       - Update MAINTAINERS
      
      * tag 'kbuild-fixes-v6.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        linux/export: Ensure natural alignment of kcrctab array
        kbuild: fix build ID symlinks to installed debug VDSO files
        gen_compile_commands.py: fix path resolve with symlinks in it
        MAINTAINERS: Add scripts/clang-tools to Kbuild section
        linux/export: Fix alignment for 64-bit ksymtab entries
      505e701c
    • Linus Torvalds's avatar
      Merge tag 'bcachefs-2023-12-27' of https://evilpiepirate.org/git/bcachefs · eeec2599
      Linus Torvalds authored
      Pull bcachefs fixes from Kent Overstreet:
       "Just a few fixes: besides a few one liners, we have a fix for
        snapshots + compression where the extent update path didn't account
        for the fact that with snapshots, we might split an existing extent
        into three, not just two; and a small fixup for promotes which were
        broken by the recent changes in the data update path to correctly take
        into account device durability"
      
      * tag 'bcachefs-2023-12-27' of https://evilpiepirate.org/git/bcachefs:
        bcachefs: Fix promotes
        bcachefs: Fix leakage of internal error code
        bcachefs: Fix insufficient disk reservation with compression + snapshots
        bcachefs: fix BCH_FSCK_ERR enum
      eeec2599
    • Helge Deller's avatar
      linux/export: Ensure natural alignment of kcrctab array · 753547de
      Helge Deller authored
      The ___kcrctab section holds an array of 32-bit CRC values.
      Add a .balign 4 to tell the linker the correct memory alignment.
      
      Fixes: f3304ecd ("linux/export: use inline assembler to populate symbol CRCs")
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      753547de
    • Bryan O'Donoghue's avatar
      OPP: Fix _set_required_opps when opp is NULL · ab7a781f
      Bryan O'Donoghue authored
      _set_required_opps can be called with opp NULL in _disable_opp_table().
      
      commit e37440e7 ("OPP: Call dev_pm_opp_set_opp() for required OPPs")
      requires the opp pointer to be non-NULL to function.
      
      [   81.253439] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000048
      [   81.438407] Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT)
      [   81.445296] Workqueue: pm pm_runtime_work
      [   81.449446] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      [   81.456609] pc : _set_required_opps+0x178/0x28c
      [   81.461288] lr : _set_required_opps+0x178/0x28c
      [   81.465962] sp : ffff80008078bb00
      [   81.469375] x29: ffff80008078bb00 x28: ffffd1cd71bfe308 x27: 0000000000000000
      [   81.476730] x26: ffffd1cd70ebc578 x25: ffffd1cd70a08710 x24: 00000000ffffffff
      [   81.484083] x23: 00000000ffffffff x22: 0000000000000000 x21: ffff56ff892b3c48
      [   81.491435] x20: ffff56f1071c10 x19: 0000000000000000 x18: ffffffffffffffff
      [   81.498788] x17: 2030207865646e69 x16: 2030303131207370 x15: 706f5f6465726975
      [   81.506141] x14: 7165725f7465735f x13: ffff5700f5c00000 x12: 00000000000008ac
      [   81.513495] x11: 00000000000002e4 x10: ffff5700f6700000 x9 : ffff5700f5c00000
      [   81.520848] x8 : 00000000fffdffff x7 : ffff5700f6700000 x6 : 80000000fffe0000
      [   81.528200] x5 : ffff5700fef40d08 x4 : 0000000000000000 x3 : 0000000000000000
      [   81.535551] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff56ff81298f80
      [   81.542904] Call trace:
      [   81.545437]  _set_required_opps+0x178/0x28c
      [   81.549754]  _set_opp+0x3fc/0x5c0
      [   81.553181]  dev_pm_opp_set_rate+0x90/0x26c
      [   81.557498]  core_power_v4+0x44/0x15c [venus_core]
      [   81.562509]  venus_runtime_suspend+0x40/0xd0 [venus_core]
      [   81.568135]  pm_generic_runtime_suspend+0x2c/0x44
      [   81.572983]  __rpm_callback+0x48/0x1d8
      [   81.576852]  rpm_callback+0x6c/0x78
      [   81.580453]  rpm_suspend+0x10c/0x570
      [   81.584143]  pm_runtime_work+0xc4/0xc8
      [   81.588011]  process_one_work+0x138/0x244
      [   81.592153]  worker_thread+0x320/0x438
      [   81.596021]  kthread+0x110/0x114
      [   81.599355]  ret_from_fork+0x10/0x20
      [   81.603052] Code: f10000ff fa5410e0 54fffbe1 97f05ae8 (f94026c5)
      [   81.609317] ---[ end trace 0000000000000000 ]---
      
      Fix it.
      
      Fixes: e37440e7 ("OPP: Call dev_pm_opp_set_opp() for required OPPs")
      Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      [ Viresh: Implemented the fix differently ]
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Reviewed-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      Tested-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      ab7a781f
    • Namjae Jeon's avatar
      ksmbd: fix slab-out-of-bounds in smb_strndup_from_utf16() · d10c7787
      Namjae Jeon authored
      If ->NameOffset/Length is bigger than ->CreateContextsOffset/Length,
      ksmbd_check_message doesn't validate request buffer it correctly.
      So slab-out-of-bounds warning from calling smb_strndup_from_utf16()
      in smb2_open() could happen. If ->NameLength is non-zero, Set the larger
      of the two sums (Name and CreateContext size) as the offset and length of
      the data area.
      Reported-by: default avatarYang Chaoming <lometsj@live.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      d10c7787
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2023-12-27-15-00' of... · f5837722
      Linus Torvalds authored
      Merge tag 'mm-hotfixes-stable-2023-12-27-15-00' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
      
      Pull misc fixes from Andrew Morton:
       "11 hotfixes. 7 are cc:stable and the other 4 address post-6.6 issues
        or are not considered backporting material"
      
      * tag 'mm-hotfixes-stable-2023-12-27-15-00' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        mailmap: add an old address for Naoya Horiguchi
        mm/memory-failure: cast index to loff_t before shifting it
        mm/memory-failure: check the mapcount of the precise page
        mm/memory-failure: pass the folio and the page to collect_procs()
        selftests: secretmem: floor the memory size to the multiple of page_size
        mm: migrate high-order folios in swap cache correctly
        maple_tree: do not preallocate nodes for slot stores
        mm/filemap: avoid buffered read/write race to read inconsistent data
        kunit: kasan_test: disable fortify string checker on kmalloc_oob_memset
        kexec: select CRYPTO from KEXEC_FILE instead of depending on it
        kexec: fix KEXEC_FILE dependencies
      f5837722
  8. 27 Dec, 2023 4 commits