linux/drivers/gpu/drm/amd/amdkfd
Gerhard Schwanzer b89d58b659 drm/amdkfd: Use exclusive bounds for SVM split alignment checks
SVM ranges use inclusive page indices: prange->last is the last page in
the range. The split-remap logic introduced by commit 448ee45353
("drm/amdkfd: Use huge page size to check split svm range alignment")
uses ALIGN_DOWN(prange->last, 512) to determine whether the original
range can contain a 2MB huge-page mapping.

That aligns the last page itself down. Thus a range ending one page
before the next 2MB boundary is classified as if the final 2MB block did
not exist. When such a range is split inside that final block, the
split head or tail can be left off the remap list even though it was
derived from an original range that may have PMD mappings.

Use prange->last + 1 as the exclusive upper bound when computing the
original range's last 2MB-aligned boundary. Then use the actual split
boundary for the head and tail alignment checks: tail->start for a tail
split, and new_start for a head split. new_start is equivalent to
head->last + 1 and directly names the exclusive end of the split head.

Using head->last for the head-side check can both remap a head that ends
exactly one page before a 2MB boundary and miss a head whose split
boundary is one page after such a boundary. Philip Yang pointed out in
the review of the original change that this condition should use
head->last + 1 or new_start.

Xiaogang Chen identified the inclusive-last cause and posted the
candidate fix in the regression thread. With the culprit change active
and the local revert not applied, the unchanged C/HSA reproducer
completes 10/10 runs with this change on an RX 7600 XT.

Fixes: 448ee45353 ("drm/amdkfd: Use huge page size to check split svm range alignment")
Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/4914
Link: https://lore.kernel.org/stable/IA1PR12MB85172F7FE9157C092EDA46A0E3112@IA1PR12MB8517.namprd12.prod.outlook.com/
Link: https://lore.kernel.org/all/32ce2b72-aa16-4202-9f99-92e3cd4408bc@amd.com/
Suggested-by: Xiaogang Chen <xiaogang.chen@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Gerhard Schwanzer <geschw@pm.me>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit a60ea15807)
Cc: stable@vger.kernel.org
2026-06-17 18:35:32 -04:00
..
cik_event_interrupt.c drm/amdkfd: Don't expect signal mailbox update 2026-03-17 10:31:39 -04:00
cik_int.h
cik_regs.h
cwsr_trap_handler_gfx8.asm
cwsr_trap_handler_gfx9.asm drm/amdkfd: Clear MODE.VSKIP in gfx9 trap handler 2025-01-24 09:53:05 -05:00
cwsr_trap_handler_gfx10.asm drm/amdkfd: Move gfx12 trap handler to separate file 2025-01-09 16:02:56 -05:00
cwsr_trap_handler_gfx12.asm drm/amdkfd: fix CWSR trap handler 2026-02-26 11:20:10 -05:00
cwsr_trap_handler.h drm/amdkfd: gfx12.1 trap handler instruction fixup for VOP3PX 2026-01-28 16:21:21 -05:00
Kconfig dma-buf: Always build with DMABUF_MOVE_NOTIFY 2026-01-27 10:45:11 +01:00
kfd_chardev.c drm/amdkfd: Use memdup_array_user to copy data from/to user space at kfd ioctls 2026-06-17 18:24:53 -04:00
kfd_crat.c drm/amdkfd: Fix infinite loop parsing CRAT with zero subtype length 2026-06-04 15:27:41 -04:00
kfd_crat.h drm/amdkfd: Reconcile the definition and use of oem_id in struct kfd_topology_device 2024-05-08 18:46:26 -04:00
kfd_debug.c drm/amdkfd: Unwind debug trap enable on copy_to_user failure 2026-06-04 15:25:55 -04:00
kfd_debug.h drm/amdkfd: fix gfx11 restrictions on debugging cooperative launch 2026-01-20 21:50:12 -05:00
kfd_debugfs.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
kfd_device_queue_manager_cik.c drm/amdkfd: Add support for more per-process flag 2025-03-07 15:33:49 -05:00
kfd_device_queue_manager_v9.c drm/amdkfd: Correct F8_MODE for gfx950 2025-03-13 23:13:12 -04:00
kfd_device_queue_manager_v10.c drm/amdkfd: Add support for more per-process flag 2025-03-07 15:33:49 -05:00
kfd_device_queue_manager_v11.c drm/amdkfd: Add support for more per-process flag 2025-03-07 15:33:49 -05:00
kfd_device_queue_manager_v12_1.c drm/amdkfd: Limit per-process xnack support for GFX12.1 2026-04-24 10:57:31 -04:00
kfd_device_queue_manager_v12.c drm/amdkfd: Add support for more per-process flag 2025-03-07 15:33:49 -05:00
kfd_device_queue_manager_vi.c drm/amdkfd: Add support for more per-process flag 2025-03-07 15:33:49 -05:00
kfd_device_queue_manager.c drm/amdkfd: always resume_all after suspend_all 2026-06-04 15:38:08 -04:00
kfd_device_queue_manager.h amd/amdkfd: Add kfd_ioctl_profiler to contain profiler kernel driver changes 2026-05-11 15:55:55 -04:00
kfd_device.c amd/amdkfd: Fix profiler lock init order 2026-06-03 13:59:33 -04:00
kfd_doorbell.c drm/amdkfd: check find_first_zero_bit before __set_bit on kfd->doorbell_bitmap 2026-06-17 18:24:47 -04:00
kfd_events.c drm/amdkfd: Add bounds check for AMDKFD_IOC_WAIT_EVENTS 2026-06-04 15:25:39 -04:00
kfd_events.h drm/amdkfd: Don't expect signal mailbox update 2026-03-17 10:31:39 -04:00
kfd_flat_memory.c drm/amdgpu: GFX12.1 scratch memory limit up to 57-bit 2026-03-04 11:42:26 -05:00
kfd_int_process_v9.c drm/amdkfd: Don't expect signal mailbox update 2026-03-17 10:31:39 -04:00
kfd_int_process_v10.c drm/amdkfd: Don't expect signal mailbox update 2026-03-17 10:31:39 -04:00
kfd_int_process_v11.c drm/amdkfd: Don't expect signal mailbox update 2026-03-17 10:31:39 -04:00
kfd_int_process_v12_1.c drm/amdkfd: Switch to dev_* printk stuff in kfd_int_process_v12_1.c 2026-03-30 15:13:14 -04:00
kfd_interrupt.c drm/amdgpu: Show warning message if IH ring overflow 2024-12-18 12:39:07 -05:00
kfd_kernel_queue.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
kfd_kernel_queue.h
kfd_migrate.c drm/amdkfd: Fix SMI event PID reporting for containers 2026-06-17 18:12:00 -04:00
kfd_migrate.h drm/amdgpu: update the functions to use amdgpu version of hmm 2025-10-13 14:14:36 -04:00
kfd_module.c drm/amdkfd: Destroy KFD debugfs after destroy KFD wq 2025-08-06 16:52:08 -04:00
kfd_mqd_manager_cik.c drm/amdkfd: Removed commented line for MQD queue priority 2026-02-25 16:28:10 -05:00
kfd_mqd_manager_v9.c drm/amdkfd: Fix OOB memory exposure in get_wave_state() 2026-05-18 18:15:28 -04:00
kfd_mqd_manager_v10.c amd/amdkfd: Add kfd_ioctl_profiler to contain profiler kernel driver changes 2026-05-11 15:55:55 -04:00
kfd_mqd_manager_v11.c drm/amdkfd: Fix buffer overflow in SDMA queue checkpoint/restore on GFX11 2026-06-03 13:55:24 -04:00
kfd_mqd_manager_v12_1.c drm/amdkfd: fix redundant MQD iterations in GFX v12.1 2026-04-17 15:41:14 -04:00
kfd_mqd_manager_v12.c amd/amdkfd: Add kfd_ioctl_profiler to contain profiler kernel driver changes 2026-05-11 15:55:55 -04:00
kfd_mqd_manager_vi.c amd/amdkfd: Add kfd_ioctl_profiler to contain profiler kernel driver changes 2026-05-11 15:55:55 -04:00
kfd_mqd_manager.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
kfd_mqd_manager.h drm/amdgpu: Check for multiplication overflow in checkpoint stack size 2026-03-06 16:33:59 -05:00
kfd_packet_manager_v9.c amdkfd: remove DIQ support 2025-12-08 13:56:42 -05:00
kfd_packet_manager_vi.c amdkfd: remove DIQ support 2025-12-08 13:56:42 -05:00
kfd_packet_manager.c drm/amdkfd: Support chain runlists of XNACK+/XNACK- 2025-05-16 13:37:29 -04:00
kfd_pm4_headers_ai.h drm/amdkfd: Support chain runlists of XNACK+/XNACK- 2025-05-16 13:37:29 -04:00
kfd_pm4_headers_aldebaran.h drm/amdkfd: Enable processes isolation on gfx9 2024-08-20 22:08:07 -04:00
kfd_pm4_headers_vi.h
kfd_pm4_headers.h
kfd_pm4_opcodes.h
kfd_priv.h drm/amdgpu: unmap all user mappings of framebuffer and doorbell before mode1 reset 2026-05-19 11:45:41 -04:00
kfd_process_queue_manager.c drm/amdkfd: Properly acquire queue buffers in CRIU restore 2026-06-17 18:08:14 -04:00
kfd_process.c drm/amdkfd: Fix NULL deref during sysfs teardown 2026-06-17 18:21:27 -04:00
kfd_queue.c drm/amdkfd: Fix queue preemption/eviction failures by aligning control stack size to GPU page size 2026-03-30 15:16:39 -04:00
kfd_smi_events.c drm/amdkfd: Fix SMI event PID reporting for containers 2026-06-17 18:12:00 -04:00
kfd_smi_events.h drm/amdkfd: Fix SMI event PID reporting for containers 2026-06-17 18:12:00 -04:00
kfd_svm.c drm/amdkfd: Use exclusive bounds for SVM split alignment checks 2026-06-17 18:35:32 -04:00
kfd_svm.h drm/amdgpu: update the functions to use amdgpu version of hmm 2025-10-13 14:14:36 -04:00
kfd_topology.c drm/amdkfd: fix sysfs topology prop length on buffer truncation 2026-06-04 15:27:37 -04:00
kfd_topology.h drm/amdgpu: reduce the full gpu access time in amdgpu_device_init. 2025-12-08 13:56:38 -05:00
Makefile drm/amdkfd: Add interrupt handling for GFX 12.1.0 2025-12-08 14:13:11 -05:00
soc15_int.h drm/amdkfd: Check int source id for utcl2 poison event 2024-08-23 10:52:33 -04:00