-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial support for powerpc64le initialization. #267
base: main
Are you sure you want to change the base?
Conversation
* Adds header definitions for PPC64le * Adds support to construct the processor, core, cluster, package and cache(L1i,L1d,L2 and L3) information reported by the system. Test: Build and ran cpu_info on PPC64le linux machine. confirmed that it properly reports the logical processors, cores, clusters, packages and cache information.
test/name/power-features.cc
Outdated
int b = (uint32_t) getauxval(AT_HWCAP2); | ||
#endif //CPUINFO_MOCK // | ||
|
||
#if (b & CPUINFO_POWERPC_LINUX_FEATURE_ARCH_3_1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain how that is supposed to work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@malfet when AT_hwcap2 supports the feature arch_3_1(Power10) then cpuinfo_initialization should set these features mma,vsx
_```
#if (b & CPUINFO_POWERPC_LINUX_FEATURE_ARCH_3_1)
EXPECT_EQ(0, cpuinfo_has_powerpc_htm());
EXPECT_EQ(1, cpuinfo_has_powerpc_mma());
EXPECT_EQ(1, cpuinfo_has_powerpc_vsx());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if
is a preprocessor directive, isn't it?
And b
is not defined when preprocessor is invoked, so all those conditions will simply never be compiled, aren't they?
So, I would like to see some sort of a thorough test plan for this PR before accepting it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. All those conditions will not be compiled, and the test case will not throw any error.
I have used if-elseif conditions to make it work, and below is the debugging screenshot that is going through the if() condition.
Since CPUINFO_MOCK is not implemented for PPC64le, I have removed the redundant code. Please go through the latest code changes and let me know your review comments.
src/linux/processors.c
Outdated
cpuinfo_log_info( | ||
"failed to parse online status for processor %" PRIu32 " from %s", processor, processor_online_filename); | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent seems wrong here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I will fix all the indent errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@malfet I have fixed indentation. could you review it
@malfet could you review the patch again |
Hi @malfet , Did you get a chance to review this patch? |
@malfet I am waiting for your review. |
@fbarchard @malfet can you review this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still confused about use of #if (b & FOOBAR)
conditions in the test
test/name/power-features.cc
Outdated
int b = (uint32_t)getauxval(AT_HWCAP2); | ||
#endif // CPUINFO_MOCK // | ||
|
||
#if (b & CPUINFO_POWERPC_LINUX_FEATURE_ARCH_3_1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain to me, when something like that would be evaluated to true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes , you are right . I have updated the code.
preprocessor code will never be compiled.
Test: