Repository navigation
NPU: share the /proc/meminfo reporting helper - #556
Merged
Merged
Conversation
Move the QCOM, Rockchip and Intel system memory parsing into a common gpuinfo_refresh_system_memory() helper. Besides removing three copies, this fixes a 32-bit overflow in QCOM and Rockchip: MemTotal and MemAvailable are in kB and were stored in an unsigned long before being multiplied by 1024, which overflows above 4 GB. The shared helper parses them as unsigned long long and clamps MemAvailable to MemTotal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #526.
The QCOM, Rockchip and Intel NPU backends each had their own copy of the
/proc/meminfoparser. Move it into a sharedgpuinfo_refresh_system_memory()helper.Besides removing the duplication, this fixes a 32-bit overflow in QCOM and Rockchip:
MemTotalandMemAvailableare in kB and were stored in anunsigned longbefore being multiplied by 1024, which overflows above 4 GB on 32-bit systems. The shared helper parses them asunsigned long longand clampsMemAvailabletoMemTotal.Tested:
/sys/class/acceltree; values match/proc/meminfo.extract_npuinfo_qualcomm.cagainst the current libqcnpuperf headers (libqcnpuperf is not installed here).Not tested on NPU hardware.