Received: by 10.223.164.202 with SMTP id h10csp745743wrb; Thu, 30 Nov 2017 19:06:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMa9RtutHCOgyKdglFPS2QYdPvJoEsTvsryw1dmmZ1ehN9+n+TkKT729z8AQhbYMUg8dm7Gt X-Received: by 10.84.211.110 with SMTP id b101mr4658528pli.266.1512097615628; Thu, 30 Nov 2017 19:06:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512097615; cv=none; d=google.com; s=arc-20160816; b=QwNxBFqDso85wjWhEhQTibOzKzlhWMhfMBZH8fVRkc+OuPQM1L0O6PKTg9kHyUtL/6 xFtWelG41iGWJPCCtwVWddaX8GGp7k1/etFwczXd4qKnfK+RlIzmGRFSrr+R5m1cxm83 u26JeGQxUHaPF5yZvxzbCdp5N7PAeqgeSlwftTCyui/x/mgUwq5+Vh4OdXpGJ8pn3n8S rQQkDYdTkjUp5MkE5ogVi4Nn2h4DKStRvQ1kGyZuO375GZkAfGZvy7B+EjF/BmfQFsSC 4pjxDTNuH3WI1xjIzpDqidCjOvcaA7RcUNGS54rxd/syHBL0lTWtqrG0byOo2kBjwXJf O+3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:arc-authentication-results; bh=gb0NjZoHADzHc1BIiiss84f9zmCHAOcRbv61h6XCakg=; b=XT+rWSxKzmQJLNH8KauLEnFJyTh1EKiXk+El3b76N8wTqC58fn3rokcfAUBiDYp4Kd oIbburN6TVmltnS5eplXlgELt9yRNpzIMyscC+HyNl4JnN72sOuRQVxcDU0yTjdm3JC+ zvuHSk+0BtPTnC6svpL9OaFnxyRmulk0FU5+N0sU9BrBH19CX22TuFizIPe6Iy/3uNp3 JN2xPF+PrTvD7YJK/EWTLTHilORzP5eNPAUvvIa+lS8huI8FR6A4mvASi8E1CxXBv2rx qt7Is6secZ263RN0NcXhwHPtEtk+VkTHqjH0XlpsmVY6KXCSFW4HfHhkvuLdueWyt1kr blUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=Sj1J8cyi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x87si4391134pfe.146.2017.11.30.19.06.42; Thu, 30 Nov 2017 19:06:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=Sj1J8cyi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752727AbdLADFA (ORCPT + 99 others); Thu, 30 Nov 2017 22:05:00 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:43388 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752599AbdLADE6 (ORCPT ); Thu, 30 Nov 2017 22:04:58 -0500 Received: by mail-pf0-f193.google.com with SMTP id e3so4023141pfi.10 for ; Thu, 30 Nov 2017 19:04:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=gb0NjZoHADzHc1BIiiss84f9zmCHAOcRbv61h6XCakg=; b=Sj1J8cyiGGJp2JD3Vt4oGsV9e1er/ucKhR3S+B0NjzJJD0SaS1wSEUM6+Ccrh5DCk2 MqFnAUebReOJzZILpC2FacW+BuEH6U0naZ+i1+w4GRsskB8dz6pEHbVXSFX9Wecl+tcq 3G684u7XbjnRh26ThLVizYnyLXcYu1bV5Sds+loQzdRZxvNfqvj+56jeCIkGEg3VZQjm 7j5G8brScbVBte4xhU8mpCi6kkc8lTj+b2V36KcBQdyym/5c80CJOcyZ3iCwQ0UiYETl UsIfpQioWPYc1w+PXTi56KqrpvYtnXP8wywhPccKmsl3PRz/wUF+Pqy3pKpUpKPdv7l1 NC/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=gb0NjZoHADzHc1BIiiss84f9zmCHAOcRbv61h6XCakg=; b=Sc66pC0l75K6aUHg6ivlGfjyrh5kXrHhpgiaX9+i2SYZtBJ1nrSP0+7ndmpduUIam5 emfr8MmuS6vevWulj4vFeNJTECpPRwUBnylcYzY0e5SXv1BCOtxtwhI+88gvZ2pgXZCK 2sYFSPA2YKZ4I5dGICGq7+rKTEx5plBYRFHXQq25E1JihUNEJUZmIX/rS/UlMQ3wt+hH moM+FCsMTiKVN69j703N+vWwhhks8ewmrdc0i6JxuedD1NBF3j7mRqz5lrX9D2dcnMub rJ6ON8Zs9tO//jnMW88OO1MubemQGTGadiyOPj/uvbq+mv8h9hRgfsupSMhiSHMXd6qn bxYQ== X-Gm-Message-State: AJaThX4VE3vxIsfXFVwtuWmg14audfM0btlhL12icyGgNktzo06/tGCb jlvEQYBia5d7l7ttNDcZfMoL5w== X-Received: by 10.99.109.5 with SMTP id i5mr4260201pgc.359.1512097497834; Thu, 30 Nov 2017 19:04:57 -0800 (PST) Received: from cakuba.netronome.com ([75.53.12.129]) by smtp.gmail.com with ESMTPSA id o88sm9625834pfj.175.2017.11.30.19.04.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Nov 2017 19:04:57 -0800 (PST) Date: Thu, 30 Nov 2017 19:04:54 -0800 From: Jakub Kicinski To: Roman Gushchin Cc: , , , , , Subject: Re: [PATCH net-next 0/5] bpftool: cgroup bpf operations Message-ID: <20171130190454.26723962@cakuba.netronome.com> In-Reply-To: <20171130134302.2840-1-guro@fb.com> References: <20171130134302.2840-1-guro@fb.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Roman! On Thu, 30 Nov 2017 13:42:57 +0000, Roman Gushchin wrote: > This patchset adds basic cgroup bpf operations to bpftool. > > Right now there is no convenient way to perform these operations. > The /samples/bpf/load_sock_ops.c implements attach/detacg operations, > but only for BPF_CGROUP_SOCK_OPS programs. Bps (part of bcc) implements > bpf introspection, but lacks any cgroup-related specific. > > I find having a tool to perform these basic operations in the kernel tree > very useful, as it can be used in the corresponding bpf documentation > without creating additional dependencies. And bpftool seems to be > a right tool to extend with such functionality. Could you place your code in a new file and add a new "object level"? I.e. bpftool cgroup list bpftool cgroup attach ... bpftool cgroup help etc? Note that you probably want the list to be first, so if someone types "bpftool cg" it runs list by default. Does it make sense to support pinned files and specifying programs by id? I used the "id"/"pinned" keywords so that users can choose to use either. Perhaps you should at least prefix the file to with "file"? So: $ bpftool cgattach file ./mybpfprog.o /sys/fs/cgroup/user.slice/ ingress $ bpftool cgattach id 19 /sys/fs/cgroup/user.slice/ ingress $ bpftool cgattach pin /bpf/prog /sys/fs/cgroup/user.slice/ ingress Would this make sense? Smaller nits on the coding style: - please try to run checkpatch, perhaps you did, but some people forget tools are in the kernel tree :) - please keep includes in alphabetical order; - please keep variable declarations in functions ordered longest to shortest, if that's impossible because of dependency between initializers - move the initializers to the code. Please also don't forget to update/create new man page. Thanks! :) From 1585498885155684842@xxx Thu Nov 30 13:46:05 +0000 2017 X-GM-THRID: 1585498885155684842 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread