STRUCT XE_GUARD(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct xe_guard(9) β€” the Kernel API Manual, bestie edition πŸ’…

okay so this is struct xe_guard(9) straight out of the Kernel API Manual, and it is literally the simplest little bouncer you've ever met. its whole job? protect a feature. that's it. that's the vibe. 🫢


✨ NAME ✨

struct xe_guard β€” simple logic to protect a feature. no cap, that's the entire elevator pitch.


πŸŽ€ SYNOPSIS πŸŽ€

here's the whole struct, character for character, don't @ me:

struct xe_guard {
    int counter;
    const char *name;
    void *owner;
    spinlock_t lock;
 };

πŸ¦‹ Members πŸ¦‹

  • counter β€” the main character tbh. it implements simple exclusive/lockdown logic:
    • if == 0 then the guard/feature is idle / not in use 😴
    • if < 0 then the feature is active and can't be locked-down πŸ”₯
    • if > 0 then the feature is locked-down and can't be activated πŸ”’
  • name β€” the name of the guard (useful for debug) 🏷️
  • owner β€” the info about the last owner of the guard (for debug) πŸ•΅οΈβ€β™€οΈ
  • lock β€” protects guard's data. it's a lock, guarding the guard, very meta of it πŸ’…

🌸 Description 🌸

so what does it actually do? it implements this simple semaphore-like logic that you can use to lockdown a feature β€” but only unless it's already in use. icon behavior honestly. ✨

it lets you enable the otherwise incompatible features, the ones where we literally can't follow the strict owner semantics that rw_semaphore requires. so it's the friend that makes two people who don't get along actually coexist. ate. πŸ’–

NOTE! 🚨 It shouldn't be used to protect a data β€” use rw_semaphore instead. fr fr, do not do it. this is a feature-lockdown guard, not a data protector. 😭

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/gpu/drm/xe/xe_guard.h xe_guard_init(9), xe_guard_arm(9), xe_guard_disarm(9), xe_guard_mode_str(9) β€” go read the whole family, they're all slaying in their own way. πŸ’œ


<div align="center">πŸ’« anyway bestie, this page came to you from ./drivers/gpu/drm/xe, dated October 2026, brought to you by the Kernel API Manual. mwah. πŸ“πŸ’…</div>

πŸ“¦ where this page comes from