From: Thomas Hellström Date: Thu, 11 Sep 2025 08:03:24 +0000 (+0200) Subject: drm/xe: Work around clang multiple goto-label error X-Git-Tag: v6.18-rc1~134^2~4^2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=187e16f69de2ba30779b97ba8852b583fd7f5fad;p=thirdparty%2Flinux.git drm/xe: Work around clang multiple goto-label error When using drm_exec_retry_on_contention(), clang may consider all labels for which we take addresses in a function as potential retry goto targets, although strictly only one is possible. It will then in some situations generate false positive errors. In this case, the compiler, for some architectures, consider the might_lock(&m->job_mutex); as a potential goto target from drm_exec_retry_on_contention(), and errors. Work around that by moving the xe_validate / drm_exec transaction to a separate function. v2: - New commit message based on analysis of Nathan Chancellor Fixes: 59eabff2a352 ("drm/xe: Convert xe_bo_create_pin_map() for exhaustive eviction") Cc: Matthew Brost Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202509101853.nDmyxTEM-lkp@intel.com/ Signed-off-by: Thomas Hellström Reviewed-by: Lucas De Marchi Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor # build Link: https://lore.kernel.org/r/20250911080324.180307-1-thomas.hellstrom@linux.intel.com --- diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c index 6fad5d4696293..1d667fa36cf3f 100644 --- a/drivers/gpu/drm/xe/xe_migrate.c +++ b/drivers/gpu/drm/xe/xe_migrate.c @@ -394,6 +394,24 @@ struct xe_migrate *xe_migrate_alloc(struct xe_tile *tile) return m; } +static int xe_migrate_lock_prepare_vm(struct xe_tile *tile, struct xe_migrate *m, struct xe_vm *vm) +{ + struct xe_device *xe = tile_to_xe(tile); + struct xe_validation_ctx ctx; + struct drm_exec exec; + int err = 0; + + xe_validation_guard(&ctx, &xe->val, &exec, (struct xe_val_flags) {}, err) { + err = xe_vm_drm_exec_lock(vm, &exec); + drm_exec_retry_on_contention(&exec); + err = xe_migrate_prepare_vm(tile, m, vm, &exec); + drm_exec_retry_on_contention(&exec); + xe_validation_retry_on_oom(&ctx, &err); + } + + return err; +} + /** * xe_migrate_init() - Initialize a migrate context * @m: The migration context @@ -405,8 +423,6 @@ int xe_migrate_init(struct xe_migrate *m) struct xe_tile *tile = m->tile; struct xe_gt *primary_gt = tile->primary_gt; struct xe_device *xe = tile_to_xe(tile); - struct xe_validation_ctx ctx; - struct drm_exec exec; struct xe_vm *vm; int err; @@ -416,14 +432,7 @@ int xe_migrate_init(struct xe_migrate *m) if (IS_ERR(vm)) return PTR_ERR(vm); - err = 0; - xe_validation_guard(&ctx, &xe->val, &exec, (struct xe_val_flags) {}, err) { - err = xe_vm_drm_exec_lock(vm, &exec); - drm_exec_retry_on_contention(&exec); - err = xe_migrate_prepare_vm(tile, m, vm, &exec); - drm_exec_retry_on_contention(&exec); - xe_validation_retry_on_oom(&ctx, &err); - } + err = xe_migrate_lock_prepare_vm(tile, m, vm); if (err) return err;