From patchwork Thu Oct 15 11:58:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 54997 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id 324F322FFA for ; Thu, 15 Oct 2015 12:02:44 +0000 (UTC) Received: by lbbms9 with SMTP id ms9sf9400694lbb.3 for ; Thu, 15 Oct 2015 05:02:43 -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=ak8YDxivhSBCbcOloXc7ulfj8BAxpoivv01SIkGaaLg=; b=m5UYuJXz3SbuD+0CBscv4NI+qqK2h3i8S3koBNBv5wgc+mMjXrm0IcBjZnSbl60N/N No7xbOu57JdMNSOcSTSPa071/FZ240nSemKA7lG6ja3EzyUqwV1HkzV15G6+tAfMyofH hS7duzvnPIZqSJfzCAR+Fq0KvGkavuYa5i0oYShYIj+KMd+4otmkP6yIKSTuWR++RLLr 1aSYiRg+kw8eYGawSunYP6KyRq39MQnrYlAXuKP2dOUgagXw1Djs8oncOb//cVCI/yYt YTE9ItbMmNDwpa/CMaKUDzax6ZupzdCOdvPQjkO7Ee4fSzWAN9D+908fiaBtEXge7jKj F4nw== X-Gm-Message-State: ALoCoQnPLCzpdbvzl9ymYGYJAz/9gd6/k3ZQm6c3zijDqjh25IHadJHhNwQIb17PL6tebYet+fs2 X-Received: by 10.112.14.4 with SMTP id l4mr113970lbc.20.1444910563173; Thu, 15 Oct 2015 05:02:43 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.166.200 with SMTP id p191ls136670lfe.37.gmail; Thu, 15 Oct 2015 05:02:42 -0700 (PDT) X-Received: by 10.25.16.92 with SMTP id f89mr2787210lfi.1.1444910562871; Thu, 15 Oct 2015 05:02:42 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id pk3si8880504lbb.155.2015.10.15.05.02.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 05:02:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbwb3 with SMTP id wb3so5007585lbb.1 for ; Thu, 15 Oct 2015 05:02:42 -0700 (PDT) X-Received: by 10.112.64.72 with SMTP id m8mr4193184lbs.41.1444910562602; Thu, 15 Oct 2015 05:02:42 -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 w3csp586584lbq; Thu, 15 Oct 2015 05:02:41 -0700 (PDT) X-Received: by 10.50.43.201 with SMTP id y9mr10151142igl.18.1444910561482; Thu, 15 Oct 2015 05:02:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o194si11223476ioo.181.2015.10.15.05.02.41; Thu, 15 Oct 2015 05:02:41 -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 S1753157AbbJOMCj (ORCPT + 30 others); Thu, 15 Oct 2015 08:02:39 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:37469 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753002AbbJOMCi (ORCPT ); Thu, 15 Oct 2015 08:02:38 -0400 Received: from 172.24.1.51 (EHLO szxeml427-hub.china.huawei.com) ([172.24.1.51]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CWV17546; Thu, 15 Oct 2015 19:58:52 +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; Thu, 15 Oct 2015 19:58:42 +0800 Message-ID: <561F94EE.2060503@huawei.com> Date: Thu, 15 Oct 2015 19:58:38 +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: Namhyung Kim CC: , , , , , , , , , , , , , , Arnaldo Carvalho de Melo Subject: Re: [PATCH 10/31] perf test: Enforce LLVM test for BPF test References: <1444826502-49291-1-git-send-email-wangnan0@huawei.com> <1444826502-49291-11-git-send-email-wangnan0@huawei.com> <20151014154842.GC4085@danjae.kornet> In-Reply-To: <20151014154842.GC4085@danjae.kornet> 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.169 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: , On 2015/10/14 23:48, Namhyung Kim wrote: > On Wed, Oct 14, 2015 at 12:41:21PM +0000, Wang Nan wrote: >> This patch replaces the original toy BPF program with previous introduced >> bpf-script-example.c. Dynamically embedded it into 'llvm-src.c'. >> >> The newly introduced BPF program attaches a BPF program at >> 'sys_epoll_pwait()', and collect half samples from it. perf itself never >> use that syscall, so further test can verify their result with it. >> >> Since BPF program require LINUX_VERSION_CODE of runtime kernel, this >> patch computes that code from uname. >> >> Since the resuling BPF object is useful for further testcases, this patch >> introduces 'prepare' and 'cleanup' method to tests, and makes test__llvm() >> create a MAP_SHARED memory array to hold the resulting object. >> >> Signed-off-by: He Kuang >> Signed-off-by: Wang Nan >> Cc: Arnaldo Carvalho de Melo >> Cc: Alexei Starovoitov >> Cc: Brendan Gregg >> Cc: Daniel Borkmann >> Cc: David Ahern >> Cc: Jiri Olsa >> Cc: Kaixu Xia >> Cc: Masami Hiramatsu >> Cc: Namhyung Kim >> Cc: Peter Zijlstra >> Cc: Zefan Li >> Cc: pi3orama@163.com >> Link: http://lkml.kernel.org/n/ebpf-6yw9eg0ej3l4jnqhinngkw86@git.kernel.org >> --- > [SNIP] > >> +void test__llvm_prepare(void) >> +{ >> + p_test_llvm__bpf_result = mmap(NULL, SHARED_BUF_INIT_SIZE, >> + PROT_READ | PROT_WRITE, >> + MAP_SHARED | MAP_ANONYMOUS, -1, 0); >> + if (!p_test_llvm__bpf_result) > It should check MAP_FAILED instead. > Fixed by this way: 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/llvm.c b/tools/perf/tests/llvm.c index e722e8a..25ddeaf 100644 --- a/tools/perf/tests/llvm.c +++ b/tools/perf/tests/llvm.c @@ -199,12 +199,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;