Commit Graph

62 Commits

Author SHA1 Message Date
Greg Kroah-Hartman
2ec0c94f9b Merge 6.12.5 into android16-6.12
GKI (arm64) relevant 129 out of 468 changes, affecting 180 files +1843/-980
  e0964a5778 ptp: Add error handling for adjfine callback in ptp_clock_adjtime [1 file, +2/-1]
  a007f8895f net/sched: tbf: correct backlog statistic for GSO packets [1 file, +12/-6]
  9545011e7b net: Fix icmp host relookup triggering ip_rt_bug [1 file, +3/-0]
  01f95357e4 ipv6: avoid possible NULL deref in modify_prefix_route() [1 file, +7/-6]
  8b591bd522 net/ipv6: release expired exception dst cached in socket [1 file, +3/-3]
  e48b211c4c tipc: Fix use-after-free of kernel socket in cleanup_bearer(). [1 file, +1/-1]
  da5cc778e7 netfilter: nft_inner: incorrect percpu area handling under softirq [2 files, +46/-12]
  a36a6d7037 Revert "udp: avoid calling sock_def_readable() if possible" [1 file, +3/-11]
  22074dc1d4 ethtool: Fix wrong mod state in case of verbose and no_mask bitset [1 file, +44/-4]
  316183d583 net: avoid potential UAF in default_operstate() [1 file, +6/-1]
  c00372e41b mmc: sd: SDUC Support Recognition [7 files, +27/-15]
  19e22f1e68 mmc: core: Adjust ACMD22 to SDUC [1 file, +18/-6]
  42311846d3 mmc: core: Use GFP_NOIO in ACMD22 [1 file, +4/-0]
  4e51552bc5 zram: do not mark idle slots that cannot be idle [1 file, +18/-7]
  0ab037634b zram: clear IDLE flag in mark_idle() [1 file, +2/-0]
  405b6d5f90 ntp: Remove invalid cast in time offset math [1 file, +1/-1]
  6358df316d f2fs: clean up w/ F2FS_{BLK_TO_BYTES,BTYES_TO_BLK} [1 file, +29/-39]
  e6a91ed4b9 f2fs: fix to adjust appropriate length for fiemap [2 files, +4/-3]
  8e9fec7f79 f2fs: fix to requery extent which cross boundary of inquiry [1 file, +15/-5]
  815d8f0e52 i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS [2 files, +5/-3]
  c3806cf647 i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_DESIRED [2 files, +59/-13]
  1117462773 i3c: master: Fix dynamic address leak when 'assigned-address' is present [1 file, +5/-10]
  7d4e5e33ea scsi: ufs: core: Always initialize the UIC done completion [1 file, +4/-7]
  3ad69f2f08 scsi: ufs: core: Add ufshcd_send_bsg_uic_cmd() for UFS BSG [3 files, +38/-1]
  47f4ad956b bpf, vsock: Fix poll() missing a queue [1 file, +3/-0]
  a222e48fea bpf, vsock: Invoke proto::close on close() [1 file, +40/-27]
  dabaf26846 xsk: always clear DMA mapping information when unmapping the pool [1 file, +2/-3]
  5c9e3bb43a tcp_bpf: Fix the sk_mem_uncharge logic in tcp_bpf_sendmsg [1 file, +4/-7]
  7bc37dd9ea ALSA: usb-audio: Notify xrun for low-latency mode [1 file, +11/-3]
  a78af11806 pmdomain: core: Add missing put_device() [1 file, +1/-0]
  913a3f1c06 pmdomain: core: Fix error path in pm_genpd_init() when ida alloc fails [1 file, +19/-17]
  5548887987 nvme: don't apply NVME_QUIRK_DEALLOCATE_ZEROES when DSM is not supported [1 file, +2/-1]
  bdbf87486d bpf: Ensure reg is PTR_TO_STACK in process_iter_arg [2 files, +7/-2]
  2459a0b149 drivers/virt: pkvm: Don't fail ioremap() call if MMIO_GUARD fails [1 file, +1/-5]
  0da7d4b7ca bpf: Don't mark STACK_INVALID as STACK_MISC in mark_stack_slot_misc [1 file, +6/-3]
  f9f2a2739e bpf: Fix narrow scalar spill onto 64-bit spilled scalar slots [1 file, +1/-0]
  845cc4ee8e nvme-fabrics: handle zero MAXCMD without closing the connection [1 file, +3/-2]
  c2277e2859 scatterlist: fix incorrect func name in kernel-doc [1 file, +1/-1]
  81ec3c6ceb bpf: Handle BPF_EXIST and BPF_NOEXIST for LPM trie [1 file, +20/-3]
  6dc076a257 bpf: Remove unnecessary kfree(im_node) in lpm_trie_update_elem [1 file, +1/-3]
  7218e441ad bpf: Handle in-place update for full LPM trie correctly [1 file, +21/-23]
  412bf01fd5 bpf: Fix exact match conditions in trie_get_next_key() [1 file, +2/-2]
  e689bc6697 HID: wacom: fix when get product name maybe null pointer [1 file, +2/-1]
  3b0c5bb437 can: dev: can_set_termination(): allow sleeping GPIOs [1 file, +1/-1]
  ba0ee489cd tracing: Fix cmp_entries_dup() to respect sort() comparison rules [1 file, +1/-5]
  ec643064ab arm64: mm: Fix zone_dma_limit calculation [1 file, +8/-9]
  34b6197867 arm64: Ensure bits ASID[15:8] are masked out when the kernel uses 8-bit ASIDs [1 file, +2/-2]
  abd614bbfc arm64: ptrace: fix partial SETREGSET for NT_ARM_TAGGED_ADDR_CTRL [1 file, +5/-1]
  8ab73c34e3 arm64: ptrace: fix partial SETREGSET for NT_ARM_FPMR [1 file, +2/-0]
  4105dd76bc arm64: ptrace: fix partial SETREGSET for NT_ARM_POE [1 file, +2/-0]
  7f1292f8d4 ALSA: usb-audio: Fix a DMA to stack memory bug [1 file, +27/-15]
  39c5d89b56 ALSA: usb-audio: Add extra PID for RME Digiface USB [3 files, +176/-168]
  9c191055c7 scsi: ufs: core: sysfs: Prevent div by zero [1 file, +6/-0]
  2e7a3bb033 scsi: ufs: core: Cancel RTC work during ufshcd_remove() [1 file, +1/-0]
  5a717f43c2 scsi: ufs: core: Add missing post notify for power mode change [2 files, +10/-7]
  793e560a6b io_uring: Change res2 parameter type in io_uring_cmd_done [2 files, +3/-3]
  85351e4941 Revert "readahead: properly shorten readahead when falling back to do_page_cache_ra()" [1 file, +2/-3]
  95e197354e cacheinfo: Allocate memory during CPU hotplug if not done from the primary CPU [1 file, +8/-6]
  bc031095d1 modpost: Add .irqentry.text to OTHER_SECTIONS [1 file, +1/-1]
  178e31df1f bpf: fix OOB devmap writes when deleting elements [1 file, +3/-3]
  3dcc20418e dma-buf: fix dma_fence_array_signaled v4 [1 file, +27/-1]
  f3dbb097d6 dma-fence: Fix reference leak on fence merge failure path [1 file, +2/-0]
  4715555964 dma-fence: Use kernel's sort for merging fences [1 file, +61/-67]
  d486b5741d xsk: fix OOB map writes when deleting elements [1 file, +1/-1]
  14258211d6 regmap: detach regmap from dev on regmap_exit [1 file, +12/-0]
  d562b457e1 mmc: core: Further prevent card detect during shutdown [2 files, +5/-0]
  9bfeeeff2c stackdepot: fix stack_depot_save_flags() in NMI context [2 files, +12/-4]
  a71ddd5b87 sched/numa: fix memory leak due to the overwritten vma->numab_state [1 file, +9/-3]
  835ca042df kasan: make report_lock a raw spinlock [1 file, +3/-3]
  69d319450d mm/gup: handle NULL pages in unpin_user_pages() [1 file, +10/-1]
  1dde3fde62 mm: open-code PageTail in folio_flags() and const_folio_flags() [1 file, +2/-2]
  bd4d2333a3 mm: open-code page_folio() in dump_page() [1 file, +5/-2]
  536ffb4014 mm: fix vrealloc()'s KASAN poisoning logic [1 file, +2/-1]
  fe1a34e92a mm: respect mmap hint address when aligning for THP [1 file, +1/-0]
  5c63e24b1b scsi: ufs: pltfrm: Drop PM runtime reference count after ufshcd_remove() [6 files, +2/-5]
  2cec2d916a memblock: allow zero threshold in validate_numa_converage() [1 file, +2/-2]
  d222934627 epoll: annotate racy check [2 files, +5/-3]
  493326c4f1 block: RCU protect disk->conv_zones_bitmap [2 files, +32/-13]
  b6ce2dbe98 ext4: partial zero eof block on unaligned inode size extension [2 files, +42/-16]
  ff599ad2d2 cleanup: Adjust scoped_guard() macros to avoid potential warning [1 file, +42/-10]
  3946e07552 gpio: free irqs that are still requested when the chip is being removed [1 file, +41/-0]
  ea74e9675b HID: add per device quirk to force bind to hid-generic [3 files, +8/-2]
  17db6ed5a3 media: uvcvideo: RealSense D421 Depth module metadata [1 file, +9/-0]
  0c20fadfd0 media: uvcvideo: Add a quirk for the Kaiweets KTI-W02 infrared camera [1 file, +11/-0]
  3cc5228d5b media: uvcvideo: Force UVC version to 1.0a for 0408:4033 [1 file, +11/-0]
  4150f22342 drm: panel-orientation-quirks: Add quirk for AYA NEO 2 model [1 file, +6/-0]
  5d7f35ed5f drm: panel-orientation-quirks: Add quirk for AYA NEO Founder edition [1 file, +6/-0]
  187d5ff497 drm: panel-orientation-quirks: Add quirk for AYA NEO GEEK [1 file, +6/-0]
  fd09880b16 af_packet: avoid erroring out after sock_init_data() in packet_create() [1 file, +6/-6]
  61686abc2f Bluetooth: L2CAP: do not leave dangling sk pointer on error in l2cap_sock_create() [1 file, +1/-0]
  32df687e12 Bluetooth: RFCOMM: avoid leaving dangling sk pointer in rfcomm_sock_alloc() [1 file, +5/-5]
  8df832e6b9 net: af_can: do not leave a dangling sk pointer in can_create() [1 file, +1/-0]
  03caa9bfb9 net: ieee802154: do not leave a dangling sk pointer in ieee802154_create() [1 file, +7/-5]
  691d6d816f net: inet: do not leave a dangling sk pointer in inet_create() [1 file, +10/-12]
  f44fceb71d net: inet6: do not leave a dangling sk pointer in inet6_create() [1 file, +10/-12]
  987aa730ba bpf: Prevent tailcall infinite loop caused by freplace [5 files, +81/-17]
  051f49d517 net/tcp: Add missing lockdep annotations for TCP-AO hlist traversals [4 files, +29/-23]
  920159e1bf ALSA: usb-audio: Make mic volume workarounds globally applicable [3 files, +45/-48]
  a50b4aa300 bpf: Call free_htab_elem() after htab_unlock_bucket() [1 file, +39/-17]
  da561d5fb6 Bluetooth: hci_conn: Reduce hci_conn_drop() calls in two functions [1 file, +3/-10]
  c55a4c5a04 Bluetooth: hci_conn: Use disable_delayed_work_sync [1 file, +3/-3]
  93a6160dc1 Bluetooth: hci_core: Fix not checking skb length on hci_acldata_packet [1 file, +9/-4]
  b04b4fb91d Bluetooth: Add new quirks for ATS2851 [2 files, +20/-4]
  359fc41e3c Bluetooth: Support new quirks for ATS2851 [2 files, +15/-1]
  166cf43070 net/neighbor: clear error in case strict check is not set [1 file, +1/-0]
  f63a1caae9 tracing/ftrace: disable preemption in syscall probe [2 files, +44/-4]
  d1133dd57e tracing: Use atomic64_inc_return() in trace_clock_counter() [1 file, +1/-1]
  09c083fbea ring-buffer: Limit time with disabled interrupts in rb_check_pages() [1 file, +72/-26]
  c11e2ec9a7 pinmux: Use sequential access to access desc->pinmux data [3 files, +100/-77]
  b865d4e569 scsi: ufs: core: Make DMA mask configuration more flexible [3 files, +13/-9]
  2fcb921c27 bpf: put bpf_link's program when link is safe to be deallocated [1 file, +17/-5]
  bb4a6236a4 leds: class: Protect brightness_show() with led_cdev->led_access mutex [2 files, +12/-4]
  7214d3a64e tracing: Fix function name for trampoline [3 files, +36/-8]
  9e28513fd2 f2fs: fix f2fs_bug_on when uninstalling filesystem call f2fs_evict_inode. [1 file, +3/-1]
  b51aa6a07e PCI: qcom: Add support for IPQ9574 [1 file, +1/-0]
  617bd1e6c3 PCI: Add ACS quirk for Wangxun FF5xxx NICs [1 file, +9/-6]
  1f51ae217d i3c: Use i3cdev->desc->info instead of calling i3c_device_get_info() to avoid deadlock [1 file, +2/-1]
  6d41a2d5c1 f2fs: print message if fscorrupted was found in f2fs_new_node_page() [1 file, +6/-1]
  924f7dd1e8 f2fs: fix to shrink read extent node in batches [1 file, +41/-28]
  1648c7000f serial: 8250_dw: Add Sophgo SG2044 quirk [1 file, +3/-2]
  950210c9c7 Revert "nvme: make keep-alive synchronous operation" [1 file, +10/-7]
  d5b2ddf1f9 io_uring/tctx: work around xa_store() allocation error issue [1 file, +12/-1]
  cd188519d2 scsi: ufs: pltfrm: Dellocate HBA during ufshcd_pltfrm_remove() [1 file, +1/-0]
  a39ad4f507 sched/core: Remove the unnecessary need_resched() check in nohz_csd_func() [1 file, +1/-1]
  f9e144a544 sched/fair: Check idle_cpu() before need_resched() to detect ilb CPU turning busy [1 file, +1/-1]
  b4ec68868c sched/core: Prevent wakeup of ksoftirqd during idle load balance [1 file, +1/-1]
  364dc8070b tracing/eprobe: Fix to release eprobe when failed to add dyn_event [1 file, +5/-0]
  1a678f6829 clocksource: Make negative motion detection more robust [4 files, +20/-7]
  6aeef0214d softirq: Allow raising SCHED_SOFTIRQ from SMP-call-function on RT kernel [1 file, +11/-4]

