From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754369AbdLHPjv (ORCPT ); Fri, 8 Dec 2017 10:39:51 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:44814 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754341AbdLHPjr (ORCPT ); Fri, 8 Dec 2017 10:39:47 -0500 X-Google-Smtp-Source: AGs4zMb4v1EOp9pGAPkd7AhVicr/tE9D+jMYfaLYx9Bc6olNoB5ey7zh9Xbs3psTEUTxrGvXDT0SqQ== Subject: Re: [PATCH v2 net-next 4/4] bpftool: implement cgroup bpf operations To: Roman Gushchin Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, ast@kernel.org, daniel@iogearbox.net, jakub.kicinski@netronome.com, kafai@fb.com, David Ahern References: <20171207183909.16240-1-guro@fb.com> <20171207183909.16240-5-guro@fb.com> <20171208141251.GA9458@castle> From: Quentin Monnet Message-ID: <0eed580a-804b-329e-7bfc-1dc5c09a1deb@netronome.com> Date: Fri, 8 Dec 2017 15:39:43 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171208141251.GA9458@castle> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2017-12-08 14:12 UTC+0000 ~ Roman Gushchin > On Fri, Dec 08, 2017 at 10:34:16AM +0000, Quentin Monnet wrote: >> 2017-12-07 18:39 UTC+0000 ~ Roman Gushchin >>> This patch adds basic cgroup bpf operations to bpftool: >>> cgroup list, attach and detach commands. >>> >>> Usage is described in the corresponding man pages, >>> and examples are provided. > [...] >>> +MAP COMMANDS >>> +============= >>> + >>> +| **bpftool** **cgroup list** *CGROUP* >>> +| **bpftool** **cgroup attach** *CGROUP* *ATTACH_TYPE* *PROG* [*ATTACH_FLAGS*] >>> +| **bpftool** **cgroup detach** *CGROUP* *ATTACH_TYPE* *PROG* >>> +| **bpftool** **cgroup help** >>> +| >>> +| *PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* } >> >> Could you please give the different possible values for ATTACH_TYPE and >> ATTACH_FLAGS, and provide some documentation for the flags? > > I intentionally didn't include the list of possible values, as it depends > on the exact kernel version, and other bpftool docs are carefully avoiding > specifying such things. Do they? As far as I can tell the only other bpftool command that uses flags is the `bpftool map update`, and it does specify the possible values for UPDATE_FLAGS (and document them) in the man page. I don't believe compatibility is an issue here, since the program and its documentation come together (so they should stay in sync) and are part of the kernel tree (so the tool should be compatible with the kernel sources it comes with). My concern is that there is no way to guess from the current description what the values for ATTACH_FLAG or ATTACH_TYPE can be, without reading the source code of the program—which is not exactly user-friendly. > > It would be nice to have a way to ask the kernel about provided bpf program types, > attach types, etc; but I'm not sure that hardcoding it in bpftool docs is > a good idea. They are coded into the bpftool that comes with the docs anyway :). Quentin