linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
To: "Wangnan (F)" <wangnan0@huawei.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Hendrik Brueckner <brueckner@linux.vnet.ibm.com>,
	Zefan Li <lizefan@huawei.com>,
	linux-perf-users@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: perf test BPF subtest bpf-prologue test fails on s390x
Date: Fri, 11 Aug 2017 13:13:08 +0200	[thread overview]
Message-ID: <baf74c0b-56a8-c67b-6376-e8bdebf30636@linux.vnet.ibm.com> (raw)
In-Reply-To: <4cd18c9a-7481-5bca-2d61-49e617ba2f96@huawei.com>

On 08/11/2017 11:57 AM, Wangnan (F) wrote:
> 
> 
> On 2017/8/11 17:17, Thomas-Mich Richter wrote:
>> On 08/11/2017 07:19 AM, Wangnan (F) wrote:


[....]

> Your analysis is correct.
> 
>>
>> Maybe the solution is to add an endianness convertion into the gen_read_mem()
>> function.
> 
> That means alert the prologue. We can utilize the size field in BPF_LDX_MEM.
> 
> Could you please try this patch:
> 
> diff --git a/tools/perf/util/bpf-prologue.c b/tools/perf/util/bpf-prologue.c
> index 6cdbee1..aadbda4 100644
> --- a/tools/perf/util/bpf-prologue.c
> +++ b/tools/perf/util/bpf-prologue.c
> @@ -258,7 +258,7 @@ gen_prologue_slowpath(struct bpf_insn_pos *pos,
> 
>         /* Final pass: read to registers */
>         for (i = 0; i < nargs; i++)
> -               ins(BPF_LDX_MEM(BPF_DW, BPF_PROLOGUE_START_ARG_REG + i,
> +               ins(BPF_LDX_MEM(BPF_W, BPF_PROLOGUE_START_ARG_REG + i,
>                                 BPF_REG_FP, -BPF_REG_SIZE * (i + 1)), pos);
> 
>         ins(BPF_JMP_IMM(BPF_JA, BPF_REG_0, 0, JMP_TO_SUCCESS_CODE), pos);
> 
> 
> On your platform and check if the value of f_mode is correct?
> 
> NOTE: 64 bit load becomes incorrect after applying this patch. I want to make sure
> the behavior of 32 bit BPF load instruction works correct on big endian machine.
> 
> Thank you.
> 

This patch solves the issue with the first parameter. Now I see the correct
value of f_mode member of struct-file.
As you said the other loads are wrong. Here is the output of the 
trace:

           perf-13438 [000] d..2  2102.392312: : f_mode 6001f offset:0 orig:0
            perf-13438 [000] d..2  2102.392414: : f_mode 2001d offset:0 orig:0
            perf-13438 [000] d..2  2102.392440: : f_mode 2001d offset:0 orig:0
            perf-13438 [000] d..2  2102.392453: : f_mode 6001f offset:0 orig:0

PS: When I ran this test I undid the changes to tests/bpf-test-script-prologue.c.
It was in its original state when this test was executed.


-- 
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

      reply	other threads:[~2017-08-11 11:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09  9:24 perf test BPF subtest bpf-prologue test fails on s390x Thomas Richter
2017-08-10 18:13 ` Arnaldo Carvalho de Melo
2017-08-11  5:19   ` Wangnan (F)
2017-08-11  9:17     ` Thomas-Mich Richter
2017-08-11  9:49       ` Fwd: " Thomas-Mich Richter
2017-08-11  9:57       ` Wangnan (F)
2017-08-11 11:13         ` Thomas-Mich Richter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=baf74c0b-56a8-c67b-6376-e8bdebf30636@linux.vnet.ibm.com \
    --to=tmricht@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).