summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2026-08-13Merge branch 'bpf-introduce-global-percpu-data'Andrii Nakryiko
Leon Hwang says: ==================== bpf: Introduce global percpu data This patch set introduces global percpu data, similar to commit 6316f78306c1 ("Merge branch 'support-global-data'"), to reduce restrictions in C for BPF programs. With this enhancement, it becomes possible to define and use global percpu variables, like the DEFINE_PER_CPU() macro in the kernel include/linux/percpu-defs.h. The section name for global peurcpu data is ".percpu". Even though, a one-byte percpu variable (e.g., char run SEC(".percpu") = 0;) can trigger a crash with Clang 17 [1], users are expected to use such small variables as global percpu data with newer Clang versions, which don't have the issue. The idea stems from the bpfsnoop [2], which itself was inspired by retsnoop [3]. During testing of bpfsnoop on the v6.6 kernel, two LBR (Last Branch Record) entries were observed related to the bpf_get_smp_processor_id() helper. Since commit 1ae6921009e5 ("bpf: inline bpf_get_smp_processor_id() helper"), the bpf_get_smp_processor_id() helper has been inlined on x86_64, reducing the overhead and consequently minimizing these two LBR records. However, the introduction of global percpu data offers a more robust solution. By leveraging the percpu_array map and percpu instruction, global percpu data can be implemented intrinsically. This feature also facilitates sharing percpu information between tail callers and callees or between freplace callers and callees through a shared global percpu variable. Previously, this was achieved using a 1-entry percpu_array map, which this patch set aims to improve upon. Links: [1] https://lore.kernel.org/bpf/fd1b3f58-c27f-403d-ad99-644b7d06ecb3@linux.dev/ [2] https://github.com/bpfsnoop/bpfsnoop [3] https://github.com/anakryiko/retsnoop Changes: v11 -> v12: * Improve feature check in bpf_object__create_maps() in libbpf. * Add percpu_array map support in bpf_map__set_value_size() in libbpf. * Exercise bpf_map__set_value_size() in selftest. * Drop dead warning in bpf_object__populate_internal_map() in libbpf. (Sashiko) * v11: https://lore.kernel.org/bpf/20260806163125.11172-1-leon.hwang@linux.dev/ v10 -> v11: * Drop env->prog->jit_requested check when inlining insns for global percpu data. * Do not autocreate percpu_array map when kernel does not have global percpu data support in libbpf. * Check map->btf_value_type_id in bpftool's is_skel_data(). * Exercise bpf_map__lookup_elem() in selftest. * Collect Reviewed-by tags from Emil, thanks. * Drop all duplicate blank lines in kernel/bpf/*.c. (Emil) * Factor out check_map_mem_read() helper. (Emil) * Check bpf_jit_supports_percpu_insn() first in percpu_array_map_direct_value_addr/meta(). (Emil) * Add comment for 'map->libbpf_type == LIBBPF_MAP_PERCPU' in libbpf's map_is_mmapable(). (Emil) * Init update_flags as a const var in libbpf's bpf_object__populate_internal_map(). (Emil) * Keep is_mmapable_map() beyond is_skel_data() in bpftool. (Emil) * Add 'run' and 'cpu_id' in selftest. (Emil) * Drop subskel test. Verify the generated subskel manually. (Emil) * Add comment to the raw insns in selftest. (Emil) * v10: https://lore.kernel.org/bpf/20260715153254.92010-1-leon.hwang@linux.dev/ v9 -> v10: * Rebase latest bpf-next tree to resolve code conflict in verifier in patch #1. * v9: https://lore.kernel.org/bpf/20260713154024.30851-1-leon.hwang@linux.dev/ v8 -> v9: * Use real name for percpu data maps in libbpf in patch #4. * Add long map name test in patch #6. * Move parse_cpu_mask_file() to test_percpu_data_on_cpus() in test in patch #6. * Validate map type in get_map_ident() for percpu data maps in patch #5. * Update code comment in verifier in patch #2. (per Andrii) * Pass 'type' to internal_map_name in libbpf in patch #4. (per Andrii) * Factor out the helper is_skel_data() in bpftool in patch #5. (per Quentin and Andrii) * v8: https://lore.kernel.org/bpf/20260629152406.52582-1-leon.hwang@linux.dev/ v7 -> v8: * Send patch #1 and #2 separately that fix interpreter fallback issues. (Andrii) * Use 'array->elem_size' to avoid 'range' local variable in percpu_array_map_direct_value_meta(). (Andrii) * Keep original map name for percpu data's map in libbpf. (Andrii) * Factor out helper bpf_map_is_skel_data() in bpftool. (Andrii) * Update commit message of direct access read-only percpu_array map. (Andrii) * Add test to verify that it is disallowed to directly write data of read-only percpu_array map. (Andrii) * Drop unused 'num_cpus' in test. (bot+bpf-ci) * Factor out helper test_percpu_data_on_cpus() in test. (bot+bpf-ci) * v7: https://lore.kernel.org/bpf/20260622143557.22955-1-leon.hwang@linux.dev/ v6 -> v7: * Use tgt_endian() in bpf_gen__map_update_elem() in patch #6. (Sashiko) * Use sizeof(args) in verifier_snprintf test in patch #10. (Sashiko) * Drop xlated test of v6. (Alexei) * v6: https://lore.kernel.org/bpf/20260615152646.27639-1-leon.hwang@linux.dev/ v5 -> v6: * Prevent running user addr_space_cast and addr_percpu insns in interpreter. (Sashiko) * Cast __percpu pointer to u64 with (__force unsigned long). (lkp) * Exclude BPF_MAP_TYPE_PERCPU_ARRAY in check_mem_access() before calling bpf_map_direct_read(), and add a test to verify it. (Sashiko, bot+bpf-ci) * Skip percpu data variables for subskeleton in bpftool. (Sashiko) * Protect skel->percpu using mprotect(..., PROT_READ) in light skeleton. (Sashiko, bot+bpf-ci) * Drop roundup() in tests. (Sashiko) * Call test_global_percpu_data_verifier_log() without test__start_subtest(). (Sashiko) * Cast insn->imm to __u64 with (__u32) in xlated test. (Sashiko) * Check cnt using the new idx in xlated test. (Sashiko) * v5: https://lore.kernel.org/bpf/20260608145113.65857-1-leon.hwang@linux.dev/ v4 -> v5: * Add prog->jit_requested check to prevent running percpu data in interpreter in patch #1. * Factor out verifier log tests using its own patch. * Address comments from Alexei: * Move map_type check from check_mem_access() to bpf_map_direct_read() in patch #2. * Move BPF_MAP_TYPE_INSN_ARRAY map_type check from const_reg_xfer() to bpf_map_direct_read() in patch #2. * Add a test to verify that the off of xlated ldimm64 insn matches the off encoded in the ELF ldimm64 insn. * Drop patch #5 of v4. * Address reviews from Sashiko: * Update commit message of patch #6 to indicate that maps.percpu->mmaped has been marked as read-only in libbpf. * Lookup elem on specified CPU using BPF_F_CPU in tests. * Drop unnecessary err == -EOPNOTSUPP in test. * Locate target field using its offset in the iter test. * v4: https://lore.kernel.org/bpf/20260414132421.63409-1-leon.hwang@linux.dev/ v3 -> v4: * Drop duplicate blank lines in verifier. * Add percpu data feature probe in libbpf. * Update percpu_array map using BPF_F_ALL_CPUS flag for lskel, if no cpu flag is set. * Add two tests to verify verifier log. * Add a test to verify mov64_percpu_reg instruction. * Add a test to verify bpf_iter for percpu data map. * Update percpu_array map using BPF_F_ALL_CPUS flag in libbpf (per Alexei and Andrii). * Address comments from Andrii: * Use .percpu as section identifier. * Use bpf_jit_supports_percpu_insn() instead of CONFIG_SMP. * Drop bpf_map__is_internal_percpu() API. * Drop unnecessary __aligned(8) in libbpf, verified by selftest. * Make mmap data read-only after loading prog. v3: https://lore.kernel.org/bpf/20250526162146.24429-1-leon.hwang@linux.dev/ v2 -> v3: * Use ".data..percpu" as PERCPU_DATA_SEC. * Address comment from Alexei: * Add u8, array of ints and struct { .. } vars to selftest. v2: https://lore.kernel.org/bpf/20250213161931.46399-1-leon.hwang@linux.dev/ v1 -> v2: * Address comments from Andrii: * Use LIBBPF_MAP_PERCPU and SEC_PERCPU. * Reuse mmaped of libbpf's struct bpf_map for .percpu map data. * Set .percpu struct pointer to NULL after loading skeleton. * Make sure value size of .percpu map is __aligned(8). * Use raw_tp and opts.cpu to test global percpu variables on all CPUs. * Address comments from Alexei: * Test non-zero offset of global percpu variable. * Test case about BPF_PSEUDO_MAP_IDX_VALUE. v1: https://lore.kernel.org/bpf/20250127162158.84906-1-leon.hwang@linux.dev/ rfc -> v1: * Address comments from Andrii: * Keep one image of global percpu variable for all CPUs. * Reject non-ARRAY map in bpf_map_direct_read(), check_reg_const_str(), and check_bpf_snprintf_call() in verifier. * Split out libbpf changes from kernel-side changes. * Use ".percpu" as PERCPU_DATA_SEC. * Use enum libbpf_map_type to distinguish BSS, DATA, RODATA and PERCPU_DATA. * Avoid using errno for checking err from libbpf_num_possible_cpus(). * Use "map '%s': " prefix for error message. rfc: https://lore.kernel.org/bpf/20250113152437.67196-1-leon.hwang@linux.dev/ ==================== Link: https://patch.msgid.link/20260813152324.97937-1-leon.hwang@linux.dev Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2026-08-13selftests/bpf: Verify bpf_iter for global percpu dataLeon Hwang
Add a test to verify that it is OK to iter the percpu_array map used for global percpu data. Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com> Link: https://lore.kernel.org/bpf/20260813152324.97937-11-leon.hwang@linux.dev
2026-08-13selftests/bpf: Test verifier log for global percpu dataLeon Hwang
Add two tests to verify the verifier log "R%d points to percpu_array map which cannot be used as const string\n". Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com> Link: https://lore.kernel.org/bpf/20260813152324.97937-10-leon.hwang@linux.dev
2026-08-13selftests/bpf: Test direct reading/writing read-only percpu_array mapLeon Hwang
Verify these two cases: 1. Direct reading the data of read-only percpu data's percpu_array map is allowed. 2. Direct writing the data of read-only percpu data's percpu_array map is disallowed. Assisted-by: Codex:gpt-5.5-xhigh Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20260813152324.97937-9-leon.hwang@linux.dev
2026-08-13selftests/bpf: Add tests to verify global percpu dataLeon Hwang
If the arch, like s390x, does not support percpu insn, these cases won't test global percpu data by checking FEAT_PERCPU_DATA support. The following APIs have been tested for global percpu data: 1. bpf_map__set_initial_value() 2. bpf_map__initial_value() 3. bpf_map__set_value_size() 4. generated percpu struct pointer pointing to internal map's mmaped data 5. bpf_map__lookup_elem() for global percpu data map 6. bpf_map_lookup_elem_flags() for global percpu data map At the same time, the case is also tested with 'bpftool gen skeleton -L'. Assisted-by: Codex:gpt-5.5-xhigh Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20260813152324.97937-8-leon.hwang@linux.dev
2026-08-13bpftool: Generate skeleton for global percpu dataLeon Hwang
Enhance bpftool to generate skeletons that properly handle global percpu variables. The generated skeleton now includes a dedicated structure for percpu data, allowing users to initialize and access percpu variables more efficiently. For global percpu variables, the skeleton now includes a nested structure, e.g.: struct test_global_percpu_data { struct bpf_object_skeleton *skeleton; struct bpf_object *obj; struct { struct bpf_map *percpu; } maps; // ... struct test_global_percpu_data__percpu { int data; char run; struct { char set; int i; int nums[7]; } struct_data; int nums[7]; } *percpu; // ... }; * The "struct test_global_percpu_data__percpu *percpu" points to initialized data, which is actually "maps.percpu->mmaped". * Before loading the skeleton, updating the "struct test_global_percpu_data__percpu *percpu" modifies the initial value of the corresponding global percpu variables. * After loading the skeleton, "maps.percpu->mmaped" has been marked as read-only in libbpf. If users want to update the global percpu variables, they have to update the "maps.percpu" map instead. * For lightweight skeleton, "lskel->percpu" will be protected by "mprotect(p, sz, PROT_READ)". * For subskeleton, those variables of global percpu data will be skipped. Assisted-by: Codex:gpt-5.5-xhigh Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Quentin Monnet <qmo@kernel.org> Link: https://lore.kernel.org/bpf/20260813152324.97937-7-leon.hwang@linux.dev
2026-08-13libbpf: Add support for global percpu dataLeon Hwang
Add support for global percpu data in libbpf by adding a new ".percpu" section, similar to ".data". It enables efficient handling of percpu global variables in bpf programs. When generating loader for lightweight skeleton, update the percpu_array map used for global percpu data using BPF_F_ALL_CPUS, in order to update values across all CPUs using one value slot. Unlike global data, the mmaped data for global percpu data will be marked as read-only after populating the percpu_array map. Thereafter, users can read those initialized percpu data after loading prog. If they want to update the percpu data after loading prog, they have to update the percpu_array map using key=0 instead. Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20260813152324.97937-6-leon.hwang@linux.dev
2026-08-13libbpf: Probe percpu data featureLeon Hwang
libbpf needs a reliable way to distinguish kernels that can support global percpu data from those that cannot. Add a dedicated feature probe, so libbpf can make capability decisions early and fail predictably when global percpu data is unavailable. Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20260813152324.97937-5-leon.hwang@linux.dev
2026-08-13bpf: Introduce global percpu dataLeon Hwang
Introduce global percpu data, inspired by the commit 6316f78306c1 ("Merge branch 'support-global-data'"). It enables the definition of global percpu variables in BPF, similar to the include/linux/percpu-defs.h::DEFINE_PER_CPU() macro. For example, in BPF, it is able to define a global percpu variable like: int data SEC(".percpu"); With this patch, tools like retsnoop [1] and bpfsnoop [2] can simplify their BPF code for handling LBRs. The code can be updated from static struct perf_branch_entry lbrs[1][MAX_LBR_ENTRIES] SEC(".data.lbrs"); to static struct perf_branch_entry lbrs[MAX_LBR_ENTRIES] SEC(".percpu.lbrs"); This eliminates the need to retrieve the CPU ID using the bpf_get_smp_processor_id() helper. Additionally, by reusing global percpu data map, sharing information between tail callers and callees or freplace callers and callees becomes simpler compared to reusing percpu_array maps. Links: [1] https://github.com/anakryiko/retsnoop [2] https://github.com/bpfsnoop/bpfsnoop Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/bpf/20260813152324.97937-4-leon.hwang@linux.dev
2026-08-13bpf: Factor out check_map_mem_read helper in verifierLeon Hwang
In the next commit, percpu_array map will add map_direct_value_addr support. IOW, it will add a map_type check in the iff condition of the bpf_map_direct_read() code block, which will reduce the code block readability. Hence, factor out check_map_mem_read helper to improve the readability, and the maintainability for the percpu_array map case. Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/bpf/20260813152324.97937-3-leon.hwang@linux.dev
2026-08-13bpf: Drop duplicate blank lines in kernel/bpf/Leon Hwang
There are many adjacent blank lines in kernel/bpf/ that have accumulated over time. Drop them for cleanup. No functional changes intended. Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com> Link: https://lore.kernel.org/bpf/20260813152324.97937-2-leon.hwang@linux.dev
2026-08-13x86/pkeys: Fix pkey_alloc() return value when pkeys are not supportedBijan Tabatabai
The man page for pkey_alloc(2) specifies that it should return -1 with the errno set to ENOSPC when pkeys are not supported [1]. However, on x86 pkey_alloc() sets errno to EINVAL when called for the first time on a CPU that does not support pkeys. The root cause of this is the x86 implementation of mm_pkey_alloc() not directly checking if pkeys are supported. It only checks if all the pkeys have been allocated by comparing the allocation map against all_pkeys_mask. When OSPKE is not enabled, init_new_context() skips the initialization of the allocation map, leaving it as 0, while all_pkeys_mask is 1. mm_pkey_alloc() interprets this as there being a pkey available and it returns pkey 0. Then, pkey_alloc() fails with -EINVAL from arch_set_user_pkey_access() instead of returning -ENOSPC. Subsequent calls to pkey_alloc() do return -ENOSPC because pkey 0 is left marked as allocated. Change mm_pkey_alloc() to directly check if OSPKE is enabled, and return -1 if it is not, which causes pkey_alloc() to return -ENOSPC. The arm64 and powerpc implementations of mm_pkey_alloc() already do this check. [1] https://man7.org/linux/man-pages/man2/pkey_alloc.2.html [ dhansen: use arch_pkeys_enabled() to follow arm ] Fixes: e8c24d3a23a4 ("x86/pkeys: Allocation/free syscalls") Signed-off-by: Bijan Tabatabai <btabatabai@wisc.edu> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Link: https://patch.msgid.link/20260716220604.26452-1-bijan311@gmail.com
2026-08-13selftests/cgroup: Preserve CPU hotplug write errorsRui Qi
The cpuset partition root state selftest checks several CPU hotplug transitions. If writing to a CPU online file fails, the helper still runs pause afterwards and returns the status of pause instead of the failed write. This hides the real hotplug failure and can make later checks run against expectations for a transition that never happened. Move the write before the bookkeeping and return when it fails, so callers can observe the hotplug error and the test does not record a CPU as offline unless the offline operation actually succeeded. Also change the O* command handler in set_ctrl_state() to use "eval $COMM $REDIRECT" like all other handlers. The previous version set COMM but still called write_cpu_online directly, bypassing the redirect that captures stderr for error reporting. Changes since v1: - Use eval $COMM $REDIRECT in the O* handler instead of calling write_cpu_online directly (Waiman Long) Fixes: a8c52eba880a ("kselftest/cgroup: Add cpuset v2 partition root state test") Signed-off-by: Rui Qi <qirui.001@bytedance.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2026-08-13workqueue: annotate racy p->wake_cpu accesses in kick_pool_pick()Breno Leitao
kick_pool_pick() reads and writes p->wake_cpu while the scheduler can update it concurrently. KCSAN reports: BUG: KCSAN: data-race in kick_pool_pick+0xf8/0x2d8 race at unknown origin, with read to 0xffff000663229da4 of 4 bytes by task 1817002 on cpu 40: kick_pool_pick+0xf8/0x2d8 process_scheduled_works+0x2bc/0x888 worker_thread+0x394/0x548 kthread+0x1b8/0x1f0 ret_from_fork+0x10/0x20 value changed: 0x0000002b -> 0x0000002f The race is harmless. wake_cpu is a best-effort placement hint: every writer stores a valid CPU id and the wakeup path validates it through select_task_rq(), so a stale value only affects which CPU the worker wakes up on. Mark both accesses with READ_ONCE() and WRITE_ONCE() to document that they are intentionally racy and to stop the compiler from reloading or tearing them. Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Bradley Morgan <include@grrlz.net> Signed-off-by: Tejun Heo <tj@kernel.org>
2026-08-13PCI: Fix 32-bit config write in Intel PCH Root Port MPC ACS quirkMohamad Raizudeen
pci_quirk_enable_intel_rp_mpc_acs() reads a 32-bit DWORD from the MPC register, sets bit 26 (INTEL_MPC_REG_IRBNCE), but it writes it back using pci_write_config_word(). Because bit 26 resides in the upper 16 bits of the 32-bit register, a 16-bit write drops the newly set bit. The quirk logs that it is enabling IRBNCE, but the hardware never actually receives the command. Use pci_write_config_dword() to ensure the full 32-bit value is written back to the hardware. Fixes: d99321b63b1f ("PCI: Enable quirks for PCIe ACS on Intel PCH root ports") Signed-off-by: Mohamad Raizudeen <raizudeen.kerneldev@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260723171203.4892-1-raizudeen.kerneldev@gmail.com
2026-08-13ASoC: dt-bindings: es8316: Fix supply property constraintsHongyang Zhao
The DT meta-schema requires a `then` clause when an `if` condition has an `else` clause. Invert the compatible check and move the supply property restrictions to `then` so they remain allowed only for ES8316. Fixes: e9966d450b46 ("ASoC: dt-bindings: es8316: Add regulator supplies") Reported-by: Rob Herring <robh@kernel.org> Closes: https://lore.kernel.org/r/20260812194234.GA693895-robh@kernel.org Signed-off-by: Hongyang Zhao <hongyang.zhao@thundersoft.com> Link: https://patch.msgid.link/20260813-b4-es8316-binding-conditional-fix-v1-1-6cd56aa1370c@thundersoft.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13s390/pci: Store PCI error information for passthrough devicesFarhan Ali
For a passthrough device we need co-operation from user space to recover the device. This would require to bubble up any error information to user space. Let's store this error information for passthrough devices, so it can be retrieved later. We can now have userspace drivers (vfio-pci based) on s390x. The userspace drivers will not have any KVM fd and so no kzdev associated with them. So we need to update the logic for detecting passthrough devices to not depend on struct kvm_zdev. Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Farhan Ali <alifm@linux.ibm.com> Link: https://lore.kernel.org/r/20260630165553.725-2-alifm@linux.ibm.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-08-13Merge branch 'slot' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci ↵Alex Williamson
into v7.3/vfio/s390x-pci-error-recovery PCI dependencies from shared branch supporting vfio-pci error recovery on s390x. Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-08-13spi: virtio: mark device ready before registering the controllerJasper Wise
virtio_spi_probe() registers the SPI controller with devm_spi_register_controller(). spi_register_controller() binds a child inline unless its driver has asked for asynchronous probing, so a peripheral that performs a transfer during its own probe reaches virtio_spi_transfer_one(), which kicks the virtqueue before probe has returned. The driver never calls virtio_device_ready(), so DRIVER_OK is set on its behalf by virtio_dev_probe(), only once probe has returned. The virtio spec is explicit about that ordering in 3.1 Device Initialization: | The driver MUST NOT send any buffer available notifications to the | device before setting DRIVER_OK. A device that waits for DRIVER_OK before servicing the queue therefore leaves the transfer unanswered, and virtio_spi_transfer_one() waits for its completion with no timeout, so probe never returns. Mark the device ready before registering the controller, as done for the same reason in commit f5866db64f34 ("virtio_console: enable VQs early") and commit 1d774589f924 ("i2c: virtio: mark device ready before registering the adapter"). Fixes: f98cabe3f6cf ("SPI: Add virtio SPI driver") Signed-off-by: Jasper Wise <jaspwise@amazon.co.uk> Link: https://patch.msgid.link/20260813084618.613172-1-jaspwise@amazon.co.uk Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13nvmet: fix max_qid race between configfs and controller allocationMaurizio Lombardi
The function nvmet_subsys_attr_qid_max_store() can race against nvmet_alloc_ctrl() when a subsystem's max_qid limit is modified. Suppose max_qid is currently 64. If nvmet_alloc_ctrl() executes: ctrl->sqs = kzalloc_objs(struct nvmet_sq *, subsys->max_qid + 1); and at this exact point, a userspace process changes max_qid to 128, nvmet_subsys_attr_qid_max_store() will set the new max_qid value. It attempts to delete active controllers to force a reconnect, but the new controller won't be deleted because it hasn't been added to the subsys->ctrls list yet. nvmet_alloc_ctrl() then proceeds and adds the new controller to the subsys->ctrls list. Later, when nvmet_install_queue() is called, it will see max_qid set to 128, but the memory allocated for sqs is only sized for 64 entries. This results in a KASAN out-of-bounds warning and potential memory corruptions. Fix this by protecting the queue allocations and list insertion in nvmet_alloc_ctrl() with down_read(&nvmet_config_sem). Because nvmet_subsys_attr_qid_max_store() acquires down_write(&nvmet_config_sem) to modify the attribute, this safely prevents the configfs writer from modifying max_qid during controller creation. Copy the max_qid from the subsystem to the controller's structure during the allocation; ctrl->max_qid never changes as long as the controller remains in LIVE state, so this will prevent similar race conditions. Fixes: 3e980f5995e0 ("nvmet: expose max queues to configfs") Reported-by: syzbot+2626e846cd2585c9aa67@syzkaller.appspotmail.com Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
2026-08-13nvme: nvme-fc: Fix nvme_fc_create_hw_io_queues() queue deletion in error pathEwan D. Milne
nvme_fc_create_hw_io_queues() will call __nvme_fc_delete_hw_queue() for the last queue on which __nvme_fc_create_hw_queue() reported an error when deleting all the io queues if they cannot all be created. This is incorrect since the last queue did not actually get created. The most recent change to this code was commit 17a1ec08ce70 ("nvme/fc: simplify error handling of nvme_fc_create_hw_io_queues") which moved the cleanup to the delete_queues: label and changed the loop bounds, however the code was not correct prior to this change in a different way. The original commit e399441de911 ("nvme-fabrics: Add host support for FC transport") had a different error which called __nvme_fc_delete_hw_queue() on queue index 0 which is used for the admin queue. Fix this by correcting the initial loop index when deleting the io queues. Fixes: 17a1ec08ce70 ("nvme/fc: simplify error handling of nvme_fc_create_hw_io_queues") Fixes: e399441de911 ("nvme-fabrics: Add host support for FC transport") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4-6 Reviewed-by: Maurizio Lombardi <mlombard@redhat.com> Reviewed-by: Laurence Oberman <loberman@redhat.com> Reviewed-by: Justin Tee <justin.tee@broadcom.com> Signed-off-by: Ewan D. Milne <emilne@redhat.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
2026-08-13selftests/bpf: Fix chained_global_func_calls_success() for cpu v4Yonghong Song
The chained_global_func_calls_success() test hardcodes the instruction counts reported by the verifier's per-subprog stats: subprog {{[0-9]+}} (global_good) global insns_self 5 insns_total 5 stack processed 14 insns global_good() does 'return arr[0]', where arr[] is an int array and the return type is long. Without cpu v4 this is a zero-extending load followed by a <<32/s>>32 sign-extension pair. With -mcpu=v4 llvm emits a single sign-extending load instead: 18: (18) r1 = 0xffa00000008eb000 20: (81) r0 = *(s32 *)(r1 +0) 21: (95) exit so the subprog is 3 insns rather than 5, and the whole program is 12 processed insns rather than 14. test_progs-cpuv4 fails with: EXPECTED REGEX: 'subprog {{[0-9]+}} (global_good) global insns_self 5 insns_total 5 stack' #606/1 verifier_global_subprogs/chained_global_func_calls_success:FAIL Select the expected counts based on __BPF_CPU_VERSION__. Fixes: c2e6c7de8830 ("bpf: Show more useful info in stack depth stats") Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20260813150641.3347662-1-yonghong.song@linux.dev
2026-08-13ALSA: seq: midi: Serialize input teardown with event_inputJohn Keeping
snd_midi_input_event() must not be running while a rawmidi substream is closing, since this can lead to the trigger state becoming out-of-step through this sequence in snd_rawmidi_input_trigger(): snd_rawmidi_input_trigger(up=0) snd_midi_input_event() -> snd_rawmidi_kernel_read() -> snd_rawmidi_input_trigger(up=1) -> cancel_work_sync() which ends with the underlying device being active unexpectedly. When this is called from close_substream(), further input can re-trigger the input event leaving it running after rawmidi_release_priv() has set rfile->rmidi to NULL which leads to: Unable to handle kernel NULL pointer dereference at virtual address 00000000000000b0 Call trace: snd_midi_input_event+0x3c/0x134 [snd_seq_midi] (P) snd_rawmidi_input_event_work+0x1c/0x2c process_one_work+0x150/0x3a4 worker_thread+0x190/0x318 Apply a similar approach to commit ef7607ab1c8ad ("ALSA: seq: midi: Serialize output teardown with event_input") which fixed the same issue in the output direction, but updated to use RCU following Takashi Iwai's proposed follow-on patch [1]. With this change in place, midisynth_unsubscribe() clears the input file so snd_midi_input_event() will not re-trigger the stream and will be quiesced by the cancel_work_sync() in snd_rawmidi_input_trigger(). [1] https://lore.kernel.org/linux-sound/20260813144224.753399-1-tiwai@suse.de/ Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: John Keeping <jkeeping@inmusicbrands.com> Link: https://patch.msgid.link/20260813150810.795393-1-jkeeping@inmusicbrands.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-08-13ALSA: hda/intel: Add sanity check for BAR0 sizeTakashi Iwai
The recent reports from syzkaller showed that we can bind any wild PCI device to HD-audio controller, and if PCI BAR of the device is too small, it may lead to a crash, as the driver believes as if the full register range were accessible. For avoiding such a problem, add a safeguard before the actual probe to check the available BAR0 size. Note that the threshold (0x200) is chosen to cover all needed registers at probing. But this doesn't mean that it would cover fully for all features including the extended ones. Reported-by: syzbot+10cd2d1efe8eeb604bee@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=10cd2d1efe8eeb604bee Reported-by: syzbot+5ebe7cd17e48b4293660@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=5ebe7cd17e48b4293660 Link: https://patch.msgid.link/20260813150354.763502-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-08-13ALSA: seq: midi: Optimize event_input locking with RCUTakashi Iwai
The recent fix for serializing the output teardown introduced a spinlock invocation at every MIDI output event via event_process_midi. Since this is a hot path, let's do performance optimization with RCU. The new output_substream __rcu pointer is published via rcu_assign_pointer() in midisynth_use() after output_rfile is set, and cleared in midisynth_unuse() before the resource teardown. event_process_midi() reads it under rcu_read_lock() and bumps output_use_lock inside that section, which is necessary to close the window between the pointer dereference and the refcount increment. midisynth_unuse() calls synchronize_rcu() before snd_use_lock_sync(): this guarantees that any reader who obtained a non-NULL pointer has already called atomic_inc (output_use_lock), so the subsequent snd_use_lock_sync() sees the correct in-flight count. Fixes: ef7607ab1c8a ("ALSA: seq: midi: Serialize output teardown with event_input") Link: https://patch.msgid.link/20260813144224.753399-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-08-13clocksource/drivers/armada: Unwind timer clock on init failureYuho Choi
The Armada timer init paths enable their clock before calling the common initialization routine. If that routine returns an error, the clock is left enabled even though the timer was not initialized successfully. Fixes: 12549e27c63c ("clocksource/drivers/time-armada-370-xp: Convert init function to return error") Signed-off-by: Yuho Choi <dbgh9129@gmail.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Link: https://patch.msgid.link/20260802213545.565913-1-dbgh9129@gmail.com
2026-08-13clocksource/drivers/rtl-otto: Change driver to use __raw reads and writesRustam Adilov
As it stands, the driver uses ioread32 and iowrite32 for register access and it works fine. However this stops working when the SWAP_IO_SPACE config is enabled as this drivers expects ioread32 and iowrite32 to be in native endian (that is big endian for currently supported SoCs). RTL9607C is a big endian MIPS SoC that has identical timer as the already supported chips but needs to have SWAP_IO_SPACE to have a functioning little endian USB host. Fix this by replacing all instances of ioread32 and iowrite32 with __raw_readl and __raw_writel variants. Since they essentially do the same register access, this shouldn't affect anything on other machines. Signed-off-by: Rustam Adilov <adilov@disroot.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Link: https://patch.msgid.link/20260725175510.77240-1-adilov@disroot.org
2026-08-13clocksource/drivers/samsung_pwm: Switch to raw_spinlock_t typeMarek Szyprowski
Samsung PWM timer might be used as a clock source on some legacy systems. When PREEMPT_RT is enabled on ARM, regular spinlock is converted to a sleeping lock (mutex-based), which must not be used in atomic context such as hard interrupt handlers. Switch the samsung_pwm_lock to the raw_spinlock, which remains a true non-sleeping spinlock even under PREEMPT_RT. Fixes: 7aac482e6290 ("clocksource: samsung_pwm_timer: Make PWM spinlock global") Fixes: f11899894c0a ("clocksource: add samsung pwm timer driver") Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Uwe Kleine-König <ukleinek@kernel.org> Link: https://patch.msgid.link/20260713085653.1145015-1-m.szyprowski@samsung.com
2026-08-13clocksource/drivers/clps711x: Do not unmap clocksource MMIOGuangshuo Li
clps711x_clksrc_init() stores the timer base address in the static tcd pointer and registers it as both the clocksource MMIO address and the sched_clock read address. The clocksource init path must therefore keep the mapping alive after clps711x_timer_init() returns. However, the shared unmap_io exit path is also reached after successful clocksource registration, so the MMIO mapping is torn down while the clocksource and sched_clock readers may still access it. Return directly after successful clocksource registration and leave the mapping alive for the registered readers. Keep the unmap_io path for the error paths and for the clockevent init path. Fixes: cd32e596f02f ("clocksource/drivers/clps711x: Fix resource leaks in error paths") Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Link: https://patch.msgid.link/20260704175451.256364-1-lgs201920130244@gmail.com
2026-08-13clocksource/drivers/nxp-pit: Fix IRQ leak on cpuhp_setup_state error pathWenTao Liang
When cpuhp_setup_state fails after pit_clockevent_per_cpu_init has successfully called request_irq, the error handling jumps directly to out_pit_clocksource_unregister without freeing the registered IRQ. This leaks the IRQ line and, since kfree(pit) follows, leaves a dangling pointer registered as the interrupt handler's dev_id, potentially leading to a use-after-free if the IRQ fires afterwards. Fix it by calling pit_clockevent_per_cpu_exit to properly release the IRQ before falling through to the existing cleanup chain. Suggested-by: Greg KH <gregkh@linuxfoundation.org> Fixes: bee33f22d7c3 ("clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support") Cc: stable@vger.kernel.org Signed-off-by: WenTao Liang <vulab@iscas.ac.cn> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Link: https://patch.msgid.link/20260628130700.45680-1-vulab@iscas.ac.cn
2026-08-13clocksource/drivers/timer-sun4i: Advertise a real minimum deltaFelix Yan
sun4i_clkevt_next_event() compensates for the timer stop/start synchronization delay by programming evt - TIMER_SYNC_TICKS into the hardware interval register. The clockevent device currently advertises TIMER_SYNC_TICKS as min_delta_ticks, so the clockevents core is allowed to call set_next_event() with evt == TIMER_SYNC_TICKS. That programs a zero-tick interval. With oneshot/highres/nohz timer operation this can leave the next event stuck, which was observed as a boot hang on Allwinner D1 after the clockevents core started reusing forced minimum-delta events. Advertise one extra tick instead, so the smallest event accepted by the core still programs at least one hardware tick after the synchronization compensation. Fixes: 12e1480bcb49 ("clocksource: sun4i: Report the minimum tick that we can program") Reported-by: Indrek Kruusa <indrek.kruusa@gmail.com> Closes: https://lore.kernel.org/linux-riscv/CA+fTLhgLmTY+exGujKf8OYYQvcEW5X5NJ_5sLq2AYL6zER2c0A@mail.gmail.com/ Assisted-by: Codex:gpt-5.5 Signed-off-by: Felix Yan <felixonmars@archlinux.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Tested-by: Indrek Kruusa <indrek.kruusa@gmail.com> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/linux-riscv/CA+fTLhgLmTY+exGujKf8OYYQvcEW5X5NJ_5sLq2AYL6zER2c0A@mail.gmail.com/ Link: https://patch.msgid.link/20260624220434.4183732-1-felixonmars@archlinux.org
2026-08-13clocksource: Remove redundant dev_err()/dev_err_probe()Pan Chuang
Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in devm_request_*_irq()"), devm_request_irq() automatically logs detailed error messages on failure. Remove the now-redundant driver-specific dev_err() and dev_err_probe() calls. Signed-off-by: Pan Chuang <panchuang@vivo.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Link: https://patch.msgid.link/20260713130740.293502-1-panchuang@vivo.com
2026-08-13clocksource/drivers/sh_cmt: Use named initializers for platform_device_id arraysUwe Kleine-König (The Capable Hub)
Named initializers are better readable and more robust to changes of the struct definition. This robustness is relevant for a planned change to struct platform_device_id replacing .driver_data by an anonymous union. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Link: https://patch.msgid.link/6a6951b86f0e9a2ab4a378ab63edf7a487f1d693.1781687723.git.u.kleine-koenig@baylibre.com
2026-08-13clocksource/drivers/sh_mtu2: Drop unused assignment of platform_device_idUwe Kleine-König (The Capable Hub)
The driver explicitly sets the .driver_data member of struct platform_device_id to zero without relying on that value. Drop these unused assignments. While touching this array drop the comma after the list terminator and use a named initializer for .name. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Link: https://patch.msgid.link/a44e520e437f1b4017b3205c274a2457cbdeb43d.1781687723.git.u.kleine-koenig@baylibre.com
2026-08-13Revert "wifi: mt76: Disable napi when removing device"Mikhail Gavrilov
This reverts commit 13b7e6a96a005c656d38f3da51581deaf9866375. That commit made mt76_dma_cleanup() disable every RX NAPI instance before deleting it, to silence WARNs in __netif_napi_del_locked() and page_pool_disable_direct_recycling() seen when unloading mt7915e with an MT7916. On mt7921e and mt7925e the same instances are already disabled earlier, in mt7921e_unregister_device() and mt7925e_unregister_device(), which only afterwards call mt792x_dma_cleanup() -> mt76_dma_cleanup(). Each instance is therefore disabled twice, and napi_disable() is not idempotent: on return it leaves NAPIF_STATE_SCHED and NAPIF_STATE_NPSVC set, so the second call spins in usleep_range() forever, waiting for bits that nobody will clear. mt7921_pci_shutdown() and mt7925_pci_shutdown() reuse the remove path, so this is hit on every reboot, poweroff and module unload. It is silent: the stuck task keeps sleeping and rescheduling, so neither the hung task detector nor the lockup detectors fire, and the last line on the console is "systemd-shutdown[1]: Rebooting." task:modprobe state:D stack:25720 pid:7954 tgid:7954 Call Trace: <TASK> __schedule+0x11b8/0x26d0 schedule+0xe7/0x2f0 schedule_hrtimeout_range_clock+0x218/0x330 usleep_range_state+0x133/0x1b0 napi_disable_locked+0x37d/0x5f0 napi_disable+0x43/0x80 mt76_dma_cleanup+0x2b4/0x860 [mt76] mt7921_pci_remove+0x17f/0x350 [mt7921e] pci_device_remove+0xb6/0x1e0 device_release_driver_internal+0x38d/0x540 driver_detach+0xd0/0x1b0 bus_remove_driver+0x127/0x2d0 pci_unregister_driver+0x2a/0x280 __do_sys_delete_module+0x36a/0x5b0 do_syscall_64+0x11c/0x6d0 entry_SYSCALL_64_after_hwframe+0x76/0x7e </TASK> Dropping the two driver-side loops instead was tried and rejected: with them gone, the RX poll can reach mt76_token_release() via PKT_TYPE_TXRX_NOTIFY and mt7921_mac_tx_free() while mt76_connac2_tx_token_put() is running idr_destroy(&dev->token) outside token_lock, which is a use-after-free rather than a hang [1]. Revert for now, so that reboot, poweroff and module unload work again. The WARNs on mt7915e are a less severe problem than an unbootable machine, and fixing them belongs in the drivers that delete the NAPI instances, where each one can pick a point that is safe for its own teardown order, rather than in the shared mt76_dma_cleanup(). [ This is the "landing soonish" known regression fix mentioned in the previous networking merge commit - Linus ] Reported-by: Bert Karwatzki <spasswolf@web.de> Closes: https://lore.kernel.org/all/20260724151419.26014-1-spasswolf@web.de/ Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221818 Link: https://lore.kernel.org/all/20260730050428.GA73812@sol/ [1] Signed-off-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com> Acked-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr> Fixes: 13b7e6a96a00 ("wifi: mt76: Disable napi when removing device") Tested-by: Devin Wittmayer <lucid_duck@justthetip.ca> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-08-13Merge tag 'net-7.2-rc8' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net Pull networking fixes from Paolo Abeni: "Including fixes from netfilter. There is a known WiFi/mt76 regression, waiting for a complete fix that should land soonish. Previous releases - regressions: - tcp: fix icsk_ack.ato bitfield overflow - af_unix: Unlink scc_entry in unix_del_edge() - ipv4: fix use-after-free in fib_nhc_update_mtu() - netfilter: - ipset: fix refcount race between list:set GC and swap - nf_tables_offload: suppress WARN_ON_ONCE for ENOMEM in abort path - sched: act_ct: fix sk_buff leak when the header checks reject a packet - sctp: clear new_transport when removing a peer - dibs: correct freeing of dmb_clientid_arr - ovpn: fix NULL dereference when killing missing key - eth: - veth: fix queue index used to wake the peer txq in veth_poll - ngbe: fix NULL pointer dereference in non-MSI-X interrupt enabling - gve: fix zero-length skb frag with header-split Previous releases - always broken: - core: fix skb length accounting after generic XDP frag adjustment - af_packet: don't send zero-byte data in tpacket_snd(). - eth: - bnxt: avoid deadlock when canceling IRQ affinity notifier - ipvlan: inherit needed_headroom and needed_tailroom from phy_dev" * tag 'net-7.2-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (55 commits) l2tp: fix tunnel and session refcount leak on seq_file release net/sched: cls_bpf: reject dev-bound programs bound to a different device sctp: fix use-after-free of cached ASCONF chunk net: ethernet: ti: am65-cpsw-nuss: Fix port_id extraction from SRC TAG sctp: clear new_transport when removing a peer net/dibs: Correct freeing of dmb_clientid_arr net/sched: cls_u32: skip hash tables in u32_bind_class() gve: fix NULL dereference due to missing ptp adjfine gve: fix zero-length skb frag with header-split net/sched: act_api: fix TOCTOU NULL deref on a->goto_chain af_packet: Don't send zero-byte data in tpacket_snd(). tipc: read le->link under the node lock in tipc_node_link_down() selftests: tls: cover splice after a failed decrypt net/tls: Fail tls_sw_splice_read() after a failed async decrypt net: ngbe: fix NULL pointer dereference in non-MSI-X interrupt enabling net: tap: fix wrong transport_header when sending VLAN-tagged frame net: packet: fix wrong transport_header when sending VLAN-tagged frame vxlan: do not arm the ageing timer on a device that is down ipv4: fix use-after-free in fib_nhc_update_mtu() NTB: ntb_netdev: Preserve RX queue depth on allocation failure ...
2026-08-13Documentation: Extend the real-time hardware bits with some firmware bitsSebastian Andrzej Siewior
I have been reviewing how OP‑TEE is implemented and how secure‑world invocations behave. The goal was to determine whether an OP‑TEE call can delay the Linux side and introduce latency depending on the time spent in the secure world. Similar latency effects are already known for EFI runtime services, but this was not documented. To mitigate the impact, EFI runtime invocations can be restricted to specific CPUs so that real‑time workloads on other CPUs remain unaffected. This mechanism, however, is only described in the commit that introduced it. This change adds a firmware section that documents these behaviours explicitly. It highlights cases where firmware can delay the kernel, information that may be unfamiliar to some users and surprising-or concerning-to others. Assisted-by: Microsoft-Copilot Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <20260718175041.QXn9iOFK@linutronix.de>
2026-08-13docs: pt_BR: Reorganize process/index.rst to follow english structureDaniel Pereira
The main index.rst file for the pt_BR translation was grouping all translated process documents directly in its toctree, which frequently caused patch collisions among contributors. Following Jonathan Corbet's suggestion, this patch introduces a new pt_BR/process/index.rst that mirrors the subsection structure of the English Documentation/process/index.rst. The translated documents are now organized into their respective categories, rather than a single flat list. The root pt_BR/index.rst now simply references process/index. This matches the upstream categorization and significantly reduces merge conflicts for future pt_BR translations. Signed-off-by: Daniel Pereira <danielmaraboo@gmail.com> [jc: removed process/index.rst top-of-file label] Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <20260813134741.11025-1-danielmaraboo@gmail.com>
2026-08-13s390/percpu: Fix MVIY_PERCPU() with older binutilsKarl Mehltretter
Commit a737737cdb9c ("s390/percpu: Infrastructure for more efficient this_cpu operations") introduced MVIY_PERCPU(), which stringifies arguments that are already C string literals. This generates an assembler macro invocation with whitespace-separated quoted arguments: GEN_MVIY "459712" "%r3" GNU as versions prior to binutils 2.39 drop the separating whitespace between quoted macro arguments during input scrubbing. They consequently parse the invocation as a single argument and emit repeated warnings: Warning: missing closing `"' The .ifc in GEN_MVIY never matches and GNU as exits successfully without emitting the mviy instruction. As a result, the interrupted per-CPU sequence is not marked in lowcore and the exception return path cannot repair the per-CPU address register after migration. All MVIY_PERCPU() callers pass C string literals. Use them directly and separate the assembler macro arguments with an explicit comma. The resulting invocation is: GEN_MVIY 459712, %r3 This form is unambiguous for GNU as and LLVM's integrated assembler. This behavior was fixed in GNU as from binutils 2.39, but Linux supports binutils 2.30. Fixes: a737737cdb9c ("s390/percpu: Infrastructure for more efficient this_cpu operations") Cc: stable@vger.kernel.org Assisted-by: Codex:gpt-5.6-sol Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com> Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2026-08-13s390/debug: Fix deadlock during unregisterPeter Oberparleiter
Unregistering an s390dbf debug area while one of the associated debugfs files is being written to can cause a deadlock: $ echo >.../vmur/level $ rmmod vmur =================================================== debugfs write debugfs_file_get() debug_unregister() mutex_lock(debug_mutex) debugfs_remove() wait for debugfs_file_put() debug_file_ops.write() debug_input() mutex_lock(debug_mutex) ==> DEADLOCK Fix this by splitting debug_unregister() into an s390dbf and debugfs part, and running only the s390dbf part with debug_mutex locked. Fixes: 9372a82892c2 ("s390/debug: fix debug area life cycle") Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com> Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2026-08-13s390/cpum_cf: Handle CPU hotplug via prepare/dead callbacksThomas Richter
The command 'perf stat -e cycles -- <command>' crashes the kernel when CPUs are hotplug added during that run. Root cause is the allocation of struct cpu_cf_events at first event initialization. The allocation is dynamic and the first event that has task context creates such a structure for each online CPU. This is not sufficient. CPUs may be offline during event creation and can be set online during the perf run time. For example commands # echo 0 > /sys/devices/system/cpu/cpu1/online # perf stat -e cycles -i -- stress-ng -t10s --matrix X # sleep 1 # echo 1 > /sys/devices/system/cpu/cpu1/online create an event for CPUs 0,2-X. Since the events are created with task-context, the scheduler will eventually schedule the program on CPU1. This CPU has not created and initialized any per CPU event infrastructure as that CPU was not online at the time of the perf invocation. Thus when the scheduler runs stress-ng on CPU1, the function cpumf_pmu_add() refers to a NULL pointer: struct cpu_cf_events *cpuhw = this_cpu_cfhw(); This function call is invoked after the task stress-ng has been made runnable on CPU1. And this_cpu_cfhw() returns NULL. The result is a panic: Unable to handle kernel pointer dereference in virtual kernel address space Failing address: 0000000000000000 TEID: 0000000000000483 .... Krnl PSW : 0404d00180000000 000003ef8291fd0c (cpumf_pmu_add+0x3c/0x80) .... Call Trace: [<000003ef8291fd0c>] cpumf_pmu_add+0x3c/0x80 [<000003ef82bb5e3e>] event_sched_in+0xae/0x190 [<000003ef82bb60d6>] merge_sched_in+0x1b6/0x390 [<000003ef82bb65b8>] visit_groups_merge.constprop.0.isra.0+0x308/0x5b0 [<000003ef82bb689a>] pmu_groups_sched_in+0x3a/0x50 [<000003ef82bb6a30>] ctx_sched_in+0x180/0x260 [<000003ef82bb780c>] perf_event_context_sched_in+0x11c/0x2d0 [<000003ef82bb79ee>] __perf_event_task_sched_in+0x2e/0xc0 [<000003ef82994834>] finish_task_switch.isra.0+0x1a4/0x250 .... Last Breaking-Event-Address: [<000003ef8291f1d8>] this_cpu_cfhw+0x38/0x40 The issue arises only in per-task context when the CPUMF facility is used and the scheduler picks a random CPU for such a process to run on. The scheduler enables the CPUMF infrastructure via PMU callback functions pmu::add() and pmu::del(). Introduce a CPU hotplug prepare/dead callback pair which creates and removes the per CPU counter data while the CPU is offline. Count the users which track every CPU (cpu == -1), that is perf_event_open() events with task context and /dev/hwctr device sessions, in the new counter cpu_cf_root::tskcnt, protected by pmc_reserve_mutex. This ensures the infrastructure is available when new CPU is selected to run the per-task context process. In cpum_cf_free_root() and cpum_cf_free_cpu() ensure the reference pointer to data structures is set to NULL before the data is freed to prevent interrupt handlers to access stale data. [gor@linux.ibm.com: change commit message] Fixes: 9b9cf3c77e7e ("s390/cpum_cf: rework PER_CPU_DEFINE of struct cpu_cf_events") Cc: stable@vger.kernel.org # v6.5+ Suggested-by: Heiko Carstens <hca@linux.ibm.com> Suggested-by: Christian Borntraeger <borntraeger@linux.ibm.com> Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2026-08-13ASoC: amd: acp: pass audio_drv_data to dma_irq_handlerRosen Penev
The IRQ handler only needs the audio_drv_data, so pass it directly as the request_irq argument instead of the device pointer and a dev_get_drvdata() lookup. Assisted-by: opencode:deepseek-v4-flash-free Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://patch.msgid.link/20260811041925.25016-1-rosenp@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: fsl-asoc-card: Restructure to support deferrable card bindingMark Brown
Chancel Liu <chancel.liu@nxp.com> says: The ASoC core has evolved over several kernel releases to support deferrable card binding: when a component is not yet available, devm_snd_soc_register_card() no longer propagates -EPROBE_DEFER back to the machine driver. Instead the card is placed on an internal deferred list and rebound automatically once the missing component registers. As a result, registering a sound card no longer guarantees that all CPU and codec components have already probed successfully. This exposed two regressions in fsl-asoc-card: 1. The machine driver caches codec MCLK rate during probe(). On platforms where the MCLK is derived from the CPU DAI clock and its final rate is applied via assigned-clocks in the CPU DAI node, probing before the CPU DAI driver completes leaves fsl-asoc-card with a stale mclk_freq. 2. If a card defers due to a missing component, it queues the card onto the unbind_card_list and returns 0. The driver then proceeds to call simple_util_init_jack(). At this point, the snd_card pointer is NULL. Patch 1 drops mclk management for nau8822 from this machine driver. Patch 2 is a pure refactoring with no functional change. the large if/else chain of of_device_is_compatible() calls in probe() is replaced by a platform data table approach. Patch 3 moves all component-dependent initialisation and jacks out of probe() and into late_probe(), which is the correct place under the deferrable binding model. Link: https://patch.msgid.link/20260810093834.1511749-1-chancel.liu@oss.nxp.com
2026-08-13ASoC: fsl-asoc-card: Move bound-component setup to late_probeChancel Liu
Move all operations that require bound codec and CPU DAI components out of probe() and into late_probe(), which is the correct place for them now that ASoC supports deferrable card binding. late_probe() may be called multiple times after an unbind/rebind cycle, so every initialization step is guarded accordingly. Three new helpers are introduced: - fsl_asoc_card_init_cpu() CPU DAI-specific setup. Previously done in probe() while CPU DAI component maybe not ready. - fsl_asoc_card_init_codecs() Reads codec MCLK rates from the bound component devices, invokes the per-compatible pdata->codec_init callback if present. - fsl_asoc_card_init_jack() Registers headphone and microphone jacks. The call site of codec_init callbacks moves from probe() to fsl_asoc_card_init_codecs(), which runs in late_probe() after the bound codec device is known. This makes sure codecs can get proper MCLK. The old card-name fallback depended on codec_dev_name[], which required looking up the codec device in probe(). This is no longer valid under deferrable card binding because the codec component may not have probed yet. Since the DT binding requires "model", remove the fallback and fail with a clear error. Assisted-by: VeroCoder:claude-sonnet-4-6 Signed-off-by: Chancel Liu <chancel.liu@nxp.com> Link: https://patch.msgid.link/20260810093834.1511749-4-chancel.liu@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: fsl-asoc-card: Move static compatible data to platform dataChancel Liu
Replace the large if/else chain of of_device_is_compatible() calls in probe() with a table-driven approach. Each compatible string now has a corresponding static const struct fsl_asoc_card_pdata descriptor stored in the of_device_id .data field. probe() calls of_device_get_match_data() once and reads all per-compatible configuration from the returned pointer: - DAI format - CPU SYSCLK direction and ratio overrides - TDM slot width - Codec DAI name, MCLK id, FLL/PLL ids, PLL S24 ratio - playback_only / capture_only direction restrictions - Default DAPM route table - Excluded PCM format mask (for SAI + WM8960/WM8962) - Optional probe_init callback (SPDIF multi-codec discovery) - Optional codec_init callback (codec-specific post-probe logic) This patch is a pure refactoring, no functional change is intended. Assisted-by: VeroCoder:claude-sonnet-4-6 Signed-off-by: Chancel Liu <chancel.liu@nxp.com> Link: https://patch.msgid.link/20260810093834.1511749-3-chancel.liu@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: fsl-asoc-card: Drop mclk management for nau8822Chancel Liu
commit 93f12a7568269 ("ASoC: nau8822: add MCLK support") added MCLK handling directly in the nau8822 codec driver. The machine driver no longer needs to acquire and enable the codec MCLK on its behalf. Remove MCLK management in this machine driver that was introduced by commit 1075df4bdeb32 ("ASoC: fsl-asoc-card: add nau8822 support"). This avoids a potential double-enable and removes clock resource management from the machine driver where it does not belong. Additionally, the sound card may be unbound and rebound multiple times during its lifetime. Managing a codec clock resource in the machine driver would require careful cleanup in the card remove path to avoid reference count leaks. Leaving clock management to the codec driver, which has the same lifetime as the codec device, is the correct ownership model. The nau8822 compatible entry, DAI name, and PLL/FLL clock ID configuration are kept unchanged. Assisted-by: VeroCoder:claude-sonnet-4-6 Signed-off-by: Chancel Liu <chancel.liu@nxp.com> Link: https://patch.msgid.link/20260810093834.1511749-2-chancel.liu@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: Simplify probe error handlingMark Brown
bui duc phuc <phucduc.bui@gmail.com> says: This series simplifies probe error handling across Rockchip ASoC drivers. It replaces open-coded error handling with dev_err_probe() where appropriate, removes redundant probe error messages, returns the original error code directly, and fixes handling of -EPROBE_DEFER returned by platform_get_irq_optional() in the Rockchip SAI driver and devm_pinctrl_get() in the Rockchip I2S driver. Compile tested only. Link: https://patch.msgid.link/20260806052136.21034-1-phucduc.bui@gmail.com
2026-08-13ASoC: rockchip: spdif: Return the original error codebui duc phuc
Return the original error code directly and drop the redundant error message since the called function already reports the failure. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-15-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rockchip_sai: Drop redundant probe error messagesbui duc phuc
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-14-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rockchip_sai: Return the original error codebui duc phuc
Return the original error code directly and drop the redundant error message since the called function already reports the failure. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-13-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>