diff mbox series

[SRU,Eoan] UBUNTU: SAUCE: kselftest: ftrace: check for existing probe

Message ID 20200529221238.1065202-1-cascardo@canonical.com
State New
Headers show
Series [SRU,Eoan] UBUNTU: SAUCE: kselftest: ftrace: check for existing probe | expand

Commit Message

Thadeu Lima de Souza Cascardo May 29, 2020, 10:12 p.m. UTC
Buglink: https://bugs.launchpad.net/bugs/1866972

When testing multiple_kprobes.tc, it will try to add repeated probes. On
5.4, it will return EEXIST, and the test will keep adding probes until it
gets to 256 probes. On 5.3, it will return success, but not add a new
probe. The test will then fail expecting 256 probes, but less than that
were really added.

Fixing the test to check for those existing probes before adding them is
less prone to regressions. After that, the test will succeed, as it skips
trying to add existing probes.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc | 1 +
 1 file changed, 1 insertion(+)

Comments

Kleber Sacilotto de Souza June 5, 2020, 12:45 p.m. UTC | #1
On 2020-05-30 00:12, Thadeu Lima de Souza Cascardo wrote:
> Buglink: https://bugs.launchpad.net/bugs/1866972
> 
> When testing multiple_kprobes.tc, it will try to add repeated probes. On
> 5.4, it will return EEXIST, and the test will keep adding probes until it
> gets to 256 probes. On 5.3, it will return success, but not add a new
> probe. The test will then fail expecting 256 probes, but less than that
> were really added.
> 
> Fixing the test to check for those existing probes before adding them is
> less prone to regressions. After that, the test will succeed, as it skips
> trying to add existing probes.
> 
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

> ---
>  tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
> index 6e3dbe5f96b7..4b860bfc64be 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
> @@ -16,6 +16,7 @@ N=0
>  echo "Setup up kprobes on first available 256 text symbols"
>  grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
>  while read i; do
> +  grep -qw ${i} kprobe_events && continue
>    echo p ${i}+${OFFS} >> kprobe_events && N=$((N+1)) ||:
>    test $N -eq 256 && break
>  done
>
Kelsey Skunberg June 5, 2020, 4:14 p.m. UTC | #2
Acked-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>

On 2020-05-29 19:12:38 , Thadeu Lima de Souza Cascardo wrote:
> Buglink: https://bugs.launchpad.net/bugs/1866972
> 
> When testing multiple_kprobes.tc, it will try to add repeated probes. On
> 5.4, it will return EEXIST, and the test will keep adding probes until it
> gets to 256 probes. On 5.3, it will return success, but not add a new
> probe. The test will then fail expecting 256 probes, but less than that
> were really added.
> 
> Fixing the test to check for those existing probes before adding them is
> less prone to regressions. After that, the test will succeed, as it skips
> trying to add existing probes.
> 
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
> ---
>  tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
> index 6e3dbe5f96b7..4b860bfc64be 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
> @@ -16,6 +16,7 @@ N=0
>  echo "Setup up kprobes on first available 256 text symbols"
>  grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
>  while read i; do
> +  grep -qw ${i} kprobe_events && continue
>    echo p ${i}+${OFFS} >> kprobe_events && N=$((N+1)) ||:
>    test $N -eq 256 && break
>  done
> -- 
> 2.25.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Kelsey Skunberg June 8, 2020, 4:12 p.m. UTC | #3
Applied to Eoan/master-next. Thank you!

-Kelsey

On 2020-05-29 19:12:38 , Thadeu Lima de Souza Cascardo wrote:
> Buglink: https://bugs.launchpad.net/bugs/1866972
> 
> When testing multiple_kprobes.tc, it will try to add repeated probes. On
> 5.4, it will return EEXIST, and the test will keep adding probes until it
> gets to 256 probes. On 5.3, it will return success, but not add a new
> probe. The test will then fail expecting 256 probes, but less than that
> were really added.
> 
> Fixing the test to check for those existing probes before adding them is
> less prone to regressions. After that, the test will succeed, as it skips
> trying to add existing probes.
> 
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
> ---
>  tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
> index 6e3dbe5f96b7..4b860bfc64be 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
> @@ -16,6 +16,7 @@ N=0
>  echo "Setup up kprobes on first available 256 text symbols"
>  grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
>  while read i; do
> +  grep -qw ${i} kprobe_events && continue
>    echo p ${i}+${OFFS} >> kprobe_events && N=$((N+1)) ||:
>    test $N -eq 256 && break
>  done
> -- 
> 2.25.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
index 6e3dbe5f96b7..4b860bfc64be 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc
@@ -16,6 +16,7 @@  N=0
 echo "Setup up kprobes on first available 256 text symbols"
 grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
 while read i; do
+  grep -qw ${i} kprobe_events && continue
   echo p ${i}+${OFFS} >> kprobe_events && N=$((N+1)) ||:
   test $N -eq 256 && break
 done