All of lore.kernel.org
 help / color / mirror / Atom feed
From: xiakaixu <xiakaixu@huawei.com>
To: Alexei Starovoitov <ast@plumgrid.com>
Cc: <davem@davemloft.net>, <acme@kernel.org>, <mingo@redhat.com>,
	<a.p.zijlstra@chello.nl>, <masami.hiramatsu.pt@hitachi.com>,
	<jolsa@kernel.org>, <daniel@iogearbox.net>, <wangnan0@huawei.com>,
	<linux-kernel@vger.kernel.org>, <pi3orama@163.com>,
	<hekuang@huawei.com>, <netdev@vger.kernel.org>
Subject: Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter
Date: Wed, 5 Aug 2015 10:09:22 +0800	[thread overview]
Message-ID: <55C17052.80803@huawei.com> (raw)
In-Reply-To: <55C0FC83.10504@plumgrid.com>

于 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.
> 
> 
> .
> 



  reply	other threads:[~2015-08-05  2:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04  8:58 [PATCH v6 0/4] bpf: Introduce the new ability of eBPF programs to access hardware PMU counter Kaixu Xia
2015-08-04  8:58 ` [PATCH v6 1/4] bpf: Make the bpf_prog_array_map more generic Kaixu Xia
2015-08-04  8:58 ` [PATCH v6 2/4] bpf: Add new bpf map type to store the pointer to struct perf_event Kaixu Xia
2015-08-04 17:43   ` Alexei Starovoitov
2015-08-05  9:41     ` Peter Zijlstra
2015-08-05  9:39   ` Peter Zijlstra
2015-08-05  9:43   ` Peter Zijlstra
2015-08-04  8:58 ` [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter Kaixu Xia
2015-08-04 17:55   ` Alexei Starovoitov
2015-08-05  2:09     ` xiakaixu [this message]
2015-08-05 10:04   ` Peter Zijlstra
2015-08-05 10:15     ` Peter Zijlstra
2015-08-05 16:00       ` Alexei Starovoitov
2015-08-05 10:31     ` xiakaixu
2015-08-05 13:53     ` Peter Zijlstra
2015-08-05 13:59       ` Peter Zijlstra
2015-08-05 16:08       ` Alexei Starovoitov
2015-08-05 16:21         ` Peter Zijlstra
2015-08-06  2:49       ` xiakaixu
2015-08-05 15:59     ` Alexei Starovoitov
2015-08-04  8:58 ` [PATCH v6 4/4] samples/bpf: example of get selected PMU counter value Kaixu Xia
2015-08-05 10:06 ` [PATCH v6 0/4] bpf: Introduce the new ability of eBPF programs to access hardware PMU counter Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55C17052.80803@huawei.com \
    --to=xiakaixu@huawei.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=ast@plumgrid.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=hekuang@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pi3orama@163.com \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.