Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751858AbbHECJu (ORCPT ); Tue, 4 Aug 2015 22:09:50 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:61693 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751078AbbHECJs (ORCPT ); Tue, 4 Aug 2015 22:09:48 -0400 Message-ID: <55C17052.80803@huawei.com> Date: Wed, 5 Aug 2015 10:09:22 +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 v6 3/4] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter References: <1438678696-88289-1-git-send-email-xiakaixu@huawei.com> <1438678696-88289-4-git-send-email-xiakaixu@huawei.com> <55C0FC83.10504@plumgrid.com> In-Reply-To: <55C0FC83.10504@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: 1321 Lines: 45 于 2015/8/5 1:55, Alexei Starovoitov 写道: > On 8/4/15 1:58 AM, Kaixu Xia wrote: >> +static int check_func_limit(struct bpf_map **mapp, int func_id) > > how about 'check_map_func_compatibility' or 'check_map_func_affinity' ? > >> +{ >> + struct bpf_map *map = *mapp; > > why pass pointer to a pointer? single pointer would be be fine. > >> + bool bool_map, bool_func; >> + int i; >> + >> + if (!map) >> + return 0; >> + >> + for (i = 0; i <= ARRAY_SIZE(func_limit); i++) { >> + bool_map = (map->map_type == func_limit[i].map_type); >> + bool_func = (func_id == func_limit[i].func_id); >> + /* only when map & func pair match it can continue. >> + * don't allow any other map type to be passed into >> + * the special func; >> + */ >> + if (bool_map != bool_func) >> + return -EINVAL; >> + } > > nice simplification! > > the rest of the changes look good. > please respin your next set against net-next. Thanks for your review! I will follow them in the next set. > > > . > -- 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/