Changes in 6.12.5
	iTCO_wdt: mask NMI_NOW bit for update_no_reboot_bit() call
	watchdog: xilinx_wwdt: Calculate max_hw_heartbeat_ms using clock frequency
	watchdog: apple: Actually flush writes after requesting watchdog restart
	watchdog: mediatek: Make sure system reset gets asserted in mtk_wdt_restart()
	can: gs_usb: add usb endpoint address detection at driver probe step
	can: c_can: c_can_handle_bus_err(): update statistics if skb allocation fails
	can: sun4i_can: sun4i_can_err(): call can_change_state() even if cf is NULL
	can: hi311x: hi3110_can_ist(): fix potential use-after-free
	can: m_can: m_can_handle_lec_err(): fix {rx,tx}_errors statistics
	can: ifi_canfd: ifi_canfd_handle_lec_err(): fix {rx,tx}_errors statistics
	can: hi311x: hi3110_can_ist(): fix {rx,tx}_errors statistics
	can: sja1000: sja1000_err(): fix {rx,tx}_errors statistics
	can: sun4i_can: sun4i_can_err(): fix {rx,tx}_errors statistics
	can: ems_usb: ems_usb_rx_err(): fix {rx,tx}_errors statistics
	can: f81604: f81604_handle_can_bus_errors(): fix {rx,tx}_errors statistics
	ipvs: fix UB due to uninitialized stack access in ip_vs_protocol_init()
	netfilter: x_tables: fix LED ID check in led_tg_check()
	netfilter: nft_socket: remove WARN_ON_ONCE on maximum cgroup level
	selftests: hid: fix typo and exit code
	net: enetc: Do not configure preemptible TCs if SIs do not support
	ptp: Add error handling for adjfine callback in ptp_clock_adjtime
	net/sched: tbf: correct backlog statistic for GSO packets
	net: hsr: avoid potential out-of-bound access in fill_frame_info()
	bnxt_en: ethtool: Supply ntuple rss context action
	net: Fix icmp host relookup triggering ip_rt_bug
	ipv6: avoid possible NULL deref in modify_prefix_route()
	can: j1939: j1939_session_new(): fix skb reference counting
	platform/x86: asus-wmi: Ignore return value when writing thermal policy
	net: phy: microchip: Reset LAN88xx PHY to ensure clean link state on LAN7800/7850
	net/ipv6: release expired exception dst cached in socket
	dccp: Fix memory leak in dccp_feat_change_recv
	tipc: Fix use-after-free of kernel socket in cleanup_bearer().
	net/smc: initialize close_work early to avoid warning
	net/smc: fix LGR and link use-after-free issue
	net/qed: allow old cards not supporting "num_images" to work
	net: hsr: must allocate more bytes for RedBox support
	ice: fix PHY Clock Recovery availability check
	ice: fix PHY timestamp extraction for ETH56G
	ice: Fix VLAN pruning in switchdev mode
	idpf: set completion tag for "empty" bufs associated with a packet
	ixgbevf: stop attempting IPSEC offload on Mailbox API 1.5
	ixgbe: downgrade logging of unsupported VF API version to debug
	ixgbe: Correct BASE-BX10 compliance code
	igb: Fix potential invalid memory access in igb_init_module()
	netfilter: nft_inner: incorrect percpu area handling under softirq
	Revert "udp: avoid calling sock_def_readable() if possible"
	net: sched: fix erspan_opt settings in cls_flower
	netfilter: ipset: Hold module reference while requesting a module
	netfilter: nft_set_hash: skip duplicated elements pending gc run
	ethtool: Fix wrong mod state in case of verbose and no_mask bitset
	mlxsw: spectrum_acl_flex_keys: Constify struct mlxsw_afk_element_inst
	mlxsw: spectrum_acl_flex_keys: Use correct key block on Spectrum-4
	geneve: do not assume mac header is set in geneve_xmit_skb()
	net/mlx5: HWS: Fix memory leak in mlx5hws_definer_calc_layout
	net/mlx5: HWS: Properly set bwc queue locks lock classes
	net/mlx5e: SD, Use correct mdev to build channel param
	net/mlx5e: Remove workaround to avoid syndrome for internal port
	vsock/test: fix failures due to wrong SO_RCVLOWAT parameter
	vsock/test: fix parameter types in SO_VM_SOCKETS_* calls
	net: avoid potential UAF in default_operstate()
	gpio: grgpio: use a helper variable to store the address of ofdev->dev
	gpio: grgpio: Add NULL check in grgpio_probe
	mmc: mtk-sd: use devm_mmc_alloc_host
	mmc: mtk-sd: Fix error handle of probe function
	mmc: mtk-sd: fix devm_clk_get_optional usage
	mmc: mtk-sd: Fix MMC_CAP2_CRYPTO flag setting
	mmc: sd: SDUC Support Recognition
	mmc: core: Adjust ACMD22 to SDUC
	mmc: core: Use GFP_NOIO in ACMD22
	zram: do not mark idle slots that cannot be idle
	zram: clear IDLE flag in mark_idle()
	ntp: Remove invalid cast in time offset math
	f2fs: clean up w/ F2FS_{BLK_TO_BYTES,BTYES_TO_BLK}
	f2fs: fix to adjust appropriate length for fiemap
	f2fs: fix to requery extent which cross boundary of inquiry
	i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS
	i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_DESIRED
	i3c: master: Fix dynamic address leak when 'assigned-address' is present
	drm/amd/display: calculate final viewport before TAP optimization
	drm/amd/display: Ignore scalar validation failure if pipe is phantom
	scsi: ufs: core: Always initialize the UIC done completion
	scsi: ufs: core: Add ufshcd_send_bsg_uic_cmd() for UFS BSG
	bpf, vsock: Fix poll() missing a queue
	bpf, vsock: Invoke proto::close on close()
	xsk: always clear DMA mapping information when unmapping the pool
	bpftool: fix potential NULL pointer dereferencing in prog_dump()
	drm/sti: Add __iomem for mixer_dbg_mxn's parameter
	tcp_bpf: Fix the sk_mem_uncharge logic in tcp_bpf_sendmsg
	ALSA: seq: ump: Fix seq port updates per FB info notify
	ALSA: usb-audio: Notify xrun for low-latency mode
	tools: Override makefile ARCH variable if defined, but empty
	spi: mpc52xx: Add cancel_work_sync before module remove
	ASoC: SOF: ipc3-topology: Convert the topology pin index to ALH dai index
	ASoC: SOF: ipc3-topology: fix resource leaks in sof_ipc3_widget_setup_comp_dai()
	pmdomain: core: Add missing put_device()
	pmdomain: core: Fix error path in pm_genpd_init() when ida alloc fails
	nvme: don't apply NVME_QUIRK_DEALLOCATE_ZEROES when DSM is not supported
	x86/pkeys: Change caller of update_pkru_in_sigframe()
	x86/pkeys: Ensure updated PKRU value is XRSTOR'd
	bpf: Ensure reg is PTR_TO_STACK in process_iter_arg
	irqchip/stm32mp-exti: CONFIG_STM32MP_EXTI should not default to y when compile-testing
	drivers/virt: pkvm: Don't fail ioremap() call if MMIO_GUARD fails
	bpf: Don't mark STACK_INVALID as STACK_MISC in mark_stack_slot_misc
	bpf: Fix narrow scalar spill onto 64-bit spilled scalar slots
	nvme-fabrics: handle zero MAXCMD without closing the connection
	nvme-tcp: fix the memleak while create new ctrl failed
	nvme-rdma: unquiesce admin_q before destroy it
	scsi: sg: Fix slab-use-after-free read in sg_release()
	scsi: scsi_debug: Fix hrtimer support for ndelay
	ASoC: mediatek: mt8188-mt6359: Remove hardcoded dmic codec
	drm/v3d: Enable Performance Counters before clearing them
	ocfs2: free inode when ocfs2_get_init_inode() fails
	scatterlist: fix incorrect func name in kernel-doc
	iio: magnetometer: yas530: use signed integer type for clamp limits
	smb: client: fix potential race in cifs_put_tcon()
	bpf: Handle BPF_EXIST and BPF_NOEXIST for LPM trie
	bpf: Remove unnecessary kfree(im_node) in lpm_trie_update_elem
	bpf: Handle in-place update for full LPM trie correctly
	bpf: Fix exact match conditions in trie_get_next_key()
	x86/CPU/AMD: WARN when setting EFER.AUTOIBRS if and only if the WRMSR fails
	rust: allow `clippy::needless_lifetimes`
	HID: i2c-hid: Revert to using power commands to wake on resume
	HID: wacom: fix when get product name maybe null pointer
	LoongArch: Add architecture specific huge_pte_clear()
	LoongArch: KVM: Protect kvm_check_requests() with SRCU
	ksmbd: fix Out-of-Bounds Read in ksmbd_vfs_stream_read
	ksmbd: fix Out-of-Bounds Write in ksmbd_vfs_stream_write
	watchdog: rti: of: honor timeout-sec property
	can: dev: can_set_termination(): allow sleeping GPIOs
	can: mcp251xfd: mcp251xfd_get_tef_len(): work around erratum DS80000789E 6.
	tracing: Fix cmp_entries_dup() to respect sort() comparison rules
	net :mana :Request a V2 response version for MANA_QUERY_GF_STAT
	iommufd: Fix out_fput in iommufd_fault_alloc()
	arm64: mm: Fix zone_dma_limit calculation
	arm64: Ensure bits ASID[15:8] are masked out when the kernel uses 8-bit ASIDs
	arm64: ptrace: fix partial SETREGSET for NT_ARM_TAGGED_ADDR_CTRL
	arm64: ptrace: fix partial SETREGSET for NT_ARM_FPMR
	arm64: ptrace: fix partial SETREGSET for NT_ARM_POE
	ALSA: usb-audio: Fix a DMA to stack memory bug
	ALSA: usb-audio: Add extra PID for RME Digiface USB
	ALSA: hda/realtek: fix micmute LEDs don't work on HP Laptops
	ALSA: usb-audio: add mixer mapping for Corsair HS80
	ALSA: hda/realtek: Enable mute and micmute LED on HP ProBook 430 G8
	ALSA: hda/realtek: Add support for Samsung Galaxy Book3 360 (NP730QFG)
	scsi: qla2xxx: Fix abort in bsg timeout
	scsi: qla2xxx: Fix NVMe and NPIV connect issue
	scsi: qla2xxx: Supported speed displayed incorrectly for VPorts
	scsi: qla2xxx: Fix use after free on unload
	scsi: qla2xxx: Remove check req_sg_cnt should be equal to rsp_sg_cnt
	scsi: ufs: core: sysfs: Prevent div by zero
	scsi: ufs: core: Cancel RTC work during ufshcd_remove()
	scsi: ufs: qcom: Only free platform MSIs when ESI is enabled
	scsi: ufs: pltfrm: Disable runtime PM during removal of glue drivers
	scsi: ufs: core: Add missing post notify for power mode change
	nilfs2: fix potential out-of-bounds memory access in nilfs_find_entry()
	fs/smb/client: avoid querying SMB2_OP_QUERY_WSL_EA for SMB3 POSIX
	fs/smb/client: Implement new SMB3 POSIX type
	fs/smb/client: cifs_prime_dcache() for SMB3 POSIX reparse points
	smb3.1.1: fix posix mounts to older servers
	io_uring: Change res2 parameter type in io_uring_cmd_done
	bcache: revert replacing IS_ERR_OR_NULL with IS_ERR again
	Revert "readahead: properly shorten readahead when falling back to do_page_cache_ra()"
	pmdomain: imx: gpcv2: Adjust delay after power up handshake
	selftests/damon: add _damon_sysfs.py to TEST_FILES
	selftest: hugetlb_dio: fix test naming
	cacheinfo: Allocate memory during CPU hotplug if not done from the primary CPU
	x86/cacheinfo: Delete global num_cache_leaves
	drm/amdkfd: hard-code cacheline for gc943,gc944
	drm/dp_mst: Fix MST sideband message body length check
	drm/amdkfd: add MEC version that supports no PCIe atomics for GFX12
	drm/amd/pm: fix and simplify workload handling
	drm/dp_mst: Verify request type in the corresponding down message reply
	drm/dp_mst: Fix resetting msg rx state after topology removal
	drm/amd/display: Correct prefetch calculation
	drm/amd/display: Limit VTotal range to max hw cap minus fp
	drm/amd/display: Add a left edge pixel if in YCbCr422 or YCbCr420 and odm
	drm/amdgpu/hdp6.0: do a posting read when flushing HDP
	drm/amdgpu/hdp4.0: do a posting read when flushing HDP
	drm/amdgpu/hdp5.0: do a posting read when flushing HDP
	drm/amdgpu/hdp7.0: do a posting read when flushing HDP
	drm/amdgpu/hdp5.2: do a posting read when flushing HDP
	modpost: Add .irqentry.text to OTHER_SECTIONS
	x86/kexec: Restore GDT on return from ::preserve_context kexec
	bpf: fix OOB devmap writes when deleting elements
	dma-buf: fix dma_fence_array_signaled v4
	dma-fence: Fix reference leak on fence merge failure path
	dma-fence: Use kernel's sort for merging fences
	xsk: fix OOB map writes when deleting elements
	regmap: detach regmap from dev on regmap_exit
	arch_numa: Restore nid checks before registering a memblock with a node
	mmc: sdhci-pci: Add DMI quirk for missing CD GPIO on Vexia Edu Atla 10 tablet
	mmc: core: Further prevent card detect during shutdown
	x86/cpu: Add Lunar Lake to list of CPUs with a broken MONITOR implementation
	ocfs2: update seq_file index in ocfs2_dlm_seq_next
	stackdepot: fix stack_depot_save_flags() in NMI context
	lib: stackinit: hide never-taken branch from compiler
	sched/numa: fix memory leak due to the overwritten vma->numab_state
	kasan: make report_lock a raw spinlock
	mm/gup: handle NULL pages in unpin_user_pages()
	mm/mempolicy: fix migrate_to_node() assuming there is at least one VMA in a MM
	x86/cpu/topology: Remove limit of CPUs due to disabled IO/APIC
	x86/mm: Add _PAGE_NOPTISHADOW bit to avoid updating userspace page tables
	mm/damon: fix order of arguments in damos_before_apply tracepoint
	mm: memcg: declare do_memsw_account inline
	mm: open-code PageTail in folio_flags() and const_folio_flags()
	mm: open-code page_folio() in dump_page()
	mm: fix vrealloc()'s KASAN poisoning logic
	mm: respect mmap hint address when aligning for THP
	scsi: ufs: pltfrm: Drop PM runtime reference count after ufshcd_remove()
	memblock: allow zero threshold in validate_numa_converage()
	rust: enable arbitrary_self_types and remove `Receiver`
	s390/pci: Sort PCI functions prior to creating virtual busses
	s390/pci: Use topology ID for multi-function devices
	s390/pci: Ignore RID for isolated VFs
	epoll: annotate racy check
	kselftest/arm64: Log fp-stress child startup errors to stdout
	s390/cpum_sf: Handle CPU hotplug remove during sampling
	block: RCU protect disk->conv_zones_bitmap
	btrfs: don't take dev_replace rwsem on task already holding it
	btrfs: avoid unnecessary device path update for the same device
	btrfs: canonicalize the device path before adding it
	btrfs: do not clear read-only when adding sprout device
	kselftest/arm64: Don't leak pipe fds in pac.exec_sign_all()
	ext4: partial zero eof block on unaligned inode size extension
	crypto: ecdsa - Avoid signed integer overflow on signature decoding
	kcsan: Turn report_filterlist_lock into a raw_spinlock
	hwmon: (nct6775) Add 665-ACE/600M-CL to ASUS WMI monitoring list
	ACPI: x86: Make UART skip quirks work on PCI UARTs without an UID
	ACPI: x86: Add adev NULL check to acpi_quirk_skip_serdev_enumeration()
	ACPI: video: force native for Apple MacbookPro11,2 and Air7,2
	perf/x86/amd: Warn only on new bits set
	cleanup: Adjust scoped_guard() macros to avoid potential warning
	iio: magnetometer: fix if () scoped_guard() formatting
	timekeeping: Always check for negative motion
	gpio: free irqs that are still requested when the chip is being removed
	spi: spi-fsl-lpspi: Adjust type of scldiv
	soc: qcom: llcc: Use designated initializers for LLC settings
	HID: add per device quirk to force bind to hid-generic
	firmware: qcom: scm: Allow QSEECOM on Lenovo Yoga Slim 7x
	soc: qcom: pd-mapper: Add QCM6490 PD maps
	media: uvcvideo: RealSense D421 Depth module metadata
	media: uvcvideo: Add a quirk for the Kaiweets KTI-W02 infrared camera
	media: uvcvideo: Force UVC version to 1.0a for 0408:4033
	media: cx231xx: Add support for Dexatek USB Video Grabber 1d19:6108
	mmc: core: Add SD card quirk for broken poweroff notification
	mmc: sdhci-esdhc-imx: enable quirks SDHCI_QUIRK_NO_LED
	firmware: qcom: scm: Allow QSEECOM on Dell XPS 13 9345
	soc: imx8m: Probe the SoC driver as platform driver
	regmap: maple: Provide lockdep (sub)class for maple tree's internal lock
	selftests/resctrl: Protect against array overflow when reading strings
	sched_ext: add a missing rcu_read_lock/unlock pair at scx_select_cpu_dfl()
	HID: magicmouse: Apple Magic Trackpad 2 USB-C driver support
	drm/xe/pciids: separate RPL-U and RPL-P PCI IDs
	drm/xe/pciids: separate ARL and MTL PCI IDs
	drm/vc4: hdmi: Avoid log spam for audio start failure
	drm/vc4: hvs: Set AXI panic modes for the HVS
	drm/xe/pciids: Add PVC's PCI device ID macros
	wifi: rtw88: use ieee80211_purge_tx_queue() to purge TX skb
	drm/xe/pciid: Add new PCI id for ARL
	drm: panel-orientation-quirks: Add quirk for AYA NEO 2 model
	drm: panel-orientation-quirks: Add quirk for AYA NEO Founder edition
	drm: panel-orientation-quirks: Add quirk for AYA NEO GEEK
	drm/bridge: it6505: Enable module autoloading
	drm/mcde: Enable module autoloading
	wifi: rtw89: check return value of ieee80211_probereq_get() for RNR
	drm/amd/display: Fix out-of-bounds access in 'dcn21_link_encoder_create'
	drm/radeon/r600_cs: Fix possible int overflow in r600_packet3_check()
	ASoC: Intel: sof_rt5682: Add HDMI-In capture with rt5682 support for MTL.
	dlm: fix possible lkb_resource null dereference
	drm/amd/display: skip disable CRTC in seemless bootup case
	drm/amd/display: Fix garbage or black screen when resetting otg
	drm/amd/display: disable SG displays on cyan skillfish
	drm/xe/ptl: L3bank mask is not available on the media GT
	drm/xe/xe3: Add initial set of workarounds
	drm/display: Fix building with GCC 15
	ALSA: hda: Use own quirk lookup helper
	ALSA: hda/conexant: Use the new codec SSID matching
	ALSA: hda/realtek: Use codec SSID matching for Lenovo devices
	r8169: don't apply UDP padding quirk on RTL8126A
	samples/bpf: Fix a resource leak
	wifi: ath12k: fix atomic calls in ath12k_mac_op_set_bitrate_mask()
	accel/qaic: Add AIC080 support
	drm/amd/display: Full exit out of IPS2 when all allow signals have been cleared
	net: fec_mpc52xx_phy: Use %pa to format resource_size_t
	net: ethernet: fs_enet: Use %pa to format resource_size_t
	net/sched: cbs: Fix integer overflow in cbs_set_port_rate()
	af_packet: avoid erroring out after sock_init_data() in packet_create()
	Bluetooth: L2CAP: do not leave dangling sk pointer on error in l2cap_sock_create()
	Bluetooth: RFCOMM: avoid leaving dangling sk pointer in rfcomm_sock_alloc()
	net: af_can: do not leave a dangling sk pointer in can_create()
	net: ieee802154: do not leave a dangling sk pointer in ieee802154_create()
	net: inet: do not leave a dangling sk pointer in inet_create()
	net: inet6: do not leave a dangling sk pointer in inet6_create()
	wifi: ath10k: avoid NULL pointer error during sdio remove
	wifi: ath5k: add PCI ID for SX76X
	wifi: ath5k: add PCI ID for Arcadyan devices
	fanotify: allow reporting errors on failure to open fd
	bpf: Prevent tailcall infinite loop caused by freplace
	ASoC: sdw_utils: Add support for exclusion DAI quirks
	ASoC: sdw_utils: Add a quirk to allow the cs42l43 mic DAI to be ignored
	ASoC: Intel: sof_sdw: Add quirk for cs42l43 system using host DMICs
	ASoC: Intel: sof_sdw: Add quirks for some new Lenovo laptops
	drm/xe/guc/ct: Flush g2h worker in case of g2h response timeout
	drm/panel: simple: Add Microchip AC69T88A LVDS Display panel
	net: sfp: change quirks for Alcatel Lucent G-010S-P
	net: stmmac: Programming sequence for VLAN packets with split header
	drm/sched: memset() 'job' in drm_sched_job_init()
	drm/amd/display: Adding array index check to prevent memory corruption
	drm/amdgpu/gfx9: Add cleaner shader for GFX9.4.2
	drm/amdgpu: clear RB_OVERFLOW bit when enabling interrupts for vega20_ih
	drm/amdgpu: Dereference the ATCS ACPI buffer
	netlink: specs: Add missing bitset attrs to ethtool spec
	drm/amdgpu: refine error handling in amdgpu_ttm_tt_pin_userptr
	ASoC: sdw_utils: Add quirk to exclude amplifier function
	ASoC: Intel: soc-acpi-intel-arl-match: Add rt722 and rt1320 support
	drm/amd/display: Fix underflow when playing 8K video in full screen mode
	mptcp: annotate data-races around subflow->fully_established
	dma-debug: fix a possible deadlock on radix_lock
	jfs: array-index-out-of-bounds fix in dtReadFirst
	jfs: fix shift-out-of-bounds in dbSplit
	jfs: fix array-index-out-of-bounds in jfs_readdir
	jfs: add a check to prevent array-index-out-of-bounds in dbAdjTree
	fsl/fman: Validate cell-index value obtained from Device Tree
	net/tcp: Add missing lockdep annotations for TCP-AO hlist traversals
	drm/panic: Add ABGR2101010 support
	drm/amd/display: Remove hw w/a toggle if on DP2/HPO
	drm/amd/display: parse umc_info or vram_info based on ASIC
	drm/amd/display: Prune Invalid Modes For HDMI Output
	drm/amdgpu: skip amdgpu_device_cache_pci_state under sriov
	virtio-net: fix overflow inside virtnet_rq_alloc
	ALSA: usb-audio: Make mic volume workarounds globally applicable
	drm/amdgpu: set the right AMDGPU sg segment limitation
	wifi: ipw2x00: libipw_rx_any(): fix bad alignment
	wifi: brcmfmac: Fix oops due to NULL pointer dereference in brcmf_sdiod_sglist_rw()
	bpf: Call free_htab_elem() after htab_unlock_bucket()
	mptcp: fix possible integer overflow in mptcp_reset_tout_timer
	dsa: qca8k: Use nested lock to avoid splat
	i2c: i801: Add support for Intel Panther Lake
	Bluetooth: hci_conn: Reduce hci_conn_drop() calls in two functions
	Bluetooth: btusb: Add RTL8852BE device 0489:e123 to device tables
	Bluetooth: btusb: Add USB HW IDs for MT7920/MT7925
	Bluetooth: hci_conn: Use disable_delayed_work_sync
	Bluetooth: hci_core: Fix not checking skb length on hci_acldata_packet
	Bluetooth: Add new quirks for ATS2851
	Bluetooth: Support new quirks for ATS2851
	Bluetooth: Set quirks for ATS2851
	Bluetooth: btusb: Add new VID/PID 0489/e111 for MT7925
	Bluetooth: btusb: Add new VID/PID 0489/e124 for MT7925
	Bluetooth: btusb: Add 3 HWIDs for MT7925
	ASoC: hdmi-codec: reorder channel allocation list
	rocker: fix link status detection in rocker_carrier_init()
	net/neighbor: clear error in case strict check is not set
	netpoll: Use rcu_access_pointer() in __netpoll_setup
	pinctrl: freescale: fix COMPILE_TEST error with PINCTRL_IMX_SCU
	rtla: Fix consistency in getopt_long for timerlat_hist
	tracing/ftrace: disable preemption in syscall probe
	tracing: Use atomic64_inc_return() in trace_clock_counter()
	tools/rtla: fix collision with glibc sched_attr/sched_set_attr
	rtla/timerlat: Make timerlat_top_cpu->*_count unsigned long long
	rtla/timerlat: Make timerlat_hist_cpu->*_count unsigned long long
	scsi: hisi_sas: Add cond_resched() for no forced preemption model
	scsi: hisi_sas: Create all dump files during debugfs initialization
	ring-buffer: Limit time with disabled interrupts in rb_check_pages()
	pinmux: Use sequential access to access desc->pinmux data
	scsi: ufs: core: Make DMA mask configuration more flexible
	iommu/amd: Fix corruption when mapping large pages from 0
	bpf: put bpf_link's program when link is safe to be deallocated
	scsi: lpfc: Call lpfc_sli4_queue_unset() in restart and rmmod paths
	scsi: lpfc: Check SLI_ACTIVE flag in FDMI cmpl before submitting follow up FDMI
	scsi: lpfc: Prevent NDLP reference count underflow in dev_loss_tmo callback
	clk: qcom: rcg2: add clk_rcg2_shared_floor_ops
	clk: qcom: rpmh: add support for SAR2130P
	clk: qcom: tcsrcc-sm8550: add SAR2130P support
	clk: qcom: dispcc-sm8550: enable support for SAR2130P
	clk: qcom: clk-alpha-pll: Add NSS HUAYRA ALPHA PLL support for ipq9574
	leds: class: Protect brightness_show() with led_cdev->led_access mutex
	scsi: st: Don't modify unknown block number in MTIOCGET
	scsi: st: Add MTIOCGET and MTLOAD to ioctls allowed after device reset
	pinctrl: qcom-pmic-gpio: add support for PM8937
	pinctrl: qcom: spmi-mpp: Add PM8937 compatible
	thermal/drivers/qcom/tsens-v1: Add support for MSM8937 tsens
	nvdimm: rectify the illogical code within nd_dax_probe()
	smb: client: memcpy() with surrounding object base address
	tracing: Fix function name for trampoline
	tools/rtla: Enhance argument parsing in timerlat_load.py
	verification/dot2: Improve dot parser robustness
	mailbox: pcc: Check before sending MCTP PCC response ACK
	f2fs: fix f2fs_bug_on when uninstalling filesystem call f2fs_evict_inode.
	KMSAN: uninit-value in inode_go_dump (5)
	i3c: mipi-i3c-hci: Mask ring interrupts before ring stop request
	PCI: qcom: Add support for IPQ9574
	PCI: vmd: Add DID 8086:B06F and 8086:B60B for Intel client SKUs
	PCI: vmd: Set devices to D0 before enabling PM L1 Substates
	PCI: Detect and trust built-in Thunderbolt chips
	PCI: starfive: Enable controller runtime PM before probing host bridge
	PCI: Add 'reset_subordinate' to reset hierarchy below bridge
	PCI: Add ACS quirk for Wangxun FF5xxx NICs
	remoteproc: qcom: pas: enable SAR2130P audio DSP support
	i3c: Use i3cdev->desc->info instead of calling i3c_device_get_info() to avoid deadlock
	f2fs: print message if fscorrupted was found in f2fs_new_node_page()
	f2fs: fix to shrink read extent node in batches
	f2fs: add a sysfs node to limit max read extent count per-inode
	ACPI: x86: Add skip i2c clients quirk for Acer Iconia One 8 A1-840
	ACPI: x86: Clean up Asus entries in acpi_quirk_skip_dmi_ids[]
	LoongArch: Fix sleeping in atomic context for PREEMPT_RT
	fs/ntfs3: Fix warning in ni_fiemap
	fs/ntfs3: Fix case when unmarked clusters intersect with zone
	regulator: qcom-rpmh: Update ranges for FTSMPS525
	usb: chipidea: add CI_HDRC_HAS_SHORT_PKT_LIMIT flag
	usb: chipidea: udc: limit usb request length to max 16KB
	usb: chipidea: udc: create bounce buffer for problem sglist entries if possible
	usb: chipidea: udc: handle USB Error Interrupt if IOC not set
	usb: typec: ucsi: Do not call ACPI _DSM method for UCSI read operations
	iio: adc: ad7192: properly check spi_get_device_match_data()
	iio: light: ltr501: Add LTER0303 to the supported devices
	usb: typec: ucsi: glink: be more precise on orientation-aware ports
	ASoC: amd: yc: fix internal mic on Redmi G 2022
	drm/amdgpu/vcn: reset fw_shared when VCPU buffers corrupted on vcn v4.0.3
	MIPS: Loongson64: DTS: Really fix PCIe port nodes for ls7a
	ASoC: amd: yc: Add quirk for microphone on Lenovo Thinkpad T14s Gen 6 21M1CTO1WW
	powerpc/prom_init: Fixup missing powermac #size-cells
	misc: eeprom: eeprom_93cx6: Add quirk for extra read clock cycle
	rtc: cmos: avoid taking rtc_lock for extended period of time
	serial: 8250_dw: Add Sophgo SG2044 quirk
	Revert "nvme: make keep-alive synchronous operation"
	irqchip/gicv3-its: Add workaround for hip09 ITS erratum 162100801
	smb: client: don't try following DFS links in cifs_tree_connect()
	setlocalversion: work around "git describe" performance
	io_uring/tctx: work around xa_store() allocation error issue
	scsi: ufs: pltfrm: Dellocate HBA during ufshcd_pltfrm_remove()
	drm/xe/devcoredump: Use drm_puts and already cached local variables
	drm/xe/devcoredump: Improve section headings and add tile info
	drm/xe/devcoredump: Add ASCII85 dump helper function
	drm/xe/guc: Copy GuC log prior to dumping
	drm/xe/forcewake: Add a helper xe_force_wake_ref_has_domain()
	drm/xe/devcoredump: Update handling of xe_force_wake_get return
	drm/amd/display: Add option to retrieve detile buffer size
	sched: fix warning in sched_setaffinity
	sched/core: Remove the unnecessary need_resched() check in nohz_csd_func()
	sched/fair: Check idle_cpu() before need_resched() to detect ilb CPU turning busy
	sched/core: Prevent wakeup of ksoftirqd during idle load balance
	sched/deadline: Fix warning in migrate_enable for boosted tasks
	btrfs: drop unused parameter options from open_ctree()
	btrfs: drop unused parameter data from btrfs_fill_super()
	btrfs: fix mount failure due to remount races
	btrfs: fix missing snapshot drew unlock when root is dead during swap activation
	clk: en7523: Initialize num before accessing hws in en7523_register_clocks()
	tracing/eprobe: Fix to release eprobe when failed to add dyn_event
	x86: Fix build regression with CONFIG_KEXEC_JUMP enabled
	Revert "unicode: Don't special case ignorable code points"
	vfio/mlx5: Align the page tracking max message size with the device capability
	selftests/ftrace: adjust offset for kprobe syntax error test
	KVM: x86/mmu: Ensure that kvm_release_pfn_clean() takes exact pfn from kvm_faultin_pfn()
	jffs2: Prevent rtime decompress memory corruption
	jffs2: Fix rtime decompressor
	media: ipu6: use the IPU6 DMA mapping APIs to do mapping
	ocfs2: Revert "ocfs2: fix the la space leak when unmounting an ocfs2 volume"
	net/mlx5: unique names for per device caches
	ASoC: Intel: avs: Fix return status of avs_pcm_hw_constraints_init()
	drm/amdgpu: rework resume handling for display (v2)
	ALSA: hda: Fix build error without CONFIG_SND_DEBUG
	Revert "drm/amd/display: parse umc_info or vram_info based on ASIC"
	s390/pci: Fix leak of struct zpci_dev when zpci_add_device() fails
	ALSA: hda/realtek: Fix spelling mistake "Firelfy" -> "Firefly"
	timekeeping: Remove CONFIG_DEBUG_TIMEKEEPING
	clocksource: Make negative motion detection more robust
	softirq: Allow raising SCHED_SOFTIRQ from SMP-call-function on RT kernel
	Linux 6.12.5

