答复: [PATCH 1/1] amdgpu: va allocation may fall to the range outside of requested [min,max]
Wang, Qingqing
Qingqing.Wang at amd.com
Wed Jun 29 06:09:24 UTC 2016
Please ignore this email, the patch was accidentally sent twice.
________________________________
发件人: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> 代表 Wang, Qingqing <Qingqing.Wang at amd.com>
发送时间: 2016年6月29日 12:26:02
收件人: amd-gfx at lists.freedesktop.org
主题: [PATCH 1/1] amdgpu: va allocation may fall to the range outside of requested [min,max]
Change-Id: I55e90ae63dd653463817df351050370fc7e896ca
Signed-off-by: David Mao <david.mao at amd.com>
---
amdgpu/amdgpu_vamgr.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/amdgpu/amdgpu_vamgr.c b/amdgpu/amdgpu_vamgr.c
index 82653e9..23be1ff 100644
--- a/amdgpu/amdgpu_vamgr.c
+++ b/amdgpu/amdgpu_vamgr.c
@@ -192,10 +192,14 @@ static uint64_t amdgpu_vamgr_find_va_in_range(struct amdgpu_bo_va_mgr *mgr, uint
(hole->offset < range_min && range_min + size > hole->offset + hole->size) ||
hole->size < size)
continue;
- offset = hole->offset;
+ // it is possible that the hole covers more than one range,
+ // thus we need to respect the range_min
+ offset = MAX2(hole->offset, range_min);
waste = offset % alignment;
waste = waste ? alignment - waste : 0;
offset += waste;
+ // the gap between the range_min and hole->offset need to be covered as well
+ waste += offset - hole->offset;
if (offset >= (hole->offset + hole->size)) {
continue;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20160629/74ca5798/attachment.html>
More information about the amd-gfx
mailing list