From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E994C282D8 for ; Fri, 1 Feb 2019 21:23:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EADD12146E for ; Fri, 1 Feb 2019 21:23:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726297AbfBAVXt (ORCPT ); Fri, 1 Feb 2019 16:23:49 -0500 Received: from www62.your-server.de ([213.133.104.62]:38386 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725797AbfBAVXs (ORCPT ); Fri, 1 Feb 2019 16:23:48 -0500 Received: from [78.46.172.3] (helo=sslproxy06.your-server.de) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1gpgHq-00082g-8k; Fri, 01 Feb 2019 22:23:46 +0100 Received: from [178.197.249.18] (helo=linux.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1gpgHq-000BRE-2l; Fri, 01 Feb 2019 22:23:46 +0100 Subject: Re: [PATCH bpf-next v5 0/8] xdp: Avoid unloading xdp prog not attached by sample To: Maciej Fijalkowski , ast@kernel.org Cc: netdev@vger.kernel.org, jakub.kicinski@netronome.com, brouer@redhat.com, john.fastabend@gmail.com References: <20190201001954.4130-1-maciej.fijalkowski@intel.com> From: Daniel Borkmann Message-ID: <1221854d-a2ad-cc03-8e72-985a265c49c9@iogearbox.net> Date: Fri, 1 Feb 2019 22:23:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20190201001954.4130-1-maciej.fijalkowski@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.100.2/25347/Fri Feb 1 12:05:35 2019) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 02/01/2019 01:19 AM, Maciej Fijalkowski wrote: > Hi! > This patchset tries to address the situation where: > * user loads a particular xdp sample application that does stats polling > * user loads another sample application on the same interface > * then, user sends SIGINT/SIGTERM to the app that was attached as a first one > * second application ends up with an unloaded xdp program > > 1st patch contains a helper libbpf function for getting the map fd by a > given map name. > In patch 2 Jesper removes the read_trace_pipe usage from xdp_redirect_cpu which > was a blocker for converting this sample to libbpf usage. > 3rd patch updates a bunch of xdp samples to make the use of libbpf. > Patch 4 adjusts RLIMIT_MEMLOCK for two samples touched in this patchset. > In patch 5 extack messages are added for cases where dev_change_xdp_fd returns > with an error so user has an idea what was the reason for not attaching the > xdp program onto interface. > Patch 6 makes the samples behavior similar to what iproute2 does when loading > xdp prog - the "force" flag is introduced. > Patch 7 introduces the libbpf function that will query the driver from > userspace about the currently attached xdp prog id. > > Use it in samples that do polling by checking the prog id in signal handler > and comparing it with previously stored one which is the scope of patch 8. > > Thanks! > > v1->v2: > * add a libbpf helper for getting a prog via relative index > * include xdp_redirect_cpu into conversion > > v2->v3: mostly addressing Daniel's/Jesper's comments > * get rid of the helper from v1->v2 > * feed the xdp_redirect_cpu with program name instead of number > > v3->v4: > * fix help message in xdp_sample_pkts > > v4->v5: > * in get_link_xdp_fd, assign prog_id only when libbpf_nl_get_link returned > with 0 > * add extack messages in dev_change_xdp_fd > * check the return value of bpf_get_link_xdp_id when exiting from sample progs Series looks good to me, but doesn't apply cleanly, please rebase. Thanks, Daniel