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=-6.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_PASS,URIBL_BLOCKED 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 AC41EC282C2 for ; Thu, 7 Feb 2019 07:48:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8666D218B0 for ; Thu, 7 Feb 2019 07:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726781AbfBGHs3 (ORCPT ); Thu, 7 Feb 2019 02:48:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52848 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726707AbfBGHs2 (ORCPT ); Thu, 7 Feb 2019 02:48:28 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EBE493DE0E; Thu, 7 Feb 2019 07:48:27 +0000 (UTC) Received: from carbon (ovpn-200-42.brq.redhat.com [10.40.200.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC4A0BA4D; Thu, 7 Feb 2019 07:48:16 +0000 (UTC) Date: Thu, 7 Feb 2019 08:48:15 +0100 From: Jesper Dangaard Brouer To: Saeed Mahameed Cc: "dsahern@gmail.com" , Toke =?UTF-8?B?SMO4aWxhbmQt?= =?UTF-8?B?SsO4cmdlbnNlbg==?= , "hawk@kernel.org" , "virtualization@lists.linux-foundation.org" , "borkmann@iogearbox.net" , Tariq Toukan , "john.fastabend@gmail.com" , "mst@redhat.com" , "jakub.kicinski@netronome.com" , "netdev@vger.kernel.org" , "jasowang@redhat.com" , "davem@davemloft.net" , "makita.toshiaki@lab.ntt.co.jp" , brouer@redhat.com, Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= Subject: Resource management for ndo_xdp_xmit (Was: [PATCH net] virtio_net: Account for tx bytes and packets on sending xdp_frames) Message-ID: <20190207084815.1e8bd817@carbon> In-Reply-To: <140ecbe1e25f54f90d859cc696c4119aa96bc6eb.camel@mellanox.com> References: <1548934830-2389-1-git-send-email-makita.toshiaki@lab.ntt.co.jp> <20190131101516-mutt-send-email-mst@kernel.org> <20190131.094523.2248120325911339180.davem@davemloft.net> <20190131211555.3b15c81f@carbon> <20190204125307.08492005@redhat.com> <140ecbe1e25f54f90d859cc696c4119aa96bc6eb.camel@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 07 Feb 2019 07:48:28 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 6 Feb 2019 00:06:33 +0000 Saeed Mahameed wrote: > On Mon, 2019-02-04 at 19:13 -0800, David Ahern wrote: [...] > > > > mlx5 needs some work. As I recall it still has the bug/panic > > removing xdp programs - at least I don't recall seeing a patch for > > it. > > Only when xdp_redirect to mlx5, and removing the program while > redirect is happening, this is actually due to a lack of > synchronization means between different drivers, we have some ideas > to overcome this using a standard XDP API, or just use a hack in mlx5 > driver which i don't like: > > https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git/commit/?h=topic/xdp-redirect-fix&id=a3652d03cc35fd3ad62744986c8ccaca74c9f20c > > I will be working on this towards the end of this week. Toke and I have been discussing how to solve this. The main idea for fixing this is to tie resource allocation to interface insertion into interface maps (kernel/bpf/devmap.c). As the =devmap= already have the needed synchronisation mechanisms and steps for safely adding and removing =net_devices= (e.g. stopping RX side, flushing remaining frames, waiting RCU period before freeing objects, etc.) As described here: https://github.com/xdp-project/xdp-project/blob/master/xdp-project.org#better-ndo_xdp_xmit-resource-management --Jesper