Change-Id: If1b834954ed2ee1a16886f9a9909c6ca62d93b6c
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2024-12-15 11:57:47 +00:00
Levi Yun
f2b95248a1 dma-debug: fix a possible deadlock on radix_lock
[ Upstream commit 7543c3e3b9b88212fcd0aaf5cab5588797bdc7de ]

radix_lock() shouldn't be held while holding dma_hash_entry[idx].lock
otherwise, there's a possible deadlock scenario when
dma debug API is called holding rq_lock():

CPU0                   CPU1                       CPU2
dma_free_attrs()
check_unmap()          add_dma_entry()            __schedule() //out
                                                  (A) rq_lock()
get_hash_bucket()
(A) dma_entry_hash
                                                  check_sync()
                       (A) radix_lock()           (W) dma_entry_hash
dma_entry_free()
(W) radix_lock()
                       // CPU2's one
                       (W) rq_lock()

CPU1 situation can happen when it extending radix tree and
it tries to wake up kswapd via wake_all_kswapd().

CPU2 situation can happen while perf_event_task_sched_out()
(i.e. dma sync operation is called while deleting perf_event using
 etm and etr tmc which are Arm Coresight hwtracing driver backends).

To remove this possible situation, call dma_entry_free() after
put_hash_bucket() in check_unmap().

