Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <matthew.brost@intel.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202509101853.nDmyxTEM-lkp@intel.com/
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org> # build
Link: https://lore.kernel.org/r/20250911080324.180307-1-thomas.hellstrom@linux.intel.com

+19 -10
+19 -10
drivers/gpu/drm/xe/xe_migrate.c
··· 394 394 return m; 395 395 } 396 396 397 + static int xe_migrate_lock_prepare_vm(struct xe_tile *tile, struct xe_migrate *m, struct xe_vm *vm) 398 + { 399 + struct xe_device *xe = tile_to_xe(tile); 400 + struct xe_validation_ctx ctx; 401 + struct drm_exec exec; 402 + int err = 0; 403 + 404 + xe_validation_guard(&ctx, &xe->val, &exec, (struct xe_val_flags) {}, err) { 405 + err = xe_vm_drm_exec_lock(vm, &exec); 406 + drm_exec_retry_on_contention(&exec); 407 + err = xe_migrate_prepare_vm(tile, m, vm, &exec); 408 + drm_exec_retry_on_contention(&exec); 409 + xe_validation_retry_on_oom(&ctx, &err); 410 + } 411 + 412 + return err; 413 + } 414 + 397 415 /** 398 416 * xe_migrate_init() - Initialize a migrate context 399 417 * @m: The migration context ··· 423 405 struct xe_tile *tile = m->tile; 424 406 struct xe_gt *primary_gt = tile->primary_gt; 425 407 struct xe_device *xe = tile_to_xe(tile); 426 - struct xe_validation_ctx ctx; 427 - struct drm_exec exec; 428 408 struct xe_vm *vm; 429 409 int err; 430 410 ··· 432 416 if (IS_ERR(vm)) 433 417 return PTR_ERR(vm); 434 418 435 - err = 0; 436 - xe_validation_guard(&ctx, &xe->val, &exec, (struct xe_val_flags) {}, err) { 437 - err = xe_vm_drm_exec_lock(vm, &exec); 438 - drm_exec_retry_on_contention(&exec); 439 - err = xe_migrate_prepare_vm(tile, m, vm, &exec); 440 - drm_exec_retry_on_contention(&exec); 441 - xe_validation_retry_on_oom(&ctx, &err); 442 - } 419 + err = xe_migrate_lock_prepare_vm(tile, m, vm); 443 420 if (err) 444 421 return err; 445 422