Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752778AbdHKLNS (ORCPT ); Fri, 11 Aug 2017 07:13:18 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52439 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751995AbdHKLNP (ORCPT ); Fri, 11 Aug 2017 07:13:15 -0400 Subject: Re: perf test BPF subtest bpf-prologue test fails on s390x To: "Wangnan (F)" , Arnaldo Carvalho de Melo Cc: Alexei Starovoitov , Hendrik Brueckner , Zefan Li , linux-perf-users@vger.kernel.org, Linux Kernel Mailing List References: <20170810181319.GD3900@kernel.org> <53348602-8cff-e218-cdeb-b5504fd211e2@huawei.com> <968ebda5-abe4-8830-8d69-49f62529d151@linux.vnet.ibm.com> <4cd18c9a-7481-5bca-2d61-49e617ba2f96@huawei.com> From: Thomas-Mich Richter Organization: IBM LTC Date: Fri, 11 Aug 2017 13:13:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <4cd18c9a-7481-5bca-2d61-49e617ba2f96@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-IE Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 17081111-0012-0000-0000-0000056ED351 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17081111-0013-0000-0000-000018E6110D Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-08-11_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1708110179 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2195 Lines: 62 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