Reported-by: Denis Nikitin <denik@chromium.org>
Closes: https://lists.linaro.org/archives/list/coresight@lists.linaro.org/thread/2WMS7BBSF5OZYB63VT44U5YWLFP5HL6U/#RWM6MLQX5ANBTEQ2PRM7OXCBGCE6NPWU
Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-12-14 20:03:52 +01:00
Lee Jones
ac37f41e88 Merge tag 'v6.11-rc3' into android-mainline
Linux 6.11-rc3

Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I514576a36c870fdc69a1763b6ac0222b2968eaf5
2024-09-03 07:16:47 +00:00
Rik van Riel
bd44ca3de4 dma-debug: avoid deadlock between dma debug vs printk and netconsole
Currently the dma debugging code can end up indirectly calling printk
under the radix_lock. This happens when a radix tree node allocation
fails.

This is a problem because the printk code, when used together with
netconsole, can end up inside the dma debugging code while trying to
transmit a message over netcons.

This creates the possibility of either a circular deadlock on the same
CPU, with that CPU trying to grab the radix_lock twice, or an ABBA
deadlock between different CPUs, where one CPU grabs the console lock
first and then waits for the radix_lock, while the other CPU is holding
the radix_lock and is waiting for the console lock.

The trace captured by lockdep is of the ABBA variant.

