Skip to content

Commit 7546a82

Browse files
nirmoylucasdemarchi
authored andcommitted
Revert "drm/xe/lnl: Offload system clear page activity to GPU"
This optimization relied on having to clear CCS on allocations. If there is no need to clear CCS on allocations then this would mostly help in reducing CPU utilization. Revert this patch at this moment because of: 1 Currently Xe can't do clear on free and using a invalid ttm flag, TTM_TT_FLAG_CLEARED_ON_FREE which could poison global ttm pool on multi-device setup. 2 Also for LNL CPU:WB doesn't require clearing CCS as such BO will not be allowed to bind with compression PTE. Subsequent patch will disable clearing CCS for CPU:WB BOs for LNL. This reverts commit 2368306. Cc: Christian König <[email protected]> Cc: Himal Prasad Ghimiray <[email protected]> Cc: Lucas De Marchi <[email protected]> Cc: Matthew Auld <[email protected]> Cc: Matthew Brost <[email protected]> Cc: Thomas Hellström <[email protected]> Reviewed-by: Thomas Hellström <[email protected]> Signed-off-by: Nirmoy Das <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 014125c commit 7546a82

File tree

3 files changed

+2
-38
lines changed

3 files changed

+2
-38
lines changed

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -396,14 +396,6 @@ static struct ttm_tt *xe_ttm_tt_create(struct ttm_buffer_object *ttm_bo,
396396
caching = ttm_uncached;
397397
}
398398

399-
/*
400-
* If the device can support gpu clear system pages then set proper ttm
401-
* flag. Zeroed pages are only required for ttm_bo_type_device so
402-
* unwanted data is not leaked to userspace.
403-
*/
404-
if (ttm_bo->type == ttm_bo_type_device && xe->mem.gpu_page_clear_sys)
405-
page_flags |= TTM_TT_FLAG_CLEARED_ON_FREE;
406-
407399
err = ttm_tt_init(&tt->ttm, &bo->ttm, page_flags, caching, extra_pages);
408400
if (err) {
409401
kfree(tt);
@@ -425,10 +417,6 @@ static int xe_ttm_tt_populate(struct ttm_device *ttm_dev, struct ttm_tt *tt,
425417
if (tt->page_flags & TTM_TT_FLAG_EXTERNAL)
426418
return 0;
427419

428-
/* Clear TTM_TT_FLAG_ZERO_ALLOC when GPU is set to clear system pages */
429-
if (tt->page_flags & TTM_TT_FLAG_CLEARED_ON_FREE)
430-
tt->page_flags &= ~TTM_TT_FLAG_ZERO_ALLOC;
431-
432420
err = ttm_pool_alloc(&ttm_dev->pool, tt, ctx);
433421
if (err)
434422
return err;
@@ -671,16 +659,8 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
671659
bool needs_clear;
672660
bool handle_system_ccs = (!IS_DGFX(xe) && xe_bo_needs_ccs_pages(bo) &&
673661
ttm && ttm_tt_is_populated(ttm)) ? true : false;
674-
bool clear_system_pages;
675662
int ret = 0;
676663

677-
/*
678-
* Clear TTM_TT_FLAG_CLEARED_ON_FREE on bo creation path when
679-
* moving to system as the bo doesn't have dma_mapping.
680-
*/
681-
if (!old_mem && ttm && !ttm_tt_is_populated(ttm))
682-
ttm->page_flags &= ~TTM_TT_FLAG_CLEARED_ON_FREE;
683-
684664
/* Bo creation path, moving to system or TT. */
685665
if ((!old_mem && ttm) && !handle_system_ccs) {
686666
if (new_mem->mem_type == XE_PL_TT)
@@ -703,10 +683,8 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
703683
move_lacks_source = handle_system_ccs ? (!bo->ccs_cleared) :
704684
(!mem_type_is_vram(old_mem_type) && !tt_has_data);
705685

706-
clear_system_pages = ttm && (ttm->page_flags & TTM_TT_FLAG_CLEARED_ON_FREE);
707686
needs_clear = (ttm && ttm->page_flags & TTM_TT_FLAG_ZERO_ALLOC) ||
708-
(!ttm && ttm_bo->type == ttm_bo_type_device) ||
709-
clear_system_pages;
687+
(!ttm && ttm_bo->type == ttm_bo_type_device);
710688

711689
if (new_mem->mem_type == XE_PL_TT) {
712690
ret = xe_tt_map_sg(ttm);
@@ -818,7 +796,7 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
818796
if (move_lacks_source) {
819797
u32 flags = 0;
820798

821-
if (mem_type_is_vram(new_mem->mem_type) || clear_system_pages)
799+
if (mem_type_is_vram(new_mem->mem_type))
822800
flags |= XE_MIGRATE_CLEAR_FLAG_FULL;
823801
else if (handle_system_ccs)
824802
flags |= XE_MIGRATE_CLEAR_FLAG_CCS_DATA;

drivers/gpu/drm/xe/xe_device_types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,6 @@ struct xe_device {
339339
struct xe_mem_region vram;
340340
/** @mem.sys_mgr: system TTM manager */
341341
struct ttm_resource_manager sys_mgr;
342-
/** @mem.gpu_page_clear_sys: clear system pages offloaded to GPU */
343-
bool gpu_page_clear_sys;
344342
} mem;
345343

346344
/** @sriov: device level virtualization data */

drivers/gpu/drm/xe/xe_ttm_sys_mgr.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,5 @@ int xe_ttm_sys_mgr_init(struct xe_device *xe)
117117
ttm_resource_manager_init(man, &xe->ttm, gtt_size >> PAGE_SHIFT);
118118
ttm_set_driver_manager(&xe->ttm, XE_PL_TT, man);
119119
ttm_resource_manager_set_used(man, true);
120-
121-
/*
122-
* On iGFX device with flat CCS, we clear CCS metadata, let's extend that
123-
* and use GPU to clear pages as well.
124-
*
125-
* Disable this when init_on_free and/or init_on_alloc is on to avoid double
126-
* zeroing pages with CPU and GPU.
127-
*/
128-
if (xe_device_has_flat_ccs(xe) && !IS_DGFX(xe) &&
129-
!want_init_on_alloc(GFP_USER) && !want_init_on_free())
130-
xe->mem.gpu_page_clear_sys = true;
131-
132120
return drmm_add_action_or_reset(&xe->drm, ttm_sys_mgr_fini, xe);
133121
}

0 commit comments

Comments
 (0)