Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753613AbbGXByZ (ORCPT ); Thu, 23 Jul 2015 21:54:25 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:24201 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752448AbbGXByW (ORCPT ); Thu, 23 Jul 2015 21:54:22 -0400 Message-ID: <55B19AB9.3090100@huawei.com> Date: Fri, 24 Jul 2015 09:54:01 +0800 From: xiakaixu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Alexei Starovoitov CC: , , , , , , , , , Subject: Re: [PATCH v3 3/3] samples/bpf: example of get selected PMU counter value References: <1437644562-84431-1-git-send-email-xiakaixu@huawei.com> <1437644562-84431-4-git-send-email-xiakaixu@huawei.com> <55B171EB.30203@plumgrid.com> In-Reply-To: <55B171EB.30203@plumgrid.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.111.101.23] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 962 Lines: 32 于 2015/7/24 6:59, Alexei Starovoitov 写道: > On 7/23/15 2:42 AM, Kaixu Xia wrote: >> This is a simple example and shows how to use the new ability >> to get the selected Hardware PMU counter value. >> >> Signed-off-by: Kaixu Xia > ... >> +struct bpf_map_def SEC("maps") my_map = { >> + .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY, >> + .key_size = sizeof(int), >> + .value_size = sizeof(unsigned long), >> + .max_entries = 32, >> +}; > > wait. how did it work here? value_size should be u32. I tested the whole thing on ARM board. You are ringt, it should be u32. When create the array map, we choose the array->elem_size as round_up(attr->value_size, 8), why 8? Thanks! > > > -- 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/