Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1261788 > unrolled thread
| Started by | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| First post | 2015-11-03 19:30 +0100 |
| Last post | 2015-11-04 02:50 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 10/31] perf test: Enforce LLVM test for BPF test Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-03 19:30 +0100
Re: [PATCH 10/31] perf test: Enforce LLVM test for BPF test "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-04 02:50 +0100
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-11-03 19:30 +0100 |
| Subject | Re: [PATCH 10/31] perf test: Enforce LLVM test for BPF test |
| Message-ID | <qqOvg-6ox-23@gated-at.bofh.it> |
Em Thu, Oct 15, 2015 at 07:58:38PM +0800, Wangnan (F) escreveu:
> >>+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:
Can you please try refreshing this patchset on top of what is now in
acme/perf/core?
Also why do we need those struct test->{prepare,cleanup} pointers? You
introduced it and then, on the next patch that touches 'perf test' and
uses test__llvm_{prepare,cleanup} you call them directly, which I think
should be enough, i.e. keep them as functions to call from inside
the test called from run_test(), right?
- Arnaldo
> 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;
>
> 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/
[toc] | [next] | [standalone]
| From | "Wangnan (F)" <wangnan0@huawei.com> |
|---|---|
| Date | 2015-11-04 02:50 +0100 |
| Message-ID | <qqVn4-2e0-9@gated-at.bofh.it> |
| In reply to | #1261788 |
On 2015/11/4 2:24, Arnaldo Carvalho de Melo wrote:
> Em Thu, Oct 15, 2015 at 07:58:38PM +0800, Wangnan (F) escreveu:
>>>> +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:
> Can you please try refreshing this patchset on top of what is now in
> acme/perf/core?
>
> Also why do we need those struct test->{prepare,cleanup} pointers? You
> introduced it and then, on the next patch that touches 'perf test' and
> uses test__llvm_{prepare,cleanup} you call them directly, which I think
> should be enough, i.e. keep them as functions to call from inside
> the test called from run_test(), right?
>
> - Arnaldo
>
This prepare/cleanup functions are introduced because I want BPF
test reuse the result of LLVM test, so it don't need to compile
those BPF scripts twice. This is the reason I use shared
memory. However, now I think compiling twice is acceptable and
can make things simpler.
I'll update this patchset in my next pull request.
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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web