<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/gpu/drm/amd/amdkfd, branch master</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>drm/amdgpu: Fix fault cleaner race condition</title>
<updated>2026-11-18T06:48:33+00:00</updated>
<author>
<name>Kent Russell</name>
<email>kent.russell@amd.com</email>
</author>
<published>2026-11-03T17:21:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=47fecd054adb4ab920faaee7156c632e29971491'/>
<id>47fecd054adb4ab920faaee7156c632e29971491</id>
<content type='text'>
clean_process_queues_cpsch would exit early if the memory was evicted,
which would skip running the shader cleaner

Run the cleaner unconditionally, and track whether the fault was cleaned
with a new boolean in the qcd struct.

Fixes: 923d09ab1f9a ("drm/amdkfd: Fix TCP XNACK scoreboard reset race on MI300")
Signed-off-by: Kent Russell &lt;kent.russell@amd.com&gt;
Reviewed-by: Jay Cornwall &lt;jay.cornwall@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 24672863a9b9f073ca6fb1508e0a44c7958bf597)
Cc: stable@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
clean_process_queues_cpsch would exit early if the memory was evicted,
which would skip running the shader cleaner

Run the cleaner unconditionally, and track whether the fault was cleaned
with a new boolean in the qcd struct.

Fixes: 923d09ab1f9a ("drm/amdkfd: Fix TCP XNACK scoreboard reset race on MI300")
Signed-off-by: Kent Russell &lt;kent.russell@amd.com&gt;
Reviewed-by: Jay Cornwall &lt;jay.cornwall@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 24672863a9b9f073ca6fb1508e0a44c7958bf597)
Cc: stable@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdkfd: keep the DMA addresses of a range intact if splitting fails</title>
<updated>2026-11-18T06:47:36+00:00</updated>
<author>
<name>Jesse Zhang</name>
<email>Jesse.Zhang@amd.com</email>
</author>
<published>2026-11-03T15:54:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=63b42ad2fdd371ae4a86658295943d60a86a519b'/>
<id>63b42ad2fdd371ae4a86658295943d60a86a519b</id>
<content type='text'>
svm_range_split_pages() splits the DMA address array of one GPU after
the other, and each split replaces the old range's array by a shorter
one. If a later GPU's array can't be allocated, the old range is left
with the arrays of the earlier GPUs already shortened, but with its old
size. Unmapping it then walks past their end.

On navi31 with its iGPU, an SVM range accessible by both GPUs, and
unmapping a page in its middle with allocations failing in turn through
failslab:

  BUG: KASAN: slab-out-of-bounds in svm_range_dma_unmap_dev+0x13f/0x170 [amdgpu]
  Read of size 8 at addr ffff88819ac32800 by task kworker/8:1/171
   svm_range_dma_unmap_dev+0x13f/0x170 [amdgpu]
   svm_range_dma_unmap+0x119/0x2c0 [amdgpu]
   svm_range_free+0x312/0x520 [amdgpu]
   svm_range_handle_list_op+0x326/0x500 [amdgpu]
   svm_range_deferred_list_work+0x338/0x790 [amdgpu]
  Allocated by task 2749:
   svm_range_copy_array.constprop.0+0x55/0x190 [amdgpu]
   svm_range_split+0x388/0x17b0 [amdgpu]
   svm_range_unmap_split+0x254/0x370 [amdgpu]
   svm_range_cpu_invalidate_pagetables+0xb29/0x11d0 [amdgpu]
  The buggy address is located 0 bytes to the right of
   allocated 2048-byte region [ffff88819ac32000, ffff88819ac32800)

Split the arrays of all GPUs first and only replace the old ones once
all succeeded. With that the 2759 unmaps of the same sweep give no
report.

Fixes: f80fe9d3c114 ("drm/amdkfd: map svm range to GPUs")
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Jesse Zhang &lt;Jesse.Zhang@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 3cbd0b498ac18821ec01c08e39050a4d22ea9eeb)
Cc: stable@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
svm_range_split_pages() splits the DMA address array of one GPU after
the other, and each split replaces the old range's array by a shorter
one. If a later GPU's array can't be allocated, the old range is left
with the arrays of the earlier GPUs already shortened, but with its old
size. Unmapping it then walks past their end.

