Skip to content
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 split lock #140

Merged
merged 3 commits into from
Nov 30, 2023
Merged

Add split lock #140

merged 3 commits into from
Nov 30, 2023

Conversation

xinzhanz
Copy link
Contributor

A split lock is any atomic operation whose operand crosses two cache lines.
Add split test including test application, test items and the document.

free(line);
fclose(fp);
if (!ret) {
printf("Fail: no split_lock_detect in /proc/cpuinfo\n");
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi Tony,
How do you think changing his message to this:
"[ERR] no split_lock_detect in /proc/cpuinfo"
"split_lock_dect [FAIL]"

Split this message into two lines: one for the detailed information and the other for the result.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will modify it with split_lock_dect [FAIL]

ret = 0;
pclose(fp);

printf("split lock detection:%d\n", ret);
Copy link
Contributor

Choose a reason for hiding this comment

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

split_lock_dect [PASS]
split_lock_dect [FAIL]

1, I believe signal catching is necessary to determine whether this test has passed or not.
2 From my perspective, it's insufficient to rely on reading "split lock detection" in dmesg to confirm the success of this test, as it could have been previously dumped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will move dmesg check to the test script. When the default of split_lock_detect is on or it is set as warn, #AC will be triggered and output to dmesg. But if it is set as fatal, kernel will send SIGBUS on user-space, no #AC message is output.

{
printf("Caught SIGBUS/#AC due to split locked access\n");

exit(-1);
Copy link
Contributor

Choose a reason for hiding this comment

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

confirm the exit code -1 or 0 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

catch_sigbus is a void function, it is to handle user space SIGBUS which is sent by kernel. For test purpose, print out a message is enough. To mark it is abnormal, use non zero is OK, whatever it is 1 or -1.

@xinzhanz xinzhanz force-pushed the add_split_lock branch 2 times, most recently from 635e74e to 93b809b Compare November 30, 2023 07:48
Tony Zhu added 3 commits November 30, 2023 16:05
This test app will use "lock addl" instruction to trigger #AC in hardware
and kernel.

Signed-off-by: Tony Zhu <[email protected]>
This test includes two test items, the first one will check cpuinfo,
the second one will call split lock test to trigger an execption.

Signed-off-by: Tony Zhu <[email protected]>
This document introduces what is split lock and how to test it in user
mode.

Signed-off-by: Tony Zhu <[email protected]>
@ysun ysun merged commit 2336cb8 into intel:main Nov 30, 2023
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