* [PATCH] drm/amdgpu: Extend the bad page check to page range
@ 2025-08-22 6:18 Xiang Liu
0 siblings, 0 replies; only message in thread
From: Xiang Liu @ 2025-08-22 6:18 UTC (permalink / raw)
To: amd-gfx; +Cc: Hawking.Zhang, Tao.Zhou1, Stanley.Yang, YiPeng.Chai, Xiang Liu
The page range should be checked for the critical region.
Signed-off-by: Xiang Liu <xiang.liu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index c9df026e53f7..db7fd21b2c04 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -406,15 +406,18 @@ int amdgpu_vram_mgr_query_address_block_info(struct amdgpu_vram_mgr *mgr,
{
struct amdgpu_vram_mgr_resource *vres;
struct drm_buddy_block *block;
- u64 start, size;
+ u64 start, size, addr_begin, addr_end;
int ret = -ENOENT;
+ addr_begin = address & PAGE_MASK;
+ addr_end = address | (PAGE_SIZE - 1);
+
mutex_lock(&mgr->lock);
list_for_each_entry(vres, &mgr->allocated_vres_list, vres_node) {
list_for_each_entry(block, &vres->blocks, link) {
start = amdgpu_vram_mgr_block_start(block);
size = amdgpu_vram_mgr_block_size(block);
- if ((start <= address) && (address < (start + size))) {
+ if ((start <= addr_begin) && (addr_end < (start + size))) {
info->start = start;
info->size = size;
memcpy(&info->task, &vres->task, sizeof(vres->task));
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-22 6:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22 6:18 [PATCH] drm/amdgpu: Extend the bad page check to page range Xiang Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).