On navi31 with its iGPU, an SVM range accessible by both GPUs, and
unmapping a page in its middle with allocations failing in turn through
failslab:

  BUG: KASAN: slab-out-of-bounds in svm_range_dma_unmap_dev+0x13f/0x170 [amdgpu]
  Read of size 8 at addr ffff88819ac32800 by task kworker/8:1/171
   svm_range_dma_unmap_dev+0x13f/0x170 [amdgpu]
   svm_range_dma_unmap+0x119/0x2c0 [amdgpu]
   svm_range_free+0x312/0x520 [amdgpu]
   svm_range_handle_list_op+0x326/0x500 [amdgpu]
   svm_range_deferred_list_work+0x338/0x790 [amdgpu]
  Allocated by task 2749:
   svm_range_copy_array.constprop.0+0x55/0x190 [amdgpu]
   svm_range_split+0x388/0x17b0 [amdgpu]
   svm_range_unmap_split+0x254/0x370 [amdgpu]
   svm_range_cpu_invalidate_pagetables+0xb29/0x11d0 [amdgpu]
  The buggy address is located 0 bytes to the right of
   allocated 2048-byte region [ffff88819ac32000, ffff88819ac32800)

Split the arrays of all GPUs first and only replace the old ones once
all succeeded. With that the 2759 unmaps of the same sweep give no
report.

Fixes: f80fe9d3c114 ("drm/amdkfd: map svm range to GPUs")
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Jesse Zhang &lt;Jesse.Zhang@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 3cbd0b498ac18821ec01c08e39050a4d22ea9eeb)
Cc: stable@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdkfd: don't check the HMM range when getting its pages failed</title>
<updated>2026-11-18T06:47:10+00:00</updated>
<author>
<name>Jesse Zhang</name>
<email>Jesse.Zhang@amd.com</email>
</author>
<published>2026-11-03T12:12:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=264b67a79010cd3ffa85603d85e594867a45a01d'/>
<id>264b67a79010cd3ffa85603d85e594867a45a01d</id>
<content type='text'>
When allocating the PFN array fails, amdgpu_hmm_range_get_pages()
returns -ENOMEM before setting the notifier of the range, but
svm_range_validate_and_map() still checks the range, as it is not NULL,
before looking at the error. On navi48, setting SVM attributes with
failslab:

  KASAN: null-ptr-deref in range [0x0000000000000050-0x0000000000000057]
  RIP: 0010:amdgpu_hmm_range_valid+0x66/0xa0 [amdgpu]
   svm_range_validate_and_map+0xaef/0x4e40 [amdgpu]
   svm_range_set_attr+0x193e/0x4610 [amdgpu]
   kfd_ioctl_svm+0x137/0x320 [amdgpu]

Check the error first; it is only 0 when the pages were taken.

Fixes: c0de552910bb ("drm/amdkfd: clean up the code to free hmm_range")
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Jesse Zhang &lt;Jesse.Zhang@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit c7036242655cb2c6d14a0d04138536e1ddb5e42c)
Cc: stable@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When allocating the PFN array fails, amdgpu_hmm_range_get_pages()
returns -ENOMEM before setting the notifier of the range, but
svm_range_validate_and_map() still checks the range, as it is not NULL,
before looking at the error. On navi48, setting SVM attributes with
failslab:

  KASAN: null-ptr-deref in range [0x0000000000000050-0x0000000000000057]
  RIP: 0010:amdgpu_hmm_range_valid+0x66/0xa0 [amdgpu]
   svm_range_validate_and_map+0xaef/0x4e40 [amdgpu]
   svm_range_set_attr+0x193e/0x4610 [amdgpu]
   kfd_ioctl_svm+0x137/0x320 [amdgpu]

Check the error first; it is only 0 when the pages were taken.

Fixes: c0de552910bb ("drm/amdkfd: clean up the code to free hmm_range")
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Jesse Zhang &lt;Jesse.Zhang@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit c7036242655cb2c6d14a0d04138536e1ddb5e42c)
Cc: stable@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdkfd: wait for the queue quiesce in concurrent SVM evictions</title>
<updated>2026-11-18T06:44:06+00:00</updated>
<author>
<name>Qiang Han</name>
<email>qiangh@amd.com</email>
</author>
<published>2026-11-08T06:07:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8c417209754a9d2cd8dc1e78c0dfadefd0ad0e82'/>
<id>8c417209754a9d2cd8dc1e78c0dfadefd0ad0e82</id>
<content type='text'>
With XNACK off, svm_range_evict() leaves the GPU page tables in place
and relies on the process's queues being stopped before the MMU
notifier returns.

Only the first eviction (evicted_ranges == 1) calls
kgd2kfd_quiesce_mm(). The quiesce preempts every GPU the process has
opened and takes milliseconds. Any other range invalidated in the
meantime sees evicted_ranges &gt; 1 and returns at once. The core mm then
frees, migrates or reuses the page while the queues still run, and an
in-flight SDMA or blit copy accesses it through the old GPU PTE. The
result is silent corruption of the copy, or of whatever process now
owns the page.

