Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752593AbbGaPqM (ORCPT ); Fri, 31 Jul 2015 11:46:12 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:34263 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751092AbbGaPqK (ORCPT ); Fri, 31 Jul 2015 11:46:10 -0400 Subject: Re: [PATCH v4 1/4] bpf: Make the bpf_prog_array_map more generic To: xiakaixu References: <1438082255-60683-1-git-send-email-xiakaixu@huawei.com> <1438082255-60683-2-git-send-email-xiakaixu@huawei.com> <55B95F06.4040800@iogearbox.net> <55B9816B.5020801@plumgrid.com> <55BB36C9.4050007@huawei.com> Cc: Daniel Borkmann , davem@davemloft.net, acme@kernel.org, mingo@redhat.com, a.p.zijlstra@chello.nl, masami.hiramatsu.pt@hitachi.com, jolsa@kernel.org, wangnan0@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com, hekuang@huawei.com From: Alexei Starovoitov Message-ID: <55BB9840.2040002@plumgrid.com> Date: Fri, 31 Jul 2015 08:46:08 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55BB36C9.4050007@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1608 Lines: 36 On 7/31/15 1:50 AM, xiakaixu wrote: > 于 2015/7/30 9:44, Alexei Starovoitov 写道: >> On 7/29/15 4:17 PM, Daniel Borkmann wrote: >>>> - if (map->map_type == BPF_MAP_TYPE_PROG_ARRAY) >>>> + if (map->map_type >= BPF_MAP_TYPE_PROG_ARRAY) >>>> /* prog_array stores refcnt-ed bpf_prog pointers >>>> * release them all when user space closes prog_array_fd >>>> */ >>>> - bpf_prog_array_map_clear(map); >>>> + bpf_fd_array_map_clear(map); >>> >>> When we are going to add a new map type to the eBPF framework that is not >>> an fd_array_map thing, this assumption of map->map_type >= >>> BPF_MAP_TYPE_PROG_ARRAY >>> might not hold then ... >> >> Also I think here changing == to >= is probably unnecessary. >> prog_array needs to do it because of circular dependency >> whereas perf_event_array cannot have it. >> Even when we attach bpf prog to perf_event and then add it to >> perf_event_array used by the same prog, right? >> Please test such scenario just in case. > > Not sure completely understand what you mean. You know, we can > attach bpf_prog to kprobe events. For now, we limit few event > types, only PERF_EVENT_RAW & PERF_EVENT_HARDWARE event can > be accessed in bpf_perf_event_read(). Seems like the dependency > scenario won't happen. ahh, yes, you're correct. There is no circular dependency. -- 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/