Repository navigation
Conversation
The kernel lists the CPUCFG feature as "cpucfg" in /proc/cpuinfo (arch/loongarch/kernel/proc.c since v5.19). The table looked for "cfg", which HasWord() never matches, so CPUCFG was always false. The two LoongArch tests use real cpuinfo dumps that contain "cpucfg" but asserted false; expect true.
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.
The Linux kernel lists the CPUCFG feature as
cpucfgin theFeaturesline of/proc/cpuinfo(arch/loongarch/kernel/proc.c; the token has beencpucfgsince v5.19). The LoongArch introspection table looked forcfg.HasWord()only matches whole words, so the flag was never found.GetLoongArchInfo()reads only/proc/cpuinfo, soCPUCFGwas always reported as false.This PR changes the flag string to
cpucfg. It is the same kind of fix as #464 (smelutv1->smelutv2on aarch64).The two existing LoongArch tests use real
/proc/cpuinfodumps whoseFeatureslines containcpucfg, but they assertedEXPECT_FALSE(info.features.CPUCFG). This PR changes those assertions toEXPECT_TRUE. With the old string, both tests now fail withValue of: info.features.CPUCFG Actual: false Expected: true; with the fix, both pass.Testing: there is no LoongArch CI job, so I built
test/cpuinfo_loongarch_test.ccagainst the fake filesystem on a non-LoongArch host. I defined__loongarch64/__linux__for the LoongArch implementation file, since the parser is plain C and does not depend on the ISA. Results: 2/2 tests fail before the change and 2/2 pass after it. The regular test suite still passes, andclang-format --style=file --dry-run --Werroris clean on both files.This change was drafted with Claude Code (claude-opus-5-5); the test results above are from the runs described.