-> #2 (&dma_entry_hash[i].lock){-.-.}-{2:2}:
                  _raw_spin_lock_irqsave+0x5a/0x90
                  debug_dma_map_page+0x79/0x180
                  dma_map_page_attrs+0x1d2/0x2f0
                  bnxt_start_xmit+0x8c6/0x1540
                  netpoll_start_xmit+0x13f/0x180
                  netpoll_send_skb+0x20d/0x320
                  netpoll_send_udp+0x453/0x4a0
                  write_ext_msg+0x1b9/0x460
                  console_flush_all+0x2ff/0x5a0
                  console_unlock+0x55/0x180
                  vprintk_emit+0x2e3/0x3c0
                  devkmsg_emit+0x5a/0x80
                  devkmsg_write+0xfd/0x180
                  do_iter_readv_writev+0x164/0x1b0
                  vfs_writev+0xf9/0x2b0
                  do_writev+0x6d/0x110
                  do_syscall_64+0x80/0x150
                  entry_SYSCALL_64_after_hwframe+0x4b/0x53

-> #0 (console_owner){-.-.}-{0:0}:
                  __lock_acquire+0x15d1/0x31a0
                  lock_acquire+0xe8/0x290
                  console_flush_all+0x2ea/0x5a0
                  console_unlock+0x55/0x180
                  vprintk_emit+0x2e3/0x3c0
                  _printk+0x59/0x80
                  warn_alloc+0x122/0x1b0
                  __alloc_pages_slowpath+0x1101/0x1120
                  __alloc_pages+0x1eb/0x2c0
                  alloc_slab_page+0x5f/0x150
                  new_slab+0x2dc/0x4e0
                  ___slab_alloc+0xdcb/0x1390
                  kmem_cache_alloc+0x23d/0x360
                  radix_tree_node_alloc+0x3c/0xf0
                  radix_tree_insert+0xf5/0x230
                  add_dma_entry+0xe9/0x360
                  dma_map_page_attrs+0x1d2/0x2f0
                  __bnxt_alloc_rx_frag+0x147/0x180
                  bnxt_alloc_rx_data+0x79/0x160
                  bnxt_rx_skb+0x29/0xc0
                  bnxt_rx_pkt+0xe22/0x1570
                  __bnxt_poll_work+0x101/0x390
                  bnxt_poll+0x7e/0x320
                  __napi_poll+0x29/0x160
                  net_rx_action+0x1e0/0x3e0
                  handle_softirqs+0x190/0x510
                  run_ksoftirqd+0x4e/0x90
                  smpboot_thread_fn+0x1a8/0x270
                  kthread+0x102/0x120
                  ret_from_fork+0x2f/0x40
                  ret_from_fork_asm+0x11/0x20

This bug is more likely than it seems, because when one CPU has run out
of memory, chances are the other has too.

The good news is, this bug is hidden behind the CONFIG_DMA_API_DEBUG, so
not many users are likely to trigger it.

Signed-off-by: Rik van Riel <riel@surriel.com>
Reported-by: Konstantin Ovsepian <ovs@meta.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2024-08-06 10:29:32 -07:00
Lee Jones
6fe236d7fa Merge 3cb9871f81 ("Merge tag 'urgent-rcu.2024.01.24a' of https://github.com/neeraju/linux") into android-mainline
Steps on the way to v6.8-rc1

Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I2b95d8ef56b0a11e730c1cb3bff593c689b32d10
2024-03-28 10:37:42 +00:00
Lee Jones
3de52a531e Merge 296455ade1 ("Merge tag 'char-misc-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc") into android-mainline
Steps on the way to v6.8-rc1

Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I7ba6f71d857ee038050ee35f358ed5989d8d247e
2024-03-28 10:29:10 +00:00
Linus Torvalds
17e232b6d2 Merge tag 'dma-mapping-6.8-2024-01-18' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping fixes from Christoph Hellwig:

 - fix kerneldoc warnings (Randy Dunlap)

 - better bounds checking in swiotlb (ZhangPeng)

* tag 'dma-mapping-6.8-2024-01-18' of git://git.infradead.org/users/hch/dma-mapping:
  dma-debug: fix kernel-doc warnings
  swiotlb: check alloc_size before the allocation of a new memory pool
2024-01-18 16:49:34 -08:00
Randy Dunlap
7c65aa3cc0 dma-debug: fix kernel-doc warnings
Update the kernel-doc comments to catch up with the code changes and
fix the kernel-doc warnings:

debug.c:83: warning: Excess struct member 'stacktrace' description in 'dma_debug_entry'
debug.c:83: warning: Function parameter or struct member 'stack_len' not described in 'dma_debug_entry'
debug.c:83: warning: Function parameter or struct member 'stack_entries' not described in 'dma_debug_entry'

