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>