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

Enhanced Timer Handling and Testing for One Shot Timer #2562

Open
wants to merge 2 commits into
base: criu-dev
Choose a base branch
from

Conversation

hckuo
Copy link

@hckuo hckuo commented Jan 8, 2025

This pull request introduces improvements to timer handling and testing:

  1. Timer Handling Updates

    • Modified the itimer_armed macro in restorer.c to properly consider the it_value field.
    • Simplified the decode_itimer function in timer.c to utilize the provided it_value.
    • Removed conditional logic that previously set it_value to interval, ensuring more accurate timer behavior.
  2. ZDTM Test Enhancements

    • Refactored setup_timers() function to accept a timer configuration parameter, allowing for more flexible testing scenarios.
    • Introduced a one-shot timer configuration in addition to the existing periodic timer.
    • Expanded the test suite to run twice, each time with a different timer configuration, providing more comprehensive coverage.

@hckuo hckuo changed the title Fix one shot itimer Enhanced Timer Handling and Testing for One Shot Timer Jan 8, 2025
hckuo added 2 commits January 9, 2025 20:47
- Modify itimer_armed macro in restorer.c to consider it_value
- Simplify decode_itimer function in timer.c to use provided it_value
- Remove conditional logic that set it_value to interval

Signed-off-by: Austin Kuo <[email protected]>
This commit improves the timers test in ZDTM (Zero Downtime Migration) by introducing multiple timer configurations. The changes include:

- Refactoring setup_timers() to accept a timer configuration parameter.
- Adding a one-shot timer configuration alongside the existing periodic timer.
- Running the test twice with different timer configurations.

Signed-off-by: Austin Kuo <[email protected]>
@hckuo hckuo force-pushed the fix-one-shot-itimer branch from d5ca42b to c20a4cf Compare January 10, 2025 04:47
@avagin
Copy link
Member

avagin commented Jan 11, 2025

The test passes without the fix:

$ git log HEAD~3... --pretty=oneline
36bf4a056f3c153baf2b130cac6df8f62835e3b4 (HEAD) Revert "Update timer handling to properly respect the it_value field"
c20a4cfa3a403558dd702942cf02b51b36c01f30 test: zdtm: Enhance timers test with multiple timer configurations
3249a8308806ba9e5a0dc0501268c5b40833d721 Update timer handling to properly respect the it_value field
$ make -j 4
$ python test/zdtm.py run -t zdtm/static/timers --ignore-taint -f h
userns is supported
The kernel is tainted: '12352'
=== Run 1/1 ================ zdtm/static/timers
========================= Run zdtm/static/timers in h ==========================
Start test
./timers --pidfile=timers.pid --outfile=timers.out
Run criu dump
Run criu restore
Send the 15 signal to  52
Wait for zdtm/static/timers(52) to die for 0.100000
Wait for zdtm/static/timers(52) to die for 0.200000
Wait for zdtm/static/timers(52) to die for 0.400000
Wait for zdtm/static/timers(52) to die for 0.800000
Wait for zdtm/static/timers(52) to die for 1.600000
Removing dump/zdtm/static/timers/52
========================= Test zdtm/static/timers PASS =========================

I think the intention was to introduce the regression test, wasn't it?

@hckuo
Copy link
Author

hckuo commented Jan 13, 2025 via email

@hckuo
Copy link
Author

hckuo commented Jan 13, 2025

ubuntu@ip-172-31-13-102:~/criu$ git log HEAD~3... --pretty=oneline
41298c8888a4eb11578c5fa372647982f9412a9b (HEAD -> fix-one-shot-itimer) Revert "Update timer handling to properly respect the it_value field"
c20a4cfa3a403558dd702942cf02b51b36c01f30 (origin/fix-one-shot-itimer) test: zdtm: Enhance timers test with multiple timer configurations
3249a8308806ba9e5a0dc0501268c5b40833d721 Update timer handling to properly respect the it_value field
ubuntu@ip-172-31-13-102:~/criu$ git diff
diff --git a/test/zdtm/static/timers.c b/test/zdtm/static/timers.c
index 5a919f2b5..95004f384 100644
--- a/test/zdtm/static/timers.c
+++ b/test/zdtm/static/timers.c
@@ -87,7 +87,7 @@ int main(int argc, char **argv)
        };
 
        test_init(argc, argv);
-       for (int i = 0; i < 2; i++) {
+       for (int i = 1; i < 2; i++) {
                setup_timers(&tvs[i]);
 
                test_daemon();
ubuntu@ip-172-31-13-102:~/criu$ sudo python3 test/zdtm.py run -t zdtm/static/timers --ignore-taint -f h
userns is supported
=== Run 1/1 ================ zdtm/static/timers
========================= Run zdtm/static/timers in h ==========================
 DEP       timers.d
 CC        timers.o
 DEP       parseargs.d
 CC        parseargs.o
 AR        libzdtmtst.a
 LINK      groups
 LINK      timers
Start test
./timers --pidfile=timers.pid --outfile=timers.out
Run criu dump
Run criu restore
Send the 15 signal to  116
Wait for zdtm/static/timers(116) to die for 0.100000
Wait for zdtm/static/timers(116) to die for 0.200000
Wait for zdtm/static/timers(116) to die for 0.400000
Wait for zdtm/static/timers(116) to die for 0.800000
Wait for zdtm/static/timers(116) to die for 1.600000
Wait for zdtm/static/timers(116) to die for 3.200000
Wait for zdtm/static/timers(116) to die for 6.400000
==== ALARM ====
################# Test zdtm/static/timers FAIL at result check #################
Test output: ================================
22:21:52.061:   116: FAIL: timers.c:68: timer 0 stuck (errno = 11 (Resource temporarily unavailable))

 <<< ================================
##################################### FAIL #####################################

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