Fixes: 746017ed8d ("dma/debug: Simplify stracktrace retrieval")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: iommu@lists.linux.dev
Signed-off-by: Christoph Hellwig <hch@lst.de>
2024-01-15 08:20:39 +01:00
Greg Kroah-Hartman
86438841e4 dma-debug: make dma_debug_add_bus take a const pointer
The driver core now can handle a const struct bus_type pointer, and the
dma_debug_add_bus() call just passes on the pointer give to it to the
driver core, so make this pointer const as well to allow everyone to use
read-only struct bus_type pointers going forward.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc:  <iommu@lists.linux.dev>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/2023121941-dejected-nugget-681e@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-01-04 14:38:29 +01:00
Greg Kroah-Hartman
661cdfd380 Merge 4684e928db ("Merge tag 'soc-arm-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc") into android-mainline
Steps on the way to 6.7-rc1

Change-Id: I4810b2688c9cb11dec46c2e987a6ca998ee26733
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-12-09 10:46:13 +00:00
Greg Kroah-Hartman
61bbfc8650 Merge tag 'v6.6-rc1' into android-mainline
Linux 6.6-rc1

Change-Id: Ib546c774b9f655bf99270260d5ecbec13462f7e9
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-10-27 10:30:53 +00:00
Chuck Lever
36d91e8515 dma-debug: Fix a typo in a debugging eye-catcher
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2023-10-23 07:52:54 +02:00
Sergey Senozhatsky
fb5a431559 dma-debug: don't call __dma_entry_alloc_check_leak() under free_entries_lock
__dma_entry_alloc_check_leak() calls into printk -> serial console
output (qcom geni) and grabs port->lock under free_entries_lock
spin lock, which is a reverse locking dependency chain as qcom_geni
IRQ handler can call into dma-debug code and grab free_entries_lock
under port->lock.

Move __dma_entry_alloc_check_leak() call out of free_entries_lock
scope so that we don't acquire serial console's port->lock under it.

Trimmed-down lockdep splat:

 The existing dependency chain (in reverse order) is:

               -> #2 (free_entries_lock){-.-.}-{2:2}:
        _raw_spin_lock_irqsave+0x60/0x80
        dma_entry_alloc+0x38/0x110
        debug_dma_map_page+0x60/0xf8
        dma_map_page_attrs+0x1e0/0x230
        dma_map_single_attrs.constprop.0+0x6c/0xc8
        geni_se_rx_dma_prep+0x40/0xcc
        qcom_geni_serial_isr+0x310/0x510
        __handle_irq_event_percpu+0x110/0x244
        handle_irq_event_percpu+0x20/0x54
        handle_irq_event+0x50/0x88
        handle_fasteoi_irq+0xa4/0xcc
        handle_irq_desc+0x28/0x40
        generic_handle_domain_irq+0x24/0x30
        gic_handle_irq+0xc4/0x148
        do_interrupt_handler+0xa4/0xb0
        el1_interrupt+0x34/0x64
        el1h_64_irq_handler+0x18/0x24
        el1h_64_irq+0x64/0x68
        arch_local_irq_enable+0x4/0x8
        ____do_softirq+0x18/0x24
        ...

               -> #1 (&port_lock_key){-.-.}-{2:2}:
        _raw_spin_lock_irqsave+0x60/0x80
        qcom_geni_serial_console_write+0x184/0x1dc
        console_flush_all+0x344/0x454
        console_unlock+0x94/0xf0
        vprintk_emit+0x238/0x24c
        vprintk_default+0x3c/0x48
        vprintk+0xb4/0xbc
        _printk+0x68/0x90
        register_console+0x230/0x38c
        uart_add_one_port+0x338/0x494
        qcom_geni_serial_probe+0x390/0x424
        platform_probe+0x70/0xc0
        really_probe+0x148/0x280
        __driver_probe_device+0xfc/0x114
        driver_probe_device+0x44/0x100
        __device_attach_driver+0x64/0xdc
        bus_for_each_drv+0xb0/0xd8
        __device_attach+0xe4/0x140
        device_initial_probe+0x1c/0x28
        bus_probe_device+0x44/0xb0
        device_add+0x538/0x668
        of_device_add+0x44/0x50
        of_platform_device_create_pdata+0x94/0xc8
        of_platform_bus_create+0x270/0x304
        of_platform_populate+0xac/0xc4
        devm_of_platform_populate+0x60/0xac
        geni_se_probe+0x154/0x160
        platform_probe+0x70/0xc0
        ...

               -> #0 (console_owner){-...}-{0:0}:
        __lock_acquire+0xdf8/0x109c
        lock_acquire+0x234/0x284
        console_flush_all+0x330/0x454
        console_unlock+0x94/0xf0
        vprintk_emit+0x238/0x24c
        vprintk_default+0x3c/0x48
        vprintk+0xb4/0xbc
        _printk+0x68/0x90
        dma_entry_alloc+0xb4/0x110
        debug_dma_map_sg+0xdc/0x2f8
        __dma_map_sg_attrs+0xac/0xe4
        dma_map_sgtable+0x30/0x4c
        get_pages+0x1d4/0x1e4 [msm]
        msm_gem_pin_pages_locked+0x38/0xac [msm]
        msm_gem_pin_vma_locked+0x58/0x88 [msm]
        msm_ioctl_gem_submit+0xde4/0x13ac [msm]
        drm_ioctl_kernel+0xe0/0x15c
        drm_ioctl+0x2e8/0x3f4
        vfs_ioctl+0x30/0x50
        ...

 Chain exists of:
   console_owner --> &port_lock_key --> free_entries_lock

  Possible unsafe locking scenario:

        CPU0                    CPU1
        ----                    ----
   lock(free_entries_lock);
                                lock(&port_lock_key);
                                lock(free_entries_lock);
   lock(console_owner);

                *** DEADLOCK ***

 Call trace:
  dump_backtrace+0xb4/0xf0
  show_stack+0x20/0x30
  dump_stack_lvl+0x60/0x84
  dump_stack+0x18/0x24
  print_circular_bug+0x1cc/0x234
  check_noncircular+0x78/0xac
  __lock_acquire+0xdf8/0x109c
  lock_acquire+0x234/0x284
  console_flush_all+0x330/0x454
  console_unlock+0x94/0xf0
  vprintk_emit+0x238/0x24c
  vprintk_default+0x3c/0x48
  vprintk+0xb4/0xbc
  _printk+0x68/0x90
  dma_entry_alloc+0xb4/0x110
  debug_dma_map_sg+0xdc/0x2f8
  __dma_map_sg_attrs+0xac/0xe4
  dma_map_sgtable+0x30/0x4c
  get_pages+0x1d4/0x1e4 [msm]
  msm_gem_pin_pages_locked+0x38/0xac [msm]
  msm_gem_pin_vma_locked+0x58/0x88 [msm]
  msm_ioctl_gem_submit+0xde4/0x13ac [msm]
  drm_ioctl_kernel+0xe0/0x15c
  drm_ioctl+0x2e8/0x3f4
  vfs_ioctl+0x30/0x50
  ...

Reported-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2023-08-30 11:29:08 +02:00
Greg Kroah-Hartman
89c0d89828 Merge tag 'v6.4-rc1' into android-mainline
Linux 6.4-rc1

Change-Id: I009b12376eefeec4f7570017f5e240226089eafe
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-06-19 17:22:18 +00:00
Geert Uytterhoeven
b31507dcaf dma-debug: Use %pa to format phys_addr_t
On 32-bit without LPAE:

    kernel/dma/debug.c: In function ‘debug_dma_dump_mappings’:
    kernel/dma/debug.c:537:7: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 9 has type ‘phys_addr_t’ {aka ‘unsigned int’} [-Wformat=]
    kernel/dma/debug.c: In function ‘dump_show’:
    kernel/dma/debug.c:568:59: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 11 has type ‘phys_addr_t’ {aka ‘unsigned int’} [-Wformat=]

Fixes: bd89d69a52 ("dma-debug: add cacheline to user/kernel space dump messages")
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/202303160548.ReyuTsGD-lkp@intel.com
Reported-by: noreply@ellerman.id.au
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2023-03-30 08:51:52 +09:00
Desnes Nunes
bd89d69a52 dma-debug: add cacheline to user/kernel space dump messages
Having the cacheline also printed on the debug_dma_dump_mappings() and
dump_show() is useful for debugging. Furthermore, this also standardizes
the messages shown on both dump functions.

Signed-off-by: Desnes Nunes <desnesn@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2023-03-28 10:34:05 +09:00
Desnes Nunes
479623fd0c dma-debug: small dma_debug_entry's comment and variable name updates
Small update on dma_debug_entry's struct commentary and also standardize
the usage of 'dma_addr' variable name from debug_dma_map_page() on
debug_dma_unmap_page(), and similarly on debug_dma_free_coherent()

Signed-off-by: Desnes Nunes <desnesn@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2023-03-28 10:34:05 +09:00
Yunfei Wang
5c5a86e82d ANDROID: dma/debug: fix warning of check_sync
check_sync() checks for whether device driver DMA sync sg list entry count equals to map sg list entry count, but in struct dma_buf_ops, there has below interface:
 int (*begin_cpu_access_partial)
 int (*end_cpu_access_partial)

When vendor implement these interface in dma heap to support dma-buf partial cache sync for performance improvement, in dma_buf_ops of heap, we copy a sgtable from orginal sgtable but with necessary nents, it will less then nents used in map attachment, in the way, the following warning had occurred:
DMA-API: device_xxx: device driver syncs DMA sg list with different entry count [map count=5] [sync count=1]
Call trace:
 check_sync+0x6d8/0xb40
 debug_dma_sync_sg_for_cpu+0x114/0x16c
 dma_sync_sg_for_cpu+0xa0/0xe4

So need change check conditation in check_sync to support dma-buf partial cache sync.

Fixes: Icce61fc21b1 ("ANDROID: dma-buf: Add support for partial cache maintenance")
Bug: 236343688
Signed-off-by: Mingyuan Ma <mingyuan.ma@mediatek.com>
Signed-off-by: Yunfei Wang <yf.wang@mediatek.com>
Change-Id: I2f4db3b156e752eeb022927957f77a3fa534a573
(cherry picked from commit d61fe3ad4bab3f4bc040e7ac0c7ec919b50e8a43)
2022-09-27 18:46:03 +00:00
Robin Murphy
2995b8002c dma-debug: improve search for partial syncs
When bucket_find_contains() tries to find the original entry for a
partial sync, it manages to constrain its search in a way that is both
too restrictive and not restrictive enough. A driver which only uses
single mappings rather than scatterlists might not set max_seg_size, but
could still technically perform a partial sync at an offset of more than
64KB into a sufficiently large mapping, so we could stop searching too
early before reaching a legitimate entry. Conversely, if no valid entry
is present and max_range is large enough, we can pointlessly search
buckets that we've already searched, or that represent an impossible
wrapping around the bottom of the address space. At worst, the
(legitimate) case of max_seg_size == UINT_MAX can make the loop
infinite.

Replace the fragile and frankly hard-to-follow "range" logic with a
simple counted loop for the number of possible hash buckets below the
given address.

Reported-by: Yunfei Wang <yf.wang@mediatek.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2022-09-07 10:38:16 +02:00
Rob Clark
e19f8fa6ce dma-debug: make things less spammy under memory pressure
Limit the error msg to avoid flooding the console.  If you have a lot of
threads hitting this at once, they could have already gotten passed the
dma_debug_disabled() check before they get to the point of allocation
failure, resulting in quite a lot of this error message spamming the
log.  Use pr_err_once() to limit that.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2022-06-02 07:17:59 +02:00
Mikulas Patocka
84bc4f1dbb dma-debug: change allocation mode from GFP_NOWAIT to GFP_ATIOMIC
We observed the error "cacheline tracking ENOMEM, dma-debug disabled"
during a light system load (copying some files). The reason for this error
is that the dma_active_cacheline radix tree uses GFP_NOWAIT allocation -
so it can't access the emergency memory reserves and it fails as soon as
anybody reaches the watermark.

This patch changes GFP_NOWAIT to GFP_ATOMIC, so that it can access the
emergency memory reserves.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2022-05-11 19:48:34 +02:00
Randy Dunlap
80e4390981 dma-debug: fix return value of __setup handlers
When valid kernel command line parameters
  dma_debug=off dma_debug_entries=100
are used, they are reported as Unknown parameters and added to init's
environment strings, polluting it.

  Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc5
    dma_debug=off dma_debug_entries=100", will be passed to user space.

and

 Run /sbin/init as init process
   with arguments:
     /sbin/init
   with environment:
     HOME=/
     TERM=linux
     BOOT_IMAGE=/boot/bzImage-517rc5
     dma_debug=off
     dma_debug_entries=100

Return 1 from these __setup handlers to indicate that the command line
option has been handled.

Fixes: 59d3daafa1 ("dma-debug: add kernel command line parameters")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: iommu@lists.linux-foundation.org
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2022-03-03 14:01:45 +03:00
Hamza Mahfooz
c2bbf9d1e9 dma-debug: teach add_dma_entry() about DMA_ATTR_SKIP_CPU_SYNC
Mapping something twice should be possible as long as,
DMA_ATTR_SKIP_CPU_SYNC is passed to the strictly speaking second relevant
mapping operation (that attempts to map the same thing). So, don't issue a
warning if the specified condition is met in add_dma_entry().

Signed-off-by: Hamza Mahfooz <someguy@effective-light.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2021-10-18 12:46:45 +02:00
Gerald Schaefer
293d92cbbd dma-debug: fix sg checks in debug_dma_map_sg()
The following warning occurred sporadically on s390:
DMA-API: nvme 0006:00:00.0: device driver maps memory from kernel text or rodata [addr=0000000048cc5e2f] [len=131072]
WARNING: CPU: 4 PID: 825 at kernel/dma/debug.c:1083 check_for_illegal_area+0xa8/0x138

It is a false-positive warning, due to broken logic in debug_dma_map_sg().
check_for_illegal_area() checks for overlay of sg elements with kernel text
or rodata. It is called with sg_dma_len(s) instead of s->length as
parameter. After the call to ->map_sg(), sg_dma_len() will contain the
length of possibly combined sg elements in the DMA address space, and not
the individual sg element length, which would be s->length.

The check will then use the physical start address of an sg element, and
add the DMA length for the overlap check, which could result in the false
warning, because the DMA length can be larger than the actual single sg
element length.

In addition, the call to check_for_illegal_area() happens in the iteration
over mapped_ents, which will not include all individual sg elements if
any of them were combined in ->map_sg().

Fix this by using s->length instead of sg_dma_len(s). Also put the call to
check_for_illegal_area() in a separate loop, iterating over all the
individual sg elements ("nents" instead of "mapped_ents").

While at it, as suggested by Robin Murphy, also move check_for_stack()
inside the new loop, as it is similarly concerned with validating the
individual sg elements.

Link: https://lore.kernel.org/lkml/20210705185252.4074653-1-gerald.schaefer@linux.ibm.com
Fixes: 884d05970b ("dma-debug: use sg_dma_len accessor")
Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2021-10-11 13:43:31 +02:00
Hamza Mahfooz
510e1a724a dma-debug: prevent an error message from causing runtime problems
For some drivers, that use the DMA API. This error message can be reached
several millions of times per second, causing spam to the kernel's printk
buffer and bringing the CPU usage up to 100% (so, it should be rate
limited). However, since there is at least one driver that is in the
mainline and suffers from the error condition, it is more useful to
err_printk() here instead of just rate limiting the error message (in hopes
that it will make it easier for other drivers that suffer from this issue
to be spotted).

Link: https://lkml.kernel.org/r/fd67fbac-64bf-f0ea-01e1-5938ccfab9d0@arm.com
Reported-by: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: Hamza Mahfooz <someguy@effective-light.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2021-09-13 18:29:24 +02:00
Anthony Iliopoulos
173735c346 dma-debug: fix debugfs initialization order
Due to link order, dma_debug_init is called before debugfs has a chance
to initialize (via debugfs_init which also happens in the core initcall
stage), so the directories for dma-debug are never created.

Decouple dma_debug_fs_init from dma_debug_init and defer its init until
core_initcall_sync (after debugfs has been initialized) while letting
dma-debug initialization occur as soon as possible to catch any early
mappings, as suggested in [1].

[1] https://lore.kernel.org/linux-iommu/YIgGa6yF%2Fadg8OSN@kroah.com/

Fixes: 15b28bbcd5 ("dma-debug: move initialization to common code")
Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2021-08-09 17:06:11 +02:00
Kefeng Wang
1d7db834a0 dma-debug: use memory_intersects() directly
There is already a memory_intersects() helper in sections.h,
use memory_intersects() directly instead of private overlap().

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2021-08-09 17:03:17 +02:00
Hamza Mahfooz
2b4bbc6231 dma-debug: report -EEXIST errors in add_dma_entry
Since, overlapping mappings are not supported by the DMA API we should
report an error if active_cacheline_insert returns -EEXIST.

Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Hamza Mahfooz <someguy@effective-light.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2021-06-22 08:15:47 +02:00
Christoph Hellwig
a1fd09e8e6 dma-mapping: move dma-debug.h to kernel/dma/
Most of dma-debug.h is not required by anything outside of kernel/dma.
Move the four declarations needed by dma-mappin.h or dma-ops providers
into dma-mapping.h and dma-map-ops.h, and move the remainder of the
file to kernel/dma/debug.h.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2020-10-06 07:07:05 +02:00
Xu Wang
a97740f818 dma-debug: convert comma to semicolon
Replace a comma between expression statements by a semicolon.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2020-09-21 16:48:38 +02:00
Christoph Hellwig
ec91ccb274 dma-debug: remove most exports
Now that the main dma mapping entry points are out of line most of the
symbols in dma-debug.c can only be called from built-in code.  Remove
the unused exports.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
2020-09-11 08:13:12 +02:00
Linus Torvalds
5848dc5b1b dma-debug: remove debug_dma_assert_idle() function
This remoes the code from the COW path to call debug_dma_assert_idle(),
which was added many years ago.

Google shows that it hasn't caught anything in the 6+ years we've had it
apart from a false positive, and Hugh just noticed how it had a very
unfortunate spinlock serialization in the COW path.

