From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754273AbbERSet (ORCPT ); Mon, 18 May 2015 14:34:49 -0400 Received: from mail-ie0-f181.google.com ([209.85.223.181]:33443 "EHLO mail-ie0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752195AbbERSeq (ORCPT ); Mon, 18 May 2015 14:34:46 -0400 Message-ID: <555A30C3.6000907@plumgrid.com> Date: Mon, 18 May 2015 11:34:43 -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: Wang Nan , paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, jolsa@kernel.org, dsahern@gmail.com, daniel@iogearbox.net, brendan.d.gregg@gmail.com, masami.hiramatsu.pt@hitachi.com CC: lizefan@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH v3 18/37] bpf tools: Record map accessing instructions for each program References: <1431860222-61636-1-git-send-email-wangnan0@huawei.com> <1431860222-61636-19-git-send-email-wangnan0@huawei.com> In-Reply-To: <1431860222-61636-19-git-send-email-wangnan0@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/17/15 3:56 AM, Wang Nan wrote: > This patch records the indics of instructions which are needed to be > relocated. Those information are saved in 'reloc_desc' field in > 'struct bpf_program'. In loading phase (this patch takes effect in > opening phase), the collected instructions will be replaced by > map loading instructions. > > Since we are going to close the ELF file and clear all data at the end > of 'opening' phase, ELF information will no longer be valid in > 'loading' phase. We have to locate the instructions before maps are > loaded, instead of directly modifying the instruction. > > 'struct bpf_map_def' is introduce in this patch to let us know how many > maps defined in the object. > > Signed-off-by: Wang Nan ... > +/* > + * packed attribute is unnecessary for 'bpf_map_def'. > + */ > +struct bpf_map_def { > + unsigned int type; > + unsigned int key_size; > + unsigned int value_size; > + unsigned int max_entries; > +}; the comment looks out of place. 'packed' is necessary somewhere else? What were you concerned about here?