-
Notifications
You must be signed in to change notification settings - Fork 615
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
base: criu-dev
Are you sure you want to change the base?
Conversation
- 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 <hsuanchikuo@gmail.com>
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 <hsuanchikuo@gmail.com>
d5ca42b
to
c20a4cf
Compare
The test passes without the fix:
I think the intention was to introduce the regression test, wasn't it? |
I think it has something to do with how the test is setup. If I only test
the ones hot timers it would fail as expected. I can duplicate the test
file so one for regular timers and one for one shot timers. However this
is something that I want to avoid to not have duplicate code. Please
instruct on a better way if any. Or I can just duplicate the test file and
make it two tests.
…On Fri, Jan 10, 2025 at 18:32 Andrei Vagin ***@***.***> wrote:
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"
c20a4cf test: zdtm: Enhance timers test with multiple timer configurations
3249a83 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?
—
Reply to this email directly, view it on GitHub
<#2562 (comment)>,
or unsubscribe
</~https://github.com/notifications/unsubscribe-auth/AZADMJQ6IGNARJYKK5QBZHD2KB7FPAVCNFSM6AAAAABU25D5QGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOBVGAZDANBUGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
@@ -29,17 +29,8 @@ static inline int decode_itimer(char *n, ItimerEntry *ie, struct itimerval *val) | |||
return -1; | |||
} | |||
|
|||
if (ie->vsec == 0 && ie->vusec == 0) { |
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.
This code handles the case when the timer is armed, but it_value is set to 0:
https://man7.org/linux/man-pages/man2/setitimer.2.html
If both fields of it_value are zero, then this timer is currently disarmed (inactive).
@@ -2210,7 +2210,7 @@ __visible long __export_restore_task(struct task_restore_args *args) | |||
* code below doesn't fail due to bad timing values. | |||
*/ | |||
|
|||
#define itimer_armed(args, i) (args->itimers[i].it_interval.tv_sec || args->itimers[i].it_interval.tv_usec) | |||
#define itimer_armed(args, i) (args->itimers[i].it_interval.tv_sec || args->itimers[i].it_interval.tv_usec || args->itimers[i].it_value.tv_sec || args->itimers[i].it_value.tv_usec) |
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.
nit: The limit on the length of lines is 80 columns and this is a strongly preferred limit.
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.
actually, you need to check just it_value.tv_sec and it_value.tv_usec:
#define itimer_armed(args, i) (args->itimers[i].it_value.tv_sec || args->itimers[i].it_value.tv_usec)
If this two fields are zero, setitimer disarms the timer.
test_daemon(); | ||
test_waitsig(); | ||
test_daemon(); | ||
test_waitsig(); |
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.
It will not work. test_waitsig does its job when it is called first time. If you call it second time, it returns immediately:
Line 365 in 27a5b9a
futex_wait_while(&sig_received, 0); |
I suggest to add a new test. Here is my version of it: avagin@c02e313
It fails without the your fix and it passes with it:
# ./test/zdtm.py run -t zdtm/static/timers01 --ignore-taint
userns is supported
The kernel is tainted: '12352'
=== Run 1/1 ================ zdtm/static/timers01
======================= Run zdtm/static/timers01 in uns ========================
Start test
./timers01 --pidfile=timers01.pid --outfile=timers01.out
Run criu dump
Run criu restore
=[log]=> dump/zdtm/static/timers01/64/1/restore.log
------------------------ grep Error ------------------------
b'(00.009848) 1: No ipcns-sem-11.img image'
b'(00.018559) 1: net: Try to restore a link 10:1:lo'
b'(00.018566) 1: net: Restoring link lo type 1'
b'(00.021284) 1: net: \tRunning ip addr restore'
b'Error: ipv4: Address already assigned.'
b'Error: ipv6: address already assigned.'
------------------------ ERROR OVER ------------------------
Send the 15 signal to 92
Wait for zdtm/static/timers01(92) to die for 0.100000
################ Test zdtm/static/timers01 FAIL at result check ################
Test output: ================================
17:44:11.873: 4: FAIL: timers01.c:54: 0 isn't in [3600, 3300] (errno = 11 (Resource temporarily unavailable))
<<< ================================
##################################### FAIL #####################################
This pull request introduces improvements to timer handling and testing:
Timer Handling Updates
ZDTM Test Enhancements