He fixed that issue the previous commit (a85ffd59bd: "dma-debug: fix
debug_dma_assert_idle(), use rcu_read_lock()"), but let's see if anybody
even notices when we remove this function entirely.

NOTE! We keep the dma tracking infrastructure that was added by the
commit that introduced it.  Partly to make it easier to resurrect this
debug code if we ever deside to, and partly because that tracking by pfn
and offset looks quite reasonable.

The problem with this debug code was simply that it was expensive and
didn't seem worth it, not that it was wrong per se.

Acked-by: Dan Williams <dan.j.williams@intel.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-08-14 15:22:43 -07:00
Hugh Dickins
a85ffd59bd dma-debug: fix debug_dma_assert_idle(), use rcu_read_lock()
Since commit 2a9127fcf2 ("mm: rewrite wait_on_page_bit_common()
logic") improved unlock_page(), it has become more noticeable how
cow_user_page() in a kernel with CONFIG_DMA_API_DEBUG=y can create and
suffer from heavy contention on DMA debug's radix_lock in
debug_dma_assert_idle().

It is only doing a lookup: use rcu_read_lock() and rcu_read_unlock()
instead; though that does require the static ents[] to be moved
onstack...

...but, hold on, isn't that radix_tree_gang_lookup() and loop doing
quite the wrong thing: searching CACHELINES_PER_PAGE entries for an
exact match with the first cacheline of the page in question?
radix_tree_gang_lookup() is the right tool for the job, but we need
nothing more than to check the first entry it can find, reporting if
that falls anywhere within the page.

(Is RCU safe here? As safe as using the spinlock was. The entries are
never freed, so don't need to be freed by RCU. They may be reused, and
there is a faint chance of a race, with an offending entry reused while
printing its error info; but the spinlock did not prevent that either,
and I agree that it's not worth worrying about. ]

[ Side noe: this patch is a clear improvement to the status quo, but the
  next patch will be removing this debug function entirely.

  But just in case we decide we want to resurrect the debugging code
  some day, I'm first applying this improvement patch so that it doesn't
  get lost    - Linus ]

Fixes: 3b7a6418c7 ("dma debug: account for cachelines and read-only mappings in overlap tracking")
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-08-14 15:16:03 -07:00
Linus Torvalds
2324d50d05 Merge tag 'docs-5.9' of git://git.lwn.net/linux
Pull documentation updates from Jonathan Corbet:
 "It's been a busy cycle for documentation - hopefully the busiest for a
  while to come. Changes include:

   - Some new Chinese translations

   - Progress on the battle against double words words and non-HTTPS
     URLs

   - Some block-mq documentation

   - More RST conversions from Mauro. At this point, that task is
     essentially complete, so we shouldn't see this kind of churn again
     for a while. Unless we decide to switch to asciidoc or
     something...:)

   - Lots of typo fixes, warning fixes, and more"

* tag 'docs-5.9' of git://git.lwn.net/linux: (195 commits)
  scripts/kernel-doc: optionally treat warnings as errors
  docs: ia64: correct typo
  mailmap: add entry for <alobakin@marvell.com>
  doc/zh_CN: add cpu-load Chinese version
  Documentation/admin-guide: tainted-kernels: fix spelling mistake
  MAINTAINERS: adjust kprobes.rst entry to new location
  devices.txt: document rfkill allocation
  PCI: correct flag name
  docs: filesystems: vfs: correct flag name
  docs: filesystems: vfs: correct sync_mode flag names
  docs: path-lookup: markup fixes for emphasis
  docs: path-lookup: more markup fixes
  docs: path-lookup: fix HTML entity mojibake
  CREDITS: Replace HTTP links with HTTPS ones
  docs: process: Add an example for creating a fixes tag
  doc/zh_CN: add Chinese translation prefer section
  doc/zh_CN: add clearing-warn-once Chinese version
  doc/zh_CN: add admin-guide index
  doc:it_IT: process: coding-style.rst: Correct __maybe_unused compiler label
  futex: MAINTAINERS: Re-add selftests directory
  ...
2020-08-04 22:47:54 -07:00
Linus Torvalds
2ed90dbbf7 Merge tag 'dma-mapping-5.9' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping updates from Christoph Hellwig:

 - make support for dma_ops optional

 - move more code out of line

 - add generic support for a dma_ops bypass mode

 - misc cleanups

* tag 'dma-mapping-5.9' of git://git.infradead.org/users/hch/dma-mapping:
  dma-contiguous: cleanup dma_alloc_contiguous
  dma-debug: use named initializers for dir2name
  powerpc: use the generic dma_ops_bypass mode
  dma-mapping: add a dma_ops_bypass flag to struct device
  dma-mapping: make support for dma ops optional
  dma-mapping: inline the fast path dma-direct calls
  dma-mapping: move the remaining DMA API calls out of line
2020-08-04 17:29:57 -07:00
Christoph Hellwig
23efed6fa7 dma-debug: use named initializers for dir2name
Make dir2name a little more readable and maintainable by using
named initializers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
2020-07-19 09:31:13 +02:00
Kees Cook
3f649ab728 treewide: Remove uninitialized_var() usage
Using uninitialized_var() is dangerous as it papers over real bugs[1]
(or can in the future), and suppresses unrelated compiler warnings
(e.g. "unused variable"). If the compiler thinks it is uninitialized,
either simply initialize the variable or make compiler changes.

In preparation for removing[2] the[3] macro[4], remove all remaining
needless uses with the following script:

git grep '\buninitialized_var\b' | cut -d: -f1 | sort -u | \
	xargs perl -pi -e \
		's/\buninitialized_var\(([^\)]+)\)/\1/g;
		 s:\s*/\* (GCC be quiet|to make compiler happy) \*/$::g;'

drivers/video/fbdev/riva/riva_hw.c was manually tweaked to avoid
pathological white-space.

No outstanding warnings were found building allmodconfig with GCC 9.3.0
for x86_64, i386, arm64, arm, powerpc, powerpc64le, s390x, mips, sparc64,
alpha, and m68k.

[1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/
[2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/
[3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/
[4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/

Reviewed-by: Leon Romanovsky <leonro@mellanox.com> # drivers/infiniband and mlx4/mlx5
Acked-by: Jason Gunthorpe <jgg@mellanox.com> # IB
Acked-by: Kalle Valo <kvalo@codeaurora.org> # wireless drivers
Reviewed-by: Chao Yu <yuchao0@huawei.com> # erofs
Signed-off-by: Kees Cook <keescook@chromium.org>
2020-07-16 12:35:15 -07:00
Mauro Carvalho Chehab
985098a05e docs: fix references for DMA*.txt files
As we moved those files to core-api, fix references to point
to their newer locations.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/37b2fd159fbc7655dbf33b3eb1215396a25f6344.1592895969.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2020-06-26 10:01:32 -06:00
Jason Yan
05f099a7d0 dma-debug: make __dma_entry_alloc_check_leak() static
Fix the following sparse warning:

kernel/dma/debug.c:659:6: warning: symbol '__dma_entry_alloc_check_leak'
was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2020-04-20 12:05:18 +02:00
Grygorii Strashko
9bb50ed747 dma-debug: fix displaying of dma allocation type
The commit 2e05ea5cdc ("dma-mapping: implement dma_map_single_attrs using
dma_map_page_attrs") removed "dma_debug_page" enum, but missed to update
type2name string table. This causes incorrect displaying of dma allocation
type.
Fix it by removing "page" string from type2name string table and switch to
use named initializers.

Before (dma_alloc_coherent()):
k3-ringacc 4b800000.ringacc: scather-gather idx 2208 P=d1140000 N=d114 D=d1140000 L=40 DMA_BIDIRECTIONAL dma map error check not applicable
k3-ringacc 4b800000.ringacc: scather-gather idx 2216 P=d1150000 N=d115 D=d1150000 L=40 DMA_BIDIRECTIONAL dma map error check not applicable

After:
k3-ringacc 4b800000.ringacc: coherent idx 2208 P=d1140000 N=d114 D=d1140000 L=40 DMA_BIDIRECTIONAL dma map error check not applicable
k3-ringacc 4b800000.ringacc: coherent idx 2216 P=d1150000 N=d115 D=d1150000 L=40 DMA_BIDIRECTIONAL dma map error check not applicable

Fixes: 2e05ea5cdc ("dma-mapping: implement dma_map_single_attrs using dma_map_page_attrs")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2020-04-08 21:46:57 +02:00
Linus Torvalds
81b6b96475 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux; tag 'dma-mapping-5.5' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping updates from Christoph Hellwig:

 - improve dma-debug scalability (Eric Dumazet)

 - tiny dma-debug cleanup (Dan Carpenter)

 - check for vmap memory in dma_map_single (Kees Cook)

 - check for dma_addr_t overflows in dma-direct when using DMA offsets
   (Nicolas Saenz Julienne)

 - switch the x86 sta2x11 SOC to use more generic DMA code (Nicolas
   Saenz Julienne)

 - fix arm-nommu dma-ranges handling (Vladimir Murzin)

 - use __initdata in CMA (Shyam Saini)

 - replace the bus dma mask with a limit (Nicolas Saenz Julienne)

 - merge the remapping helpers into the main dma-direct flow (me)

 - switch xtensa to the generic dma remap handling (me)

 - various cleanups around dma_capable (me)

 - remove unused dev arguments to various dma-noncoherent helpers (me)

* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux:

* tag 'dma-mapping-5.5' of git://git.infradead.org/users/hch/dma-mapping: (22 commits)
  dma-mapping: treat dev->bus_dma_mask as a DMA limit
  dma-direct: exclude dma_direct_map_resource from the min_low_pfn check
  dma-direct: don't check swiotlb=force in dma_direct_map_resource
  dma-debug: clean up put_hash_bucket()
  powerpc: remove support for NULL dev in __phys_to_dma / __dma_to_phys
  dma-direct: avoid a forward declaration for phys_to_dma
  dma-direct: unify the dma_capable definitions
  dma-mapping: drop the dev argument to arch_sync_dma_for_*
  x86/PCI: sta2x11: use default DMA address translation
  dma-direct: check for overflows on 32 bit DMA addresses
  dma-debug: increase HASH_SIZE
  dma-debug: reorder struct dma_debug_entry fields
  xtensa: use the generic uncached segment support
  dma-mapping: merge the generic remapping helpers into dma-direct
  dma-direct: provide mmap and get_sgtable method overrides
  dma-direct: remove the dma_handle argument to __dma_direct_alloc_pages
  dma-direct: remove __dma_direct_free_pages
  usb: core: Remove redundant vmap checks
  kernel: dma-contiguous: mark CMA parameters __initdata/__initconst
  dma-debug: add a schedule point in debug_dma_dump_mappings()
  ...
2019-11-28 11:16:43 -08:00
Dan Carpenter
50f579a239 dma-debug: clean up put_hash_bucket()
The put_hash_bucket() is a bit cleaner if it takes an unsigned long
directly instead of a pointer to unsigned long.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-11-20 20:31:41 +01:00
Eric Dumazet
5e76f56457 dma-debug: increase HASH_SIZE
With modern NIC, it is not unusual having about ~256,000 active dma
mappings and a hash size of 1024 buckets is too small.

Forcing full cache line per bucket does not seem useful, especially now
that we have contention on free_entries_lock for allocations and freeing
of entries.  Better use the space to fit more buckets.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-11-11 10:52:18 +01:00
Eric Dumazet
d3694f3073 dma-debug: reorder struct dma_debug_entry fields
Move all fields used during exact match lookups to the first cache line.
This makes debug_dma_mapping_error() and friends about 50% faster.

Since it removes two 32bit holes, force a cacheline alignment on struct
dma_debug_entry.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-11-11 10:52:18 +01:00
Eric Dumazet
9ff6aa027d dma-debug: add a schedule point in debug_dma_dump_mappings()
debug_dma_dump_mappings() can take a lot of cpu cycles :

lpk43:/# time wc -l /sys/kernel/debug/dma-api/dump
163435 /sys/kernel/debug/dma-api/dump

real	0m0.463s
user	0m0.003s
sys	0m0.459s

Let's add a cond_resched() to avoid holding cpu for too long.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Corentin Labbe <clabbe@baylibre.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-10-30 11:09:35 -07:00
Kefeng Wang
fc65104c7c dma-debug: Use pr_warn instead of pr_warning
As said in commit f2c2cbcc35 ("powerpc: Use pr_warn instead of
pr_warning"), removing pr_warning so all logging messages use a
consistent <prefix>_warn style. Let's do it.

Link: http://lkml.kernel.org/r/20191018031850.48498-25-wangkefeng.wang@huawei.com
To: linux-kernel@vger.kernel.org
Cc: Christoph Hellwig <hch@lst.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
2019-10-18 15:01:56 +02:00
Thomas Gleixner
4505153954 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license version 2 as
  published by the free software foundation this program is
  distributed in the hope that it will be useful but without any
  warranty without even the implied warranty of merchantability or
  fitness for a particular purpose see the gnu general public license
  for more details you should have received a copy of the gnu general
  public license along with this program if not write to the free
  software foundation inc 59 temple place suite 330 boston ma 02111
  1307 usa

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 136 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190530000436.384967451@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05 17:37:06 +02:00
Thomas Gleixner
746017ed8d dma/debug: Simplify stracktrace retrieval
Replace the indirection through struct stack_trace with an invocation of
the storage array based interface.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: iommu@lists.linux-foundation.org
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Alexander Potapenko <glider@google.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: linux-mm@kvack.org
Cc: David Rientjes <rientjes@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: kasan-dev@googlegroups.com
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: David Sterba <dsterba@suse.com>
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org
Cc: dm-devel@redhat.com
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Alasdair Kergon <agk@redhat.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
Cc: Miroslav Benes <mbenes@suse.cz>
Cc: linux-arch@vger.kernel.org
Link: https://lkml.kernel.org/r/20190425094802.248658135@linutronix.de
2019-04-29 12:37:50 +02:00
Scott Wood
8c5165430c dma-debug: only skip one stackframe entry
With skip set to 1, I get a traceback like this:

[  106.867637] DMA-API: Mapped at:
[  106.870784]  afu_dma_map_region+0x2cd/0x4f0 [dfl_afu]
[  106.875839]  afu_ioctl+0x258/0x380 [dfl_afu]
[  106.880108]  do_vfs_ioctl+0xa9/0x720
[  106.883688]  ksys_ioctl+0x60/0x90
[  106.887007]  __x64_sys_ioctl+0x16/0x20

With the previous value of 2, afu_dma_map_region was being omitted.  I
suspect that the code paths have simply changed since the value of 2 was
chosen a decade ago, but it's also possible that it varies based on which
mapping function was used, compiler inlining choices, etc.  In any case,
it's best to err on the side of skipping less.

Signed-off-by: Scott Wood <swood@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-04-11 19:29:50 +02:00
Corentin Labbe
0a3b192c26 dma-debug: add dumping facility via debugfs
While debugging a DMA mapping leak, I needed to access
debug_dma_dump_mappings() but easily from user space.

This patch adds a /sys/kernel/debug/dma-api/dump file which contain all
current DMA mapping.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-02-01 10:06:44 +01:00