Patch "perf test bpf: Skip test if clang is not present" has been added to the 5.17-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf test bpf: Skip test if clang is not present

to the 5.17-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-test-bpf-skip-test-if-clang-is-not-present.patch
and it can be found in the queue-5.17 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4edaac11d7cc4bb9243e80bb13c7ff50eb7e1c2c
Author: Athira Rajeev <atrajeev@xxxxxxxxxxxxxxxxxx>
Date:   Wed May 11 17:24:38 2022 +0530

    perf test bpf: Skip test if clang is not present
    
    [ Upstream commit 8994e97be3eb3c3a7b59d6223018ffab8c272e2d ]
    
    Perf BPF filter test fails in environment where "clang" is not
    installed.
    
    Test failure logs:
    
    <<>>
     42: BPF filter                    :
     42.1: Basic BPF filtering         : Skip
     42.2: BPF pinning                 : FAILED!
     42.3: BPF prologue generation     : FAILED!
    <<>>
    
    Enabling verbose option provided debug logs which says clang/llvm needs
    to be installed. Snippet of verbose logs:
    
    <<>>
     42.2: BPF pinning                  :
     --- start ---
    test child forked, pid 61423
    ERROR:  unable to find clang.
    Hint:   Try to install latest clang/llvm to support BPF.
            Check your $PATH
    
    <<logs_here>>
    
    Failed to compile test case: 'Basic BPF llvm compile'
    Unable to get BPF object, fix kbuild first
    test child finished with -1
     ---- end ----
    BPF filter subtest 2: FAILED!
    <<>>
    
    Here subtests, "BPF pinning" and "BPF prologue generation" failed and
    logs shows clang/llvm is needed. After installing clang, testcase
    passes.
    
    Reason on why subtest failure happens though logs has proper debug
    information:
    
    Main function __test__bpf calls test_llvm__fetch_bpf_obj by
    passing 4th argument as true ( 4th arguments maps to parameter
    "force" in test_llvm__fetch_bpf_obj ). But this will cause
    test_llvm__fetch_bpf_obj to skip the check for clang/llvm.
    
    Snippet of code part which checks for clang based on
    parameter "force" in test_llvm__fetch_bpf_obj:
    
    <<>>
    if (!force && (!llvm_param.user_set_param &&
    <<>>
    
    Since force is set to "false", test won't get skipped and fails to
    compile test case. The BPF code compilation needs clang, So pass the
    fourth argument as "false" and also skip the test if reason for return
    is "TEST_SKIP"
    
    After the patch:
    
    <<>>
     42: BPF filter                    :
     42.1: Basic BPF filtering         : Skip
     42.2: BPF pinning                 : Skip
     42.3: BPF prologue generation     : Skip
    <<>>
    
    Fixes: ba1fae431e74bb42 ("perf test: Add 'perf test BPF'")
    Reviewed-by: Kajol Jain <kjain@xxxxxxxxxxxxx>
    Signed-off-by: Athira Jajeev <atrajeev@xxxxxxxxxxxxxxxxxx>
    Acked-by: Ian Rogers <irogers@xxxxxxxxxx>
    Cc: Disha Goel <disgoel@xxxxxxxxxxxxxxxxxx>
    Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
    Cc: linuxppc-dev@xxxxxxxxxxxxxxxx
    Cc: Madhavan Srinivasan <maddy@xxxxxxxxxxxxxxxxxx>
    Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
    Cc: Nageswara R Sastry <rnsastry@xxxxxxxxxxxxx>
    Cc: Wang Nan <wangnan0@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220511115438.84032-1-atrajeev@xxxxxxxxxxxxxxxxxx
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index 573490530194..592ab02d5ba3 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -222,11 +222,11 @@ static int __test__bpf(int idx)
 
 	ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz,
 				       bpf_testcase_table[idx].prog_id,
-				       true, NULL);
+				       false, NULL);
 	if (ret != TEST_OK || !obj_buf || !obj_buf_sz) {
 		pr_debug("Unable to get BPF object, %s\n",
 			 bpf_testcase_table[idx].msg_compile_fail);
-		if (idx == 0)
+		if ((idx == 0) || (ret == TEST_SKIP))
 			return TEST_SKIP;
 		else
 			return TEST_FAIL;
@@ -370,9 +370,11 @@ static int test__bpf_prologue_test(struct test_suite *test __maybe_unused,
 static struct test_case bpf_tests[] = {
 #ifdef HAVE_LIBBPF_SUPPORT
 	TEST_CASE("Basic BPF filtering", basic_bpf_test),
-	TEST_CASE("BPF pinning", bpf_pinning),
+	TEST_CASE_REASON("BPF pinning", bpf_pinning,
+			"clang isn't installed or environment missing BPF support"),
 #ifdef HAVE_BPF_PROLOGUE
-	TEST_CASE("BPF prologue generation", bpf_prologue_test),
+	TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test,
+			"clang isn't installed or environment missing BPF support"),
 #else
 	TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not compiled in"),
 #endif



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux