Re: [PATCH] drm/ttm: Don't evict BOs outside of the requested placement range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alex,

Please pull these patches through Radeon,

Thanks,
Thomas


On 10/13/2014 08:22 PM, Alex Deucher wrote:
> On Thu, Oct 9, 2014 at 2:02 AM, Michel Dänzer <michel@xxxxxxxxxxx> wrote:
>> From: Michel Dänzer <michel.daenzer@xxxxxxx>
>>
>> The radeon driver uses placement range restrictions for several reasons,
>> in particular to make sure BOs in VRAM can be accessed by the CPU, e.g.
>> during a page fault.
>>
>> Without this change, TTM could evict other BOs while trying to satisfy
>> the requested placement, even if the evicted BOs were outside of the
>> requested placement range. Doing so didn't free up any space in the
>> requested placement range, so the (potentially high) eviction cost was
>> incurred for no benefit.
>>
>> Nominating for stable because radeon driver changes in 3.17 made this
>> much more noticeable than before.
>>
>> Bugzilla: https://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D84662&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=l5Ago9ekmVFZ3c4M6eauqrJWGwjf6fTb%2BP3CxbBFkVM%3D%0A&m=fUnmlW1Tlnje4oNF3duZPPLcUcRvxyQZ%2BA%2Fyl5YOGBc%3D%0A&s=53d70e00aa98306fc71f222fe9aa14b3ff9cf30dab9a060633a2341526cb09cb
>> Cc: stable@xxxxxxxxxxxxxxx
>> Signed-off-by: Michel Dänzer <michel.daenzer@xxxxxxx>
> Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>
>
> Thomas, do you want to pull this through the ttm tree or can I take it
> through radeon?
>
> Alex
>
>> ---
>>  drivers/gpu/drm/ttm/ttm_bo.c | 20 +++++++++++++++++---
>>  1 file changed, 17 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
>> index 8f5cec6..407fa2d 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>> @@ -709,6 +709,7 @@ out:
>>
>>  static int ttm_mem_evict_first(struct ttm_bo_device *bdev,
>>                                 uint32_t mem_type,
>> +                               const struct ttm_place *place,
>>                                 bool interruptible,
>>                                 bool no_wait_gpu)
>>  {
>> @@ -720,8 +721,21 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev,
>>         spin_lock(&glob->lru_lock);
>>         list_for_each_entry(bo, &man->lru, lru) {
>>                 ret = __ttm_bo_reserve(bo, false, true, false, NULL);
>> -               if (!ret)
>> +               if (!ret) {
>> +                       if (place && (place->fpfn || place->lpfn)) {
>> +                               /* Don't evict this BO if it's outside of the
>> +                                * requested placement range
>> +                                */
>> +                               if (place->fpfn >= (bo->mem.start + bo->mem.size) ||
>> +                                   (place->lpfn && place->lpfn <= bo->mem.start)) {
>> +                                       __ttm_bo_unreserve(bo);
>> +                                       ret = -EBUSY;
>> +                                       continue;
>> +                               }
>> +                       }
>> +
>>                         break;
>> +               }
>>         }
>>
>>         if (ret) {
>> @@ -782,7 +796,7 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
>>                         return ret;
>>                 if (mem->mm_node)
>>                         break;
>> -               ret = ttm_mem_evict_first(bdev, mem_type,
>> +               ret = ttm_mem_evict_first(bdev, mem_type, place,
>>                                           interruptible, no_wait_gpu);
>>                 if (unlikely(ret != 0))
>>                         return ret;
>> @@ -1233,7 +1247,7 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
>>         spin_lock(&glob->lru_lock);
>>         while (!list_empty(&man->lru)) {
>>                 spin_unlock(&glob->lru_lock);
>> -               ret = ttm_mem_evict_first(bdev, mem_type, false, false);
>> +               ret = ttm_mem_evict_first(bdev, mem_type, NULL, false, false);
>>                 if (ret) {
>>                         if (allow_errors) {
>>                                 return ret;
>> --
>> 2.1.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@xxxxxxxxxxxxxxxxxxxxx
>> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/dri-devel&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=l5Ago9ekmVFZ3c4M6eauqrJWGwjf6fTb%2BP3CxbBFkVM%3D%0A&m=fUnmlW1Tlnje4oNF3duZPPLcUcRvxyQZ%2BA%2Fyl5YOGBc%3D%0A&s=3c28f2dc220442e12a62cd069fd203cefbe4b157be43987cebd908d2084e32e9

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux