Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1200191

Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter

From Alexei Starovoitov <ast@plumgrid.com>
Newsgroups linux.kernel
Subject Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter
Date 2015-08-04 20:00 +0200
Message-ID <pTOFk-SZ-13@gated-at.bofh.it> (permalink)
References <pTGeK-5Af-19@gated-at.bofh.it> <pTGoq-60Z-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v6 0/4] bpf: Introduce the new ability of eBPF programs to access hardware PMU counter Kaixu Xia <xiakaixu@huawei.com> - 2015-08-04 11:10 +0200
  [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter Kaixu Xia <xiakaixu@huawei.com> - 2015-08-04 11:10 +0200
    Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read() that  get the selected hardware PMU conuter Alexei Starovoitov <ast@plumgrid.com> - 2015-08-04 20:00 +0200
      Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read()  that get the selected hardware PMU conuter xiakaixu <xiakaixu@huawei.com> - 2015-08-05 04:10 +0200
    Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read()  that get the selected hardware PMU conuter Peter Zijlstra <peterz@infradead.org> - 2015-08-05 12:10 +0200
      Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read()  that get the selected hardware PMU conuter Peter Zijlstra <peterz@infradead.org> - 2015-08-05 12:20 +0200
        Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read() that  get the selected hardware PMU conuter Alexei Starovoitov <ast@plumgrid.com> - 2015-08-05 18:10 +0200
      Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read()  that get the selected hardware PMU conuter xiakaixu <xiakaixu@huawei.com> - 2015-08-05 12:40 +0200
      Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read()  that get the selected hardware PMU conuter Peter Zijlstra <peterz@infradead.org> - 2015-08-05 16:00 +0200
        Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read()  that get the selected hardware PMU conuter Peter Zijlstra <peterz@infradead.org> - 2015-08-05 16:00 +0200
        Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read() that  get the selected hardware PMU conuter Alexei Starovoitov <ast@plumgrid.com> - 2015-08-05 18:10 +0200
          Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read()  that get the selected hardware PMU conuter Peter Zijlstra <peterz@infradead.org> - 2015-08-05 18:30 +0200
        Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read()  that get the selected hardware PMU conuter xiakaixu <xiakaixu@huawei.com> - 2015-08-06 04:50 +0200
      Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read() that  get the selected hardware PMU conuter Alexei Starovoitov <ast@plumgrid.com> - 2015-08-05 18:00 +0200
  Re: [PATCH v6 0/4] bpf: Introduce the new ability of eBPF programs  to access hardware PMU counter Peter Zijlstra <peterz@infradead.org> - 2015-08-05 12:10 +0200

csiph-web