Hold a new svms-&gt;evict_lock across the first evictor's quiesce, so that
concurrent evictions return only after the queues have stopped. This is
the scheme amdgpu_amdkfd_evict_userptr() uses with
process_info-&gt;notifier_lock. evict_lock nests inside prange-&gt;lock and
is taken nowhere else. Under it, the quiesce path takes the dqm lock,
which is already used in MMU notifiers (memalloc_noreclaim).

One way to reach this: a pageable hipMemcpy() larger than 1 MiB. ROCclr
pins the buffer with hsa_amd_memory_lock(), libhsakmt registers it as
a KFD SVM range, and host memory pressure (reclaim, compaction,
allocator purge) invalidates the range.

Fixes: 8a7c184a16d7 ("drm/amdkfd: svm range eviction and restore")
Signed-off-by: Qiang Han &lt;qiangh@amd.com&gt;
Signed-off-by: Philip Yang &lt;Philip.Yang@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit d443bd2512c04a5d34c4473ce9ce2f2a6f7bf8f5)
Cc: stable@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With XNACK off, svm_range_evict() leaves the GPU page tables in place
and relies on the process's queues being stopped before the MMU
notifier returns.

Only the first eviction (evicted_ranges == 1) calls
kgd2kfd_quiesce_mm(). The quiesce preempts every GPU the process has
opened and takes milliseconds. Any other range invalidated in the
meantime sees evicted_ranges &gt; 1 and returns at once. The core mm then
frees, migrates or reuses the page while the queues still run, and an
in-flight SDMA or blit copy accesses it through the old GPU PTE. The
result is silent corruption of the copy, or of whatever process now
owns the page.

Hold a new svms-&gt;evict_lock across the first evictor's quiesce, so that
concurrent evictions return only after the queues have stopped. This is
the scheme amdgpu_amdkfd_evict_userptr() uses with
process_info-&gt;notifier_lock. evict_lock nests inside prange-&gt;lock and
is taken nowhere else. Under it, the quiesce path takes the dqm lock,
which is already used in MMU notifiers (memalloc_noreclaim).

One way to reach this: a pageable hipMemcpy() larger than 1 MiB. ROCclr
pins the buffer with hsa_amd_memory_lock(), libhsakmt registers it as
a KFD SVM range, and host memory pressure (reclaim, compaction,
allocator purge) invalidates the range.

Fixes: 8a7c184a16d7 ("drm/amdkfd: svm range eviction and restore")
Signed-off-by: Qiang Han &lt;qiangh@amd.com&gt;
Signed-off-by: Philip Yang &lt;Philip.Yang@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit d443bd2512c04a5d34c4473ce9ce2f2a6f7bf8f5)
Cc: stable@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdkfd: check CRIU SVM priv data bounds before allocating</title>
<updated>2026-11-11T20:56:58+00:00</updated>
<author>
<name>Perry Yuan</name>
<email>perry.yuan@amd.com</email>
</author>
<published>2026-11-06T03:11:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=732239b002678d8c534503f52a16afc310095523'/>
<id>732239b002678d8c534503f52a16afc310095523</id>
<content type='text'>
kfd_criu_restore_svm() allocated the per-range metadata before checking
that the range fits in the user supplied private data buffer, so an out
of range offset cost a pointless kzalloc()/kfree() round trip. Do the
bounds check first and return -EINVAL directly.

v2:
- split the original patch into two, one change per patch (Yifan)

Signed-off-by: Perry Yuan &lt;perry.yuan@amd.com&gt;
Reviewed-by: Yifan Zhang &lt;yifan1.zhang@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 0c3caec1161e458092364cb448e5bd165a26dcdb)
Cc: stable@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
kfd_criu_restore_svm() allocated the per-range metadata before checking
that the range fits in the user supplied private data buffer, so an out
of range offset cost a pointless kzalloc()/kfree() round trip. Do the
bounds check first and return -EINVAL directly.

v2:
- split the original patch into two, one change per patch (Yifan)

