Skip to content

Commit 1c024d4

Browse files
alan-maguireshuahkh
authored andcommitted
kunit: remove timeout dependence on sysctl_hung_task_timeout_seconds
In discussion of how to handle timeouts, it was noted that if sysctl_hung_task_timeout_seconds is exceeded for a kunit test, the test task will be killed and an oops generated. This should suffice as a means of debugging such timeout issues for now. Hence remove use of sysctl_hung_task_timeout_secs, which has the added benefit of avoiding the need to export that symbol from the core kernel. Co-developed-by: Knut Omang <[email protected]> Signed-off-by: Knut Omang <[email protected]> Signed-off-by: Alan Maguire <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Acked-by: Brendan Higgins <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent c475c77 commit 1c024d4

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

lib/kunit/try-catch.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <linux/completion.h>
1212
#include <linux/kernel.h>
1313
#include <linux/kthread.h>
14-
#include <linux/sched/sysctl.h>
1514

1615
#include "try-catch-impl.h"
1716

@@ -33,8 +32,6 @@ static int kunit_generic_run_threadfn_adapter(void *data)
3332

3433
static unsigned long kunit_test_timeout(void)
3534
{
36-
unsigned long timeout_msecs;
37-
3835
/*
3936
* TODO([email protected]): We should probably have some type of
4037
* variable timeout here. The only question is what that timeout value
@@ -51,22 +48,11 @@ static unsigned long kunit_test_timeout(void)
5148
*
5249
* For more background on this topic, see:
5350
* https://mike-bland.com/2011/11/01/small-medium-large.html
51+
*
52+
* If tests timeout due to exceeding sysctl_hung_task_timeout_secs,
53+
* the task will be killed and an oops generated.
5454
*/
55-
if (sysctl_hung_task_timeout_secs) {
56-
/*
57-
* If sysctl_hung_task is active, just set the timeout to some
58-
* value less than that.
59-
*
60-
* In regards to the above TODO, if we decide on variable
61-
* timeouts, this logic will likely need to change.
62-
*/
63-
timeout_msecs = (sysctl_hung_task_timeout_secs - 1) *
64-
MSEC_PER_SEC;
65-
} else {
66-
timeout_msecs = 300 * MSEC_PER_SEC; /* 5 min */
67-
}
68-
69-
return timeout_msecs;
55+
return 300 * MSEC_PER_SEC; /* 5 min */
7056
}
7157

7258
void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context)

0 commit comments

Comments
 (0)