From patchwork Tue Oct 20 12:06:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 55302 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f70.google.com (mail-lf0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 2260822EA2 for ; Tue, 20 Oct 2015 12:10:12 +0000 (UTC) Received: by lffy185 with SMTP id y185sf4124296lff.2 for ; Tue, 20 Oct 2015 05:10:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=dxdhqp6Sz95A5EGNtyX+esYbBhSTgCsOSLPGQPSMh3w=; b=aggEbkTJ6FbEfJJLB9uF0yxGl17sG8jqS1xjrTmCYazUz6ifHdNUx/FFUf4LvoI0Nc n4YVB1RmKoDfx3UysKcUFSxv17gBaI+B7qrxduCX0fK/eCU7/uzXfN0ujf1/YE635DiU cLAgP8swLluvCXXUcDF+D1pAtzWcyhlx5J1GfUlgmNnINuSW1RGR4Bn3y5IhvVTKAYP8 GX6MA1mhC2pCrStVe5544y2HQJ5kNHCiunJPrtlWfaV6SjO2a/flML9aV74KGydU6XQZ oyuQTqAHXGUChTrWUumWy9BRCCTLpFcPvN/LQhPiMvkznUSHRUxbiwmT24YWsqo2Yl5y A9xw== X-Gm-Message-State: ALoCoQlNp16v2vSJbIRwI2egcC2SaHIC3mzpvnF/NCXJnMO38kJjETrafM27+UYg/bw6t8GoFEcR X-Received: by 10.112.27.134 with SMTP id t6mr571611lbg.13.1445343011118; Tue, 20 Oct 2015 05:10:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.150.209 with SMTP id y200ls58350lfd.17.gmail; Tue, 20 Oct 2015 05:10:10 -0700 (PDT) X-Received: by 10.25.151.131 with SMTP id z125mr1089205lfd.104.1445343010947; Tue, 20 Oct 2015 05:10:10 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id m188si2031627lfe.38.2015.10.20.05.10.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2015 05:10:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbbec13 with SMTP id ec13so11146676lbb.0 for ; Tue, 20 Oct 2015 05:10:10 -0700 (PDT) X-Received: by 10.112.180.230 with SMTP id dr6mr1606112lbc.72.1445343010453; Tue, 20 Oct 2015 05:10:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2042700lbq; Tue, 20 Oct 2015 05:10:08 -0700 (PDT) X-Received: by 10.67.3.2 with SMTP id bs2mr3671342pad.118.1445343008393; Tue, 20 Oct 2015 05:10:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id iv8si4872713pbc.11.2015.10.20.05.10.08; Tue, 20 Oct 2015 05:10:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752014AbbJTMJ6 (ORCPT + 28 others); Tue, 20 Oct 2015 08:09:58 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:1642 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750922AbbJTMJ4 (ORCPT ); Tue, 20 Oct 2015 08:09:56 -0400 Received: from 172.24.1.51 (EHLO szxeml427-hub.china.huawei.com) ([172.24.1.51]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CUO89684; Tue, 20 Oct 2015 20:07:09 +0800 (CST) Received: from [127.0.0.1] (10.111.66.109) by szxeml427-hub.china.huawei.com (10.82.67.182) with Microsoft SMTP Server id 14.3.235.1; Tue, 20 Oct 2015 20:06:56 +0800 Message-ID: <56262E5E.5060108@huawei.com> Date: Tue, 20 Oct 2015 20:06:54 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Arnaldo Carvalho de Melo , Namhyung Kim CC: , , , , , , , , , , , , , Subject: Re: [PATCH 21/31] perf test: Enforce LLVM test, add kbuild test References: <1444826502-49291-1-git-send-email-wangnan0@huawei.com> <1444826502-49291-22-git-send-email-wangnan0@huawei.com> <20151019144231.GA14297@danjae.kornet> <20151019145312.GA2359@redhat.com> In-Reply-To: <20151019145312.GA2359@redhat.com> X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: wangnan0@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Hi Namhyung and Arnaldo, I changed my testing related patches in my local git tree. All changed combined together is at the end of this mail. I remove all stderr output, and improve debug message. Please have a look at it. Thank you. --- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c index 5a6290a..453eff8 100644 --- a/tools/perf/tests/bpf.c +++ b/tools/perf/tests/bpf.c @@ -49,7 +49,7 @@ static struct bpf_object *prepare_bpf(const char *name, void *obj_buf, obj = bpf__prepare_load_buffer(obj_buf, obj_buf_sz, name); if (IS_ERR(obj)) { - fprintf(stderr, " (compile failed)"); + pr_debug("Compile BPF program failed.\n"); return NULL; } return obj; @@ -82,7 +82,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void), int expect) err = parse_events_load_bpf_obj(&parse_evlist, &parse_evlist.list, obj); if (err || list_empty(&parse_evlist.list)) { - fprintf(stderr, " (Failed to add events selected by BPF)"); + pr_debug("Failed to add events selected by BPF\n"); if (!err) err = -EINVAL; goto out; @@ -140,7 +140,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void), int expect) } if (count != expect) { - fprintf(stderr, " (filter result incorrect: %d != %d)", count, expect); + pr_debug("BPF filter result incorrect: %d != %d\n", count, expect); err = -EBADF; } @@ -164,16 +164,14 @@ static int __test__bpf(int index, const char *name, test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz, index); if (!obj_buf || !obj_buf_sz) { - if (verbose == 0) - fprintf(stderr, " (%s)", message_compile); + pr_debug("Failed to compile: %s\n", message_compile); return TEST_SKIP; } obj = prepare_bpf(name, obj_buf, obj_buf_sz); if (!obj) { err = -EINVAL; - if ((verbose == 0) && (message_load[0] != '\0')) - fprintf(stderr, " (%s)", message_load); + pr_debug("Failed to load: %s", message_load); goto out; } @@ -192,7 +190,7 @@ int test__bpf(void) int err; if (geteuid() != 0) { - fprintf(stderr, " (try run as root)"); + pr_debug("Only root can run BPF test\n"); return TEST_SKIP; } @@ -214,7 +212,7 @@ int test__bpf(void) (NR_ITERS + 1) / 4); return err; #else - fprintf(stderr, " (skip BPF prologue test)"); + pr_debug("BPF prologue is disabled when compiling, skip this test\n"); return TEST_OK; #endif } diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c index e722e8a..7c3b2c3 100644 --- a/tools/perf/tests/llvm.c +++ b/tools/perf/tests/llvm.c @@ -13,19 +13,23 @@ struct llvm_testcase { const char *source; const char *errmsg; + const char *hintmsg; struct test_llvm__bpf_result *result; bool tried; } llvm_testcases[NR_LLVM_TESTCASES + 1] = { [LLVM_TESTCASE_BASE] = {.source = test_llvm__bpf_prog, .errmsg = "Basic LLVM compiling failed", + .hintmsg = "Check llvm.clang-path option in ~/.perfconfig", .tried = false}, [LLVM_TESTCASE_KBUILD] = {.source = test_llvm__bpf_test_kbuild_prog, - .errmsg = "llvm.kbuild-dir can be fixed", + .errmsg = "Unable to find usable kbuild dir", + .hintmsg = "Check llvm.kbuild-dir option in ~/.perfconfig", .tried = false}, /* Don't output if this one fail. */ [LLVM_TESTCASE_BPF_PROLOGUE] = { .source = test_llvm__bpf_test_prologue_prog, - .errmsg = "failed for unknown reason", + .errmsg = "Unable to compile BPF prologue testing program", + .hintmsg = "This is an internal error, please report it", .tried = false}, {.source = NULL} }; @@ -43,16 +47,16 @@ static int test__bpf_parsing(void *obj_buf, size_t obj_buf_sz) obj = bpf_object__open_buffer(obj_buf, obj_buf_sz, NULL); if (!obj) - return -1; + return TEST_FAIL; bpf_object__close(obj); - return 0; + return TEST_OK; } #else static int test__bpf_parsing(void *obj_buf __maybe_unused, size_t obj_buf_sz __maybe_unused) { - fprintf(stderr, " (skip bpf parsing)"); - return 0; + pr_debug("BPF support is not compiled, skip BPF parsing\n"); + return TEST_SKIP; } #endif @@ -70,8 +74,8 @@ compose_source(const char *raw_source) err = sscanf(utsname.release, "%d.%d.%d", &version, &patchlevel, &sublevel); if (err != 3) { - fprintf(stderr, " (Can't get kernel version from uname '%s')", - utsname.release); + pr_debug("Unablt to get kernel version from uname '%s'\n", + utsname.release); return NULL; } @@ -104,7 +108,7 @@ static int __test__llvm(int i) * and clang is not found in $PATH, and this is not perf test -v */ if (verbose == 0 && !llvm_param.user_set_param && llvm__search_clang()) { - fprintf(stderr, " (no clang, try 'perf test -v LLVM')"); + pr_debug("Unable to find workable clang\n"); return TEST_SKIP; } @@ -155,7 +159,7 @@ static int __test__llvm(int i) verbose = old_verbose; if (err) - return -1; + return TEST_FAIL; err = test__bpf_parsing(obj_buf, obj_buf_sz); if (!err && result) { @@ -181,13 +185,12 @@ int test__llvm(void) * First testcase tests basic LLVM compiling. If it * fails, no need to check others. */ - if (!verbose) - fprintf(stderr, " (use -v to see error message)"); - return ret; + return TEST_FAIL; } else if (ret) { - if (!verbose && llvm_testcases[i].errmsg) - fprintf(stderr, " (%s)", llvm_testcases[i].errmsg); - return 0; + pr_debug("%s\n", llvm_testcases[i].errmsg); + if (llvm_testcases[i].hintmsg) + pr_debug("Hint:\t%s\n", llvm_testcases[i].hintmsg); + return TEST_SKIP; } } return 0; @@ -199,12 +202,15 @@ void test__llvm_prepare(void) for (i = 0; llvm_testcases[i].source; i++) { struct test_llvm__bpf_result *result; + void *p; - result = mmap(NULL, SHARED_BUF_INIT_SIZE, - PROT_READ | PROT_WRITE, - MAP_SHARED | MAP_ANONYMOUS, -1, 0); - if (!result) + p = mmap(NULL, SHARED_BUF_INIT_SIZE, + PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, 0); + if (p == MAP_FAILED) return; + + result = p; memset((void *)result, '\0', SHARED_BUF_INIT_SIZE); llvm_testcases[i].result = result; diff --git a/tools/perf/util/bpf-prologue.c b/tools/perf/util/bpf-prologue.c index e4adb18..36093d9 100644 --- a/tools/perf/util/bpf-prologue.c +++ b/tools/perf/util/bpf-prologue.c @@ -337,8 +337,10 @@ int bpf__gen_prologue(struct probe_trace_arg *args, int nargs, return 0; } - if (nargs > BPF_PROLOGUE_MAX_ARGS) + if (nargs > BPF_PROLOGUE_MAX_ARGS) { + pr_warning("bpf: prologue: too many arguments\n"); nargs = BPF_PROLOGUE_MAX_ARGS; + } if (cnt_space > BPF_MAXINSNS) cnt_space = BPF_MAXINSNS;