From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752022AbbEYHkF (ORCPT ); Mon, 25 May 2015 03:40:05 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:33254 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751675AbbEYHj7 (ORCPT ); Mon, 25 May 2015 03:39:59 -0400 Message-ID: <5562D1A3.6050206@huawei.com> Date: Mon, 25 May 2015 15:39:15 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Alexei Starovoitov , , , , , , , , , , CC: , , 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> <555A30C3.6000907@plumgrid.com> In-Reply-To: <555A30C3.6000907@plumgrid.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.5562D1B0.0170,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: a0ef9754f0f41f03646a79ac9e609999 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/5/19 2:34, Alexei Starovoitov wrote: > 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? > I see a warning message: make: Entering directory `/home/w00229757/kernel-hydrogen/tools/lib/bpf' CC libbpf.o In file included from libbpf.c:23:0: libbpf.h:31:1: error: packed attribute is unnecessary for ‘bpf_map_def’ [-Werror=packed] } __attribute__((packed)); ^ cc1: all warnings being treated as errors if I append __attribute__((packed)) here. This is because Makefile.include in tools/script as '-Wpacked' warning message and it is inherited by perf. When compiling with perf this problem breaks compiling. Therefore I don't use 'packed' here. However I think there should be one. This comment is for that.