Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932343AbbERScN (ORCPT ); Mon, 18 May 2015 14:32:13 -0400 Received: from mail-ie0-f175.google.com ([209.85.223.175]:33285 "EHLO mail-ie0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932281AbbERScK (ORCPT ); Mon, 18 May 2015 14:32:10 -0400 Message-ID: <555A3027.7060803@plumgrid.com> Date: Mon, 18 May 2015 11:32:07 -0700 From: Alexei Starovoitov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: "Wangnan (F)" , Namhyung Kim CC: paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, jolsa@kernel.org, dsahern@gmail.com, daniel@iogearbox.net, brendan.d.gregg@gmail.com, masami.hiramatsu.pt@hitachi.com, lizefan@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH v3 16/37] bpf tools: Collect eBPF programs from their own sections References: <1431860222-61636-1-git-send-email-wangnan0@huawei.com> <1431860222-61636-17-git-send-email-wangnan0@huawei.com> <20150518122922.GB7683@danjae.kornet> <5559DF59.6080107@huawei.com> In-Reply-To: <5559DF59.6080107@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1066 Lines: 32 On 5/18/15 5:47 AM, Wangnan (F) wrote: > > >>> + prog->insns_cnt = size / sizeof(struct bpf_insn); >>> + memcpy(prog->insns, data, >>> + prog->insns_cnt * sizeof(struct bpf_insn)); >> Doesn't the data need to be swapped? >> >> Thanks, >> Namhyung >> > > I'm not very sure, since they are instructions. Byte order of > instructions and byte order of data > are not always same. Think about ARM. Therefore another choice is to > swap them in kernel, > keep user-kernel interface clean. > > Alexei Starovoitov, do you think we should use uniformed instruction > byte order in both big and little > endian kernel on user-kernel interface, or let userspace feed swapped > instructions to kernel if > endianess is not match? see my reply to the other patch. endianness is the job of llvm. Let's fix it there. -- 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/