drm/radeon: Override fpfn for all VRAM placements in radeon_evict_flags
Subsystems (2)
PATCH 1/1 drm/radeon: Override fpfn for all VRAM placements in radeon_evict_flags
From: Michel Dänzer <[email protected]>
We were accidentally only overriding the first VRAM placement. For BOs with the RADEON_GEM_NO_CPU_ACCESS flag set, radeon_ttm_placement_from_domain creates a second VRAM placment with fpfn == 0. If VRAM is almost full, the first VRAM placement with fpfn > 0 may not work, but the second one with fpfn == 0 always will (the BO's current location trivially satisfies it). Because "moving" the BO to its current location puts it back on the LRU list, this results in an infinite loop.
inaccessible VRAM first")
--- drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_ttm.c +2 -2
@@ -213,8 +213,8 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo, rbo->placement.num_busy_placement =0 ;for (i =0 ; i < rbo->placement.num_placement; i++) {if (rbo->placements[i].flags &TTM_PL_FLAG_VRAM ) { -if (rbo->placements[0 ].fpfn < fpfn) - rbo->placements[0 ].fpfn = fpfn; +if (rbo->placements[i].fpfn < fpfn) + rbo->placements[i].fpfn = fpfn; }else { rbo->placement.busy_placement = &rbo->placements[i];
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170327005843.2009-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Christian König
Reviewed-byAm 27.03.2017 um 02:58 schrieb Michel Dänzer:
Quoted 11 lines
From: Michel Dänzer <[email protected]>
We were accidentally only overriding the first VRAM placement. For BOs with the
RADEON_GEM_NO_CPU_ACCESSflag set,radeon_ttm_placement_from_domaincreates a second VRAM placment with fpfn == 0. If VRAM is almost full, the first VRAM placement with fpfn > 0 may not work, but the second one with fpfn == 0 always will (the BO's current location trivially satisfies it). Because "moving" the BO to its current location puts it back on the LRU list, this results in an infinite loop.
Quoted 5 lines
Fixes 2a85aedd117c ("drm/radeon: Try evicting from CPU accessible toinaccessible VRAM first")
Reported-by Zachary Michaels <[email protected]>Reported-and-Tested-by Julien Isorce <[email protected]>Signed-off-by Michel Dänzer <[email protected]>
Quoted 9 lines
--- drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/radeon/radeon_ttm.c +0
-0
drivers/gpu/drm/radeon/radeon_ttm.c static void radeon_evict_flags(struct ttm_buffer_object *bo, · line 220
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_ttm.c +2
-2@@ -213,8 +213,8 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo, rbo->placement.num_busy_placement =0 ;for (i =0 ; i < rbo->placement.num_placement; i++) {if (rbo->placements[i].flags &TTM_PL_FLAG_VRAM ) { -if (rbo->placements[0 ].fpfn < fpfn) - rbo->placements[0 ].fpfn = fpfn; +if (rbo->placements[i].fpfn < fpfn) + rbo->placements[i].fpfn = fpfn; }else { rbo->placement.busy_placement = &rbo->placements[i];
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 9485c238-d562-c363-f108-0c736af440eb-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Hi Michel,
Great ! Would you mind to just add a note to mention that the infinite loop actually happens in ttm_bo_mem_force_space ? Thx!
Cheers
Julien
Quoted 48 lines · Christian König
Am 27.03.2017 um 02:58 schrieb Michel Dänzer:
Quoted 11 lines
From: Michel Dänzer <[email protected]>
We were accidentally only overriding the first VRAM placement. For BOs with the
RADEON_GEM_NO_CPU_ACCESSflag set,radeon_ttm_placement_from_domaincreates a second VRAM placment with fpfn == 0. If VRAM is almost full, the first VRAM placement with fpfn > 0 may not work, but the second one with fpfn == 0 always will (the BO's current location trivially satisfies it). Because "moving" the BO to its current location puts it back on the LRU list, this results in an infinite loop.Quoted 6 lines
Fixes 2a85aedd117c ("drm/radeon: Try evicting from CPU accessible toinaccessible VRAM first")
Reported-by Zachary Michaels <[email protected]>Reported-and-Tested-by Julien Isorce <[email protected]>Signed-off-by Michel Dänzer <[email protected]>Reviewed-by Christian König <[email protected]>---
Quoted 25 lines
drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/radeon/radeon_ttm.c +0
-2@@ -213,8 +213,8 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo, rbo->placement.num_busy_placement =0 ;for (i =0 ; i < rbo->placement.num_placement; i++) {if (rbo->placements[i].flags &TTM_PL_FLAG_VRAM ) { -if (rbo->placements[0 ].fpfn < fpfn) - rbo->placements[0].fpfn =fpfn;
+ if (rbo->placements[i].fpfn <
fpfn)
+ rbo->placements[i].fpfn =fpfn; } else { rbo->placement.busy_placement =
Quoted 9 lines
Quoted 2 lines
&rbo->placements[i];_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): CAHWPjbXtsgnbdFw1W0JPzVUDdtvUDmp+9_UFMicwCTGOedcZLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 4 lines · Julien Isorce
Hi Michel,
Great ! Would you mind to just add a note to mention that the infinite loop actually happens in
ttm_bo_mem_force_space? Thx!
I'm afraid it might be too late, as I already pushed the fix to the amd-staging-4.9 branch. I guess Alex could still add it before he includes the fix in a pull request though.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Thanks for the help and the quick turnaround!
Quoted 43 lines · Christian König
Am 27.03.2017 um 02:58 schrieb Michel Dänzer:
Quoted 11 lines
From: Michel Dänzer <[email protected]>
We were accidentally only overriding the first VRAM placement. For BOs with the
RADEON_GEM_NO_CPU_ACCESSflag set,radeon_ttm_placement_from_domaincreates a second VRAM placment with fpfn == 0. If VRAM is almost full, the first VRAM placement with fpfn > 0 may not work, but the second one with fpfn == 0 always will (the BO's current location trivially satisfies it). Because "moving" the BO to its current location puts it back on the LRU list, this results in an infinite loop.Quoted 6 lines
Fixes 2a85aedd117c ("drm/radeon: Try evicting from CPU accessible toinaccessible VRAM first")
Reported-by Zachary Michaels <[email protected]>Reported-and-Tested-by Julien Isorce <[email protected]>Signed-off-by Michel Dänzer <[email protected]>Reviewed-by Christian König <[email protected]>---
Quoted 19 lines
drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/radeon/radeon_ttm.c +0
-2@@ -213,8 +213,8 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo, rbo->placement.num_busy_placement =0 ;for (i =0 ; i < rbo->placement.num_placement; i++) {if (rbo->placements[i].flags &TTM_PL_FLAG_VRAM ) { -if (rbo->placements[0 ].fpfn < fpfn) - rbo->placements[0].fpfn =fpfn;
Quoted 11 lines
Quoted 8 lines
+ if (rbo->placements[i].fpfn <
fpfn)
+ rbo->placements[i].fpfn =fpfn; } else { rbo->placement.busy_placement = &rbo->placements[i];
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Deucher, Alexander
Reviewed-by Alex DeucherQuoted 21 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Sunday, March 26, 2017 8:59 PM
To: [email protected]
Cc: Zachary Michaels; Julien Isorce
Subject: [PATCH] drm/radeon: Override fpfn for all VRAM placements inradeon_evict_flagsFrom: Michel Dänzer <[email protected]>
We were accidentally only overriding the first VRAM placement. For BOs with the
RADEON_GEM_NO_CPU_ACCESSflag set,radeon_ttm_placement_from_domaincreates a second VRAM placment with
fpfn == 0. If VRAM is almost full, the first VRAM placement with fpfn > 0 may not work, but the second one with fpfn == 0 always will (the BO's current location trivially satisfies it). Because "moving" the BO to its current location puts it back on the LRU list, this results in an infinite loop.
Quoted 5 lines
Fixes 2a85aedd117c ("drm/radeon: Try evicting from CPU accessible toinaccessible VRAM first")
Reported-by Zachary Michaels <[email protected]>Reported-and-Tested-by Julien Isorce <[email protected]>Signed-off-by Michel Dänzer <[email protected]>
Quoted 27 lines
--- drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/radeon/radeon_ttm.c +2
-2@@ -213,8 +213,8 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo, rbo->placement.num_busy_placement =0 ;for (i =0 ; i < rbo->placement.num_placement; i++) {if (rbo->placements[i].flags &TTM_PL_FLAG_VRAM ) { -if (rbo->placements[0 ].fpfn < fpfn) - rbo->placements[0 ].fpfn =fpfn ; +if (rbo->placements[i].fpfn < fpfn) + rbo->placements[i].fpfn =fpfn;
drivers/gpu/drm/radeon/radeon_ttm.c +0
-1}else { rbo->placement.busy_placement = &rbo->placements[i]; --2.11.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx