From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45274 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750800AbeCIJhh (ORCPT ); Fri, 9 Mar 2018 04:37:37 -0500 Date: Fri, 9 Mar 2018 10:37:25 +0100 From: Jesper Dangaard Brouer To: Jason Wang Cc: netdev@vger.kernel.org, =?UTF-8?B?QmrDtnJuVMO2cGVs?= , magnus.karlsson@intel.com, eugenia@mellanox.com, John Fastabend , Eran Ben Elisha , Saeed Mahameed , galp@mellanox.com, Daniel Borkmann , Alexei Starovoitov , Tariq Toukan , brouer@redhat.com Subject: Re: [bpf-next V2 PATCH 10/15] xdp: rhashtable with allocator ID to pointer mapping Message-ID: <20180309103725.234ff988@redhat.com> In-Reply-To: References: <152051439383.7018.11827926732878918934.stgit@firesoul> <152051451209.7018.14564668423312296696.stgit@firesoul> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: netdev-owner@vger.kernel.org List-ID: On Fri, 9 Mar 2018 16:08:58 +0800 Jason Wang wrote: > On 2018年03月08日 21:08, Jesper Dangaard Brouer wrote: > > Use the IDA infrastructure for getting a cyclic increasing ID number, > > that is used for keeping track of each registered allocator per > > RX-queue xdp_rxq_info. Instead of using the IDR infrastructure, which > > uses a radix tree, use a dynamic rhashtable, for creating ID to > > pointer lookup table, because this is faster. > > > > The problem that is being solved here is that, the xdp_rxq_info > > pointer (stored in xdp_buff) cannot be used directly, as the > > guaranteed lifetime is too short. The info is needed on a > > (potentially) remote CPU during DMA-TX completion time . In an > > xdp_frame the xdp_mem_info is stored, when it got converted from an > > xdp_buff, which is sufficient for the simple page refcnt based recycle > > schemes. > > > > For more advanced allocators there is a need to store a pointer to the > > registered allocator. Thus, there is a need to guard the lifetime or > > validity of the allocator pointer, which is done through this > > rhashtable ID map to pointer. The removal and validity of of the > > allocator and helper struct xdp_mem_allocator is guarded by RCU. The > > allocator will be created by the driver, and registered with > > xdp_rxq_info_reg_mem_model(). > > > > It is up-to debate who is responsible for freeing the allocator > > pointer or invoking the allocator destructor function. In any case, > > this must happen via RCU freeing. > > > > Use the IDA infrastructure for getting a cyclic increasing ID number, > > that is used for keeping track of each registered allocator per > > RX-queue xdp_rxq_info. > > > > Signed-off-by: Jesper Dangaard Brouer > > A stupid question is, can we manage to unify this ID with NAPI id? Sorry I don't understand the question? -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer