From 2510895443429b0627301bf3ebd0cd8243a79550 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Mon, 22 Nov 2021 12:08:47 -0800 Subject: [PATCH 1/3] check-kmod-load-unload: add new TOPDIR constant TOPDIR can be re-used to find other test files. Signed-off-by: Marc Herbert --- test-case/check-kmod-load-unload.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test-case/check-kmod-load-unload.sh b/test-case/check-kmod-load-unload.sh index a2377646..1909cda7 100755 --- a/test-case/check-kmod-load-unload.sh +++ b/test-case/check-kmod-load-unload.sh @@ -22,8 +22,11 @@ set -e ## check kernel log and find no errors ## +TOPDIR="$(dirname "${BASH_SOURCE[0]}")"/.. +TOPDIR=$(cd "$TOPDIR" && pwd) + # shellcheck source=case-lib/lib.sh -source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh +source "${TOPDIR}"/case-lib/lib.sh OPT_NAME['l']='loop_cnt' OPT_DESC['l']='remove / insert module loop count -- per device' From 09442f4edf2fa070c0753f0c4c9159258da2b523 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Mon, 22 Nov 2021 12:09:59 -0800 Subject: [PATCH 2/3] check-kmod-load-unload: use TOPDIR, don't rely on PATH This was apparently the only test in run-all-tests.sh that required a PATH change. Signed-off-by: Marc Herbert --- test-case/check-kmod-load-unload.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-case/check-kmod-load-unload.sh b/test-case/check-kmod-load-unload.sh index 1909cda7..60a9aae4 100755 --- a/test-case/check-kmod-load-unload.sh +++ b/test-case/check-kmod-load-unload.sh @@ -74,7 +74,7 @@ do done dlogi "run kmod/sof-kmod-remove.sh" - sudo sof_remove.sh || die "remove modules error" + "$TOPDIR"/tools/kmod/sof_remove.sh || die "remove modules error" ## - 1a: check for errors after removal dlogi "checking for general errors after kmod unload with sof-kernel-log-check tool" @@ -83,7 +83,7 @@ do setup_kernel_check_point dlogi "run kmod/sof_insert.sh" - sudo sof_insert.sh || die "insert modules error" + "$TOPDIR"/tools/kmod/sof_insert.sh || die "insert modules error" ## - 2a: check for errors after insertion dlogi "checking for general errors after kmod insert with sof-kernel-log-check tool" From 3037e38ec7b1e1dd72f3ecd83a87c25edf2d1aeb Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Mon, 22 Nov 2021 21:15:04 -0800 Subject: [PATCH 3/3] kmod/sof_insert: add comment explaining how pam_unix slows sudo This is the place where this "sudo performance" issue is the most visible Signed-off-by: Marc Herbert --- tools/kmod/sof_insert.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/kmod/sof_insert.sh b/tools/kmod/sof_insert.sh index 95529a3a..2bf95c4e 100755 --- a/tools/kmod/sof_insert.sh +++ b/tools/kmod/sof_insert.sh @@ -10,6 +10,9 @@ insert_module() { printf 'MODPROBE\t%s\t\t' "$MODULE" printf '%s ' "$@" printf '\n' + # If sudo is slow, it's probably because the 'account' service + # of the pam_unix.so module. Its version 1.5.1-7.fc34 tries to + # close() all file descriptors from 65535 to 0. sudo modprobe "$MODULE" "$@" else printf 'SKIP \t%s \t(not in tree)\n' "$MODULE"