Signed-off-by: Perry Yuan &lt;perry.yuan@amd.com&gt;
Reviewed-by: Yifan Zhang &lt;yifan1.zhang@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 0c3caec1161e458092364cb448e5bd165a26dcdb)
Cc: stable@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdkfd: skip GPUs without a VM when checkpointing the BO mappings</title>
<updated>2026-11-11T20:56:57+00:00</updated>
<author>
<name>Jesse Zhang</name>
<email>Jesse.Zhang@amd.com</email>
</author>
<published>2026-11-04T04:18:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1a5ca15b558bf0e6621602c84e0a633d237dd052'/>
<id>1a5ca15b558bf0e6621602c84e0a633d237dd052</id>
<content type='text'>
criu_checkpoint_bos() asks every device of the process whether a BO is
mapped there, passing its drm_priv, which is NULL for the devices the
process never acquired a VM on. On navi48 with its iGPU, checkpointing a
process which acquired the VM of the dGPU only:

  Oops: general protection fault, probably for non-canonical address 0xdffffc000000002f: 0000 [#1] SMP KASAN NOPTI
  KASAN: null-ptr-deref in range [0x0000000000000178-0x000000000000017f]
  RIP: 0010:amdgpu_amdkfd_bo_mapped_to_dev+0x35/0x160 [amdgpu]
   kfd_ioctl_criu+0x30d1/0x4aa0 [amdgpu]
   kfd_ioctl+0x767/0xb10 [amdgpu]

Nothing can be mapped on such a device, skip it.

Fixes: f9e292cbba21 ("drm/amdkfd: kfd_bo_mapped_dev support partition")
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Jesse Zhang &lt;Jesse.Zhang@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 794381c358d344d8fcf8b9e6426aa2bac0a7d1f7)
Cc: stable@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
criu_checkpoint_bos() asks every device of the process whether a BO is
mapped there, passing its drm_priv, which is NULL for the devices the
process never acquired a VM on. On navi48 with its iGPU, checkpointing a
process which acquired the VM of the dGPU only:

  Oops: general protection fault, probably for non-canonical address 0xdffffc000000002f: 0000 [#1] SMP KASAN NOPTI
  KASAN: null-ptr-deref in range [0x0000000000000178-0x000000000000017f]
  RIP: 0010:amdgpu_amdkfd_bo_mapped_to_dev+0x35/0x160 [amdgpu]
   kfd_ioctl_criu+0x30d1/0x4aa0 [amdgpu]
   kfd_ioctl+0x767/0xb10 [amdgpu]

Nothing can be mapped on such a device, skip it.

Fixes: f9e292cbba21 ("drm/amdkfd: kfd_bo_mapped_dev support partition")
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Jesse Zhang &lt;Jesse.Zhang@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 794381c358d344d8fcf8b9e6426aa2bac0a7d1f7)
Cc: stable@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdkfd: Acquire cwsr buffer during CRIU resume</title>
<updated>2026-11-11T20:56:57+00:00</updated>
<author>
<name>David Francis</name>
<email>David.Francis@amd.com</email>
</author>
<published>2026-11-04T15:25:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=86aa8332ab2b2296cda98cde189e2ec539c4e1b3'/>
<id>86aa8332ab2b2296cda98cde189e2ec539c4e1b3</id>
<content type='text'>
In normal kfd queue create, a reference to the cwsr svm range
is acquired so that this buffer is not freed from underneath the
queue. We weren't doing that.

After svm ranges are restored in RESUME phase of CRIU, go through
all the queues and acquire a reference to the cwsr.

Signed-off-by: David Francis &lt;David.Francis@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 5a00bdd267a5d87307f9aaddabf550f2410c9d40)
Cc: stable@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In normal kfd queue create, a reference to the cwsr svm range
is acquired so that this buffer is not freed from underneath the
queue. We weren't doing that.

After svm ranges are restored in RESUME phase of CRIU, go through
all the queues and acquire a reference to the cwsr.

Signed-off-by: David Francis &lt;David.Francis@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 5a00bdd267a5d87307f9aaddabf550f2410c9d40)
Cc: stable@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdkfd: Acquire buffers in CRIU queue restore (again)</title>
<updated>2026-11-11T20:56:57+00:00</updated>
<author>
<name>David Francis</name>
<email>David.Francis@amd.com</email>
</author>
<published>2026-09-21T14:25:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=37820a7c716636b6ea499cc73875617886f4377f'/>
<id>37820a7c716636b6ea499cc73875617886f4377f</id>
<content type='text'>
CRIU queue restore doesn't acquire the bo buffers in the same way
normal queue creation does. In normal queue creation, the driver
gets an additional reference on the queue's underlying buffers
that lasts until the queue is destroyed; this prevents the
queue's buffers from being removed from underneath it.

Acquire them, but don't get the svm bo. SVM isn't yet fully
restored by this point in CRIU and so there's no svm range to get.
This will be addressed in the next patch.

