]> Gentwo Git Trees - linux/.git/commit
drm/xe/gt_throttle: Avoid TOCTOU when monitoring reasons
authorLucas De Marchi <lucas.demarchi@intel.com>
Tue, 4 Nov 2025 22:20:51 +0000 (14:20 -0800)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 5 Nov 2025 16:52:13 +0000 (08:52 -0800)
commit83ccde67a3f73326e89dde66c0c775c932a30570
treef451433d444c0fb0d5f32742042ebbcbcb6139c9
parent424e2cce078255c1ccaf7d30ec1508ea5d1b89b1
drm/xe/gt_throttle: Avoid TOCTOU when monitoring reasons

It's currently not possible to safely monitor if there's throttling
happening and what are the reasons. The approach of reading the status
and then reading the reasons is not reliable as by the time sysadmin
reads the reason, the throttling could not be happening anymore.

Previous tentative to fix that[1] was breaking the ABI and potentially
sysadmin's scripts. This takes a different approach of adding and
documenting the additional attribute. It's still valuable, though
redundant, to provide the simpler 0/1 interface.

In order to avoid userspace knowledge on the bitmask meaning and to be
able to maintain the kernel side in sync with possible changes in
future, just walk the attribute group and check what are the masks that
match the value read.

[1] https://lore.kernel.org/intel-xe/20241025092238.167042-1-raag.jadav@intel.com/

Cc: Raag Jadav <raag.jadav@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Raag Jadav <raag.jadav@intel.com>
Link: https://patch.msgid.link/20251104-gt-throttle-cri-v5-1-4948b060bbfd@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/xe_gt_throttle.c