xe_bo_migrate(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… xe_bo_migrate(9) β€” from the Kernel API Manual, bestie

okay so picture this: you've got a buffer object and it's living in the wrong neighborhood, and you need it to move. That's literally the whole plot of xe_bo_migrate. It's giving relocation era. Let's get into it πŸ¦‹


✨ SYNOPSIS ✨

int xe_bo_migrate (struct xe_bo *bo , u32 mem_type , struct
       ttm_operation_ctx *tctx , struct drm_exec *exec );

πŸŽ€ ARGUMENTS πŸŽ€

  • bo β€” the buffer object we're migrating. the main character, fr.
  • mem_type β€” the TTM region type we're sending it to. the destination, the new vibe.
  • tctx β€” a pointer to a struct ttm_operation_ctx, or NULL if you want the default interruptible ctx to be used instead. your call, no pressure 🫢
  • exec β€” the drm_exec transaction to use for exhaustive eviction. yes ma'am, that one.

πŸ’– DESCRIPTION πŸ’–

So the whole mission here is: attempt to migrate the buffer object to the desired memory region. That's it, that's the goal, slay.

But there are rules, bestie, and you gotta respect them:

  • The buffer object may not be pinned. not even a little.
  • It must be locked.
⚠️ read those two again. they're not suggestions, they're the vibe check, and if you fail it you're not passing go.

On successful completion, the object's memory type will be updated β€” but 😭 an async migration task may not have completed yet. And to accomplish that (i.e. to actually get it done), the object's kernel fences must be signaled with the object lock held. so hold that lock. hold it. don't let go early, that's the whole thing.


πŸ”₯ RETURN πŸ”₯

  • 0 on success. periodt. πŸ‘‘
  • A negative error code on failure.
  • In particular, it may return -EINTR or -ERESTARTSYS if a signal is pending. not me getting interrupted mid-migration πŸ’€

🌈 SEE ALSO 🌈

Kernel file ./drivers/gpu/drm/xe/xe_bo.c, plus the whole xe_bo extended universe:

xe_bo_has_single_placement(9), xe_bo_is_stolen_devmem(9), xe_bo_is_vm_bound(9), xe_bo_pin_account(9), xe_bo_unpin_account(9), xe_bo_is_visible_vram(9), xe_bo_move_notify(9), xe_bo_set_purgeable_shrinker(9), xe_bo_set_purgeable_state(9), xe_ttm_bo_purge(9), xe_bo_shrink(9), xe_bo_notifier_prepare_pinned(9), xe_bo_notifier_unprepare_pinned(9), xe_bo_evict_pinned(9), xe_bo_restore_pinned(9), xe_bo_read(9), xe_bo_alloc(9), xe_bo_free(9), xe_bo_init_locked(9), xe_bo_create_locked(9), xe_bo_create_user(9), xe_bo_create_pin_range_novm(9), xe_bo_create_pin_map_at_novm(9), xe_bo_create_pin_map(9), xe_bo_create_pin_map_novm(9), xe_managed_bo_reinit_in_vram(9), xe_bo_pin_external(9), xe_bo_pin(9), xe_bo_unpin_external(9), xe_bo_validate(9), xe_bo_decompress(9), xe_bo_lock(9), xe_bo_unlock(9), xe_bo_can_migrate(9), xe_bo_evict(9), xe_bo_needs_ccs_pages(9), __xe_bo_release_dummy(9), xe_bo_put_commit(9), xe_bo_dev_init(9), xe_bo_dev_fini(9), xe_bo_dumb_create(9)

iykyk πŸ’œ that's a lot of friends.


okay that's the page!! this little angel lives over in ./drivers/gpu/drm/xe and it's dated October 2026 β€” go read the real source, it ate and left no crumbs πŸŒΈπŸ’«

πŸ“¦ where this page comes from