Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752573AbdHKFop (ORCPT ); Fri, 11 Aug 2017 01:44:45 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3508 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752208AbdHKFon (ORCPT ); Fri, 11 Aug 2017 01:44:43 -0400 From: Wang Nan To: , CC: , , "Wang Nan" , Alexei Starovoitov , Hendrik Brueckner , Li Zefan Subject: [PATCH] perf test llvm: Fix f_mode endianness problem Date: Sat, 12 Aug 2017 13:49:01 +0000 Message-ID: <20170812134901.30237-1-wangnan0@huawei.com> X-Mailer: git-send-email 2.10.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.110.60.55] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A0B0205.598D4441.0035,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 4afb94b81324b2567a33c1793ac6d4c2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1226 Lines: 33 Perf BPF prologue generator unconditionally fetches 8 bytes for function parameters. On big endian machine, a casting is resquired if the parameter is not u64. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Thomas Richter Cc: Alexei Starovoitov Cc: Hendrik Brueckner Cc: Li Zefan --- tools/perf/tests/bpf-script-test-prologue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/tests/bpf-script-test-prologue.c b/tools/perf/tests/bpf-script-test-prologue.c index b4ebc75..43f1e16 100644 --- a/tools/perf/tests/bpf-script-test-prologue.c +++ b/tools/perf/tests/bpf-script-test-prologue.c @@ -26,9 +26,11 @@ static void (*bpf_trace_printk)(const char *fmt, int fmt_size, ...) = (void *) 6; SEC("func=null_lseek file->f_mode offset orig") -int bpf_func__null_lseek(void *ctx, int err, unsigned long f_mode, +int bpf_func__null_lseek(void *ctx, int err, unsigned long _f_mode, unsigned long offset, unsigned long orig) { + fmode_t f_mode = (fmode_t)_f_mode; + if (err) return 0; if (f_mode & FMODE_WRITE) -- 2.10.1