v2: Don't use checkpoint ctl_stack_size
v5: Also avoid cwsr in criu failure path

Signed-off-by: David Francis &lt;David.Francis@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 56ca6fb5b148eb045aef34c4e05f1f56864611d5)
Cc: stable@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
CRIU queue restore doesn't acquire the bo buffers in the same way
normal queue creation does. In normal queue creation, the driver
gets an additional reference on the queue's underlying buffers
that lasts until the queue is destroyed; this prevents the
queue's buffers from being removed from underneath it.

Acquire them, but don't get the svm bo. SVM isn't yet fully
restored by this point in CRIU and so there's no svm range to get.
This will be addressed in the next patch.

v2: Don't use checkpoint ctl_stack_size
v5: Also avoid cwsr in criu failure path

Signed-off-by: David Francis &lt;David.Francis@amd.com&gt;
Reviewed-by: Felix Kuehling &lt;felix.kuehling@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 56ca6fb5b148eb045aef34c4e05f1f56864611d5)
Cc: stable@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/amdkfd: Don't reuse a VRAM page that is still referenced</title>
<updated>2026-11-11T20:53:55+00:00</updated>
<author>
<name>Apurv Mishra</name>
<email>Apurv.Mishra@amd.com</email>
</author>
<published>2026-10-20T00:18:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8cd5429d429eced2441173b3306f7e137a4dc31f'/>
<id>8cd5429d429eced2441173b3306f7e137a4dc31f</id>
<content type='text'>
In svm_migrate_copy_to_vram(), skip VRAM pages with a non-zero refcount
and leave those pages in system memory for this migration.

When an svm_bo is reused, a VRAM page can still be held by an in-flight
CPU fault (do_swap_page -&gt; svm_migrate_to_ram). Migrating to VRAM then
re-initializes the page via zone_device_page_init(), resetting its
refcount. The fault's late put_page() frees the page mid-migration, so
migrate_vma_finalize() never restores that PTE. It is left pointing at a
freed system page and hmm_range_fault() hits BUG_ON in
pfn_swap_entry_to_page() (swapops.h).

Signed-off-by: Apurv Mishra &lt;Apurv.Mishra@amd.com&gt;
Reviewed-by: Philip Yang &lt;Philip.Yang@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 1f19aa7acacbce35584dd8f75a30880096fda6a4)
Cc: stable@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In svm_migrate_copy_to_vram(), skip VRAM pages with a non-zero refcount
and leave those pages in system memory for this migration.

When an svm_bo is reused, a VRAM page can still be held by an in-flight
CPU fault (do_swap_page -&gt; svm_migrate_to_ram). Migrating to VRAM then
re-initializes the page via zone_device_page_init(), resetting its
refcount. The fault's late put_page() frees the page mid-migration, so
migrate_vma_finalize() never restores that PTE. It is left pointing at a
freed system page and hmm_range_fault() hits BUG_ON in
pfn_swap_entry_to_page() (swapops.h).

Signed-off-by: Apurv Mishra &lt;Apurv.Mishra@amd.com&gt;
Reviewed-by: Philip Yang &lt;Philip.Yang@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 1f19aa7acacbce35584dd8f75a30880096fda6a4)
Cc: stable@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'devm_kmalloc_obj-v7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux</title>
<updated>2026-11-08T22:55:54+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-11-08T22:55:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e0d8e8de8bcb1ef7b749033b5af5518ba8df7bec'/>
<id>e0d8e8de8bcb1ef7b749033b5af5518ba8df7bec</id>
<content type='text'>
Pull devm_kmalloc_obj conversion from Kees Cook:

 - treewide refresh of kmalloc_obj() conversions

 - devm_kmalloc_obj conversion rules added to Coccinelle scripting

 - treewide conversion of devm_kmalloc() family to devm_kmalloc_obj()

* tag 'devm_kmalloc_obj-v7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family
  coccinelle: kmalloc_obj: Include devm_kmalloc_obj conversion rules
  treewide: refresh kmalloc_obj() conversions
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull devm_kmalloc_obj conversion from Kees Cook:

 - treewide refresh of kmalloc_obj() conversions

 - devm_kmalloc_obj conversion rules added to Coccinelle scripting

 - treewide conversion of devm_kmalloc() family to devm_kmalloc_obj()

* tag 'devm_kmalloc_obj-v7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family
  coccinelle: kmalloc_obj: Include devm_kmalloc_obj conversion rules
  treewide: refresh kmalloc_obj() conversions
</pre>
</div>
</content>
</entry>
</feed>
