Skip to content

feature(sysman): report page offline state from drm-ras - #1071

Draft
rodrigovivi wants to merge 3 commits into
intel:masterfrom
rodrigovivi:drm-ras-retired-pages
Draft

rodrigovivi wants to merge 3 commits into
intel:masterfrom
rodrigovivi:drm-ras-retired-pages

Conversation

@rodrigovivi

Copy link
Copy Markdown

Make the Level Zero sysman page offline API report the pages the kernel retired through the new drm-ras retired-pages netlink node. The API is unchanged: zesIntelDeviceMemoryGetPageOfflineStateExp and the maxOfflinePages property keep their signatures and semantics.

  • build: sync drm_ras.h with the kernel series (to be replaced by the regular drm-next sync once it lands)
  • DrmNlApi: add the get-retired-pages dump and the get-retired-pages-info request. Also end a transaction on NLMSG_DONE, since a dump with no pages carries no reply message.
  • global operations: use the retired-pages node of the device when there is one, and fall back to the vram_bad_pages sysfs file otherwise. Retired maps to offline; pending and failed map to pending offline. Addresses are in bytes, while the sysfs file gives page frame numbers.

The node isn't tied to CRI, so this works for any device whose driver registers it.

Kernel series (drm-ras retired-pages node type, xe user):

IGT test and tool: https://lore.kernel.org/igt-dev/20261127181133.801215-10-rodrigo.vivi@intel.com/T/#t

Testing:

  • Unit tests: ze_intel_gpu_sysman_tests pass on all 16 products, with new tests for the netlink requests and the global operations path.
  • On a BMG B580 (kernel v7 plus a page offline simulation), zello_sysman -g reports the same pages and max pages as the drm-ras IGT tool and debugfs. Without root it returns ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS, and the iGPU without a node still reports unsupported.

🤖 Generated with Claude Code

Take drm_ras.h from make headers_install of the drm-ras retired-pages
series, which adds the telemetry and retired-pages node types and their
commands:
https://github.com/rodrigovivi/linux/commits/xe-ras-retired-pages-v7

This should be replaced by the regular drm-next sync once the series
lands.

Assisted-by: LLM
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Add the get-retired-pages dump and the get-retired-pages-info request of
the drm-ras retired-pages node to DrmNlApi.

A dump of a node with no retired pages only carries NLMSG_DONE, so also
end the transaction on NL_CB_FINISH, instead of waiting for a reply that
never comes.

Assisted-by: LLM
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Report the offline and pending offline pages, and the maximum number of
offline pages, from the drm-ras retired-pages node of the device, when
the kernel exposes one. This works for any device whose driver
registers the node, and gives the page address in bytes, where the
vram_bad_pages file gives a page frame number.

Fall back to the vram_bad_pages sysfs file when there is no such node.

Assisted-by: LLM
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
std::vector<MemPageInfo> pageList;
ze_result_t result = NetlinkRetiredPages::getPages(pLinuxSysmanImp->getDevicePciBdf(), pageList);
if (result == ZE_RESULT_ERROR_UNSUPPORTED_FEATURE) {
return pSysmanProductHelper->memoryGetPageOfflineStateExp(pSysfsAccess, pageStatus, pCount, memPageInfoList, pPageOfflineInfo);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the sysfs node for the bad pages still be available alongwith the netlink interface ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No! This drm-ras is a replacement.

*/
enum drm_ras_node_type {
DRM_RAS_NODE_TYPE_ERROR_COUNTER = 1,
DRM_RAS_NODE_TYPE_TELEMETRY,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this type used for ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It comes with the header sync. Telemetry nodes were added upstream in c95c93b6e26c ("drm/drm_ras: Extend DRM RAS interface to include telemetry nodes"), for the qaic accelerator. Sysman doesn't use them; they're in the header because it's a copy of the kernel uAPI.

ze_result_t NetlinkRetiredPages::getPages(const std::string &devicePciBdf, std::vector<MemPageInfo> &pageList) {
auto pDrmNl = createDrmNlApi();
std::vector<uint32_t> nodeIds;
ze_result_t result = getRetiredPagesNodes(pDrmNl.get(), devicePciBdf, nodeIds);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this return multiple nodeIds for each device ? If no, then the subsequent for loop may not be required.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the uAPI allows it: a driver can register one retired-pages node per memory that retires pages, for example VRAM and system memory. xe registers only vram-retired-pages today, so the loop runs once, but it keeps sysman correct if a second node shows up. For the max pages, the nodes are added up.

ze_result_t NetlinkRetiredPages::getMaxPages(const std::string &devicePciBdf, uint32_t *pMaxPages) {
auto pDrmNl = createDrmNlApi();
std::vector<uint32_t> nodeIds;
ze_result_t result = getRetiredPagesNodes(pDrmNl.get(), devicePciBdf, nodeIds);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, same as above.

@pratikbariintel pratikbariintel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants