Commit 1c024d45 authored by Alan Maguire's avatar Alan Maguire Committed by Shuah Khan

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: default avatarKnut Omang <knut.omang@oracle.com>
Signed-off-by: default avatarKnut Omang <knut.omang@oracle.com>
Signed-off-by: default avatarAlan Maguire <alan.maguire@oracle.com>
Reviewed-by: default avatarStephen Boyd <sboyd@kernel.org>
Acked-by: default avatarBrendan Higgins <brendanhiggins@google.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent c475c77d
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/sched/sysctl.h>
#include "try-catch-impl.h" #include "try-catch-impl.h"
...@@ -33,8 +32,6 @@ static int kunit_generic_run_threadfn_adapter(void *data) ...@@ -33,8 +32,6 @@ static int kunit_generic_run_threadfn_adapter(void *data)
static unsigned long kunit_test_timeout(void) static unsigned long kunit_test_timeout(void)
{ {
unsigned long timeout_msecs;
/* /*
* TODO(brendanhiggins@google.com): We should probably have some type of * TODO(brendanhiggins@google.com): We should probably have some type of
* variable timeout here. The only question is what that timeout value * variable timeout here. The only question is what that timeout value
...@@ -51,22 +48,11 @@ static unsigned long kunit_test_timeout(void) ...@@ -51,22 +48,11 @@ static unsigned long kunit_test_timeout(void)
* *
* For more background on this topic, see: * For more background on this topic, see:
* https://mike-bland.com/2011/11/01/small-medium-large.html * https://mike-bland.com/2011/11/01/small-medium-large.html
*
* If tests timeout due to exceeding sysctl_hung_task_timeout_secs,
* the task will be killed and an oops generated.
*/ */
if (sysctl_hung_task_timeout_secs) { return 300 * MSEC_PER_SEC; /* 5 min */
/*
* If sysctl_hung_task is active, just set the timeout to some
* value less than that.
*
* In regards to the above TODO, if we decide on variable
* timeouts, this logic will likely need to change.
*/
timeout_msecs = (sysctl_hung_task_timeout_secs - 1) *
MSEC_PER_SEC;
} else {
timeout_msecs = 300 * MSEC_PER_SEC; /* 5 min */
}
return timeout_msecs;
} }
void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context) void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment