From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58476 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751086AbeCINHo (ORCPT ); Fri, 9 Mar 2018 08:07:44 -0500 Subject: Re: [bpf-next V2 PATCH 10/15] xdp: rhashtable with allocator ID to pointer mapping To: Jesper Dangaard Brouer 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 References: <152051439383.7018.11827926732878918934.stgit@firesoul> <152051451209.7018.14564668423312296696.stgit@firesoul> <20180309103725.234ff988@redhat.com> From: Jason Wang Message-ID: <14397dda-c469-f8bd-a1fb-fe8cc6c28e82@redhat.com> Date: Fri, 9 Mar 2018 21:07:36 +0800 MIME-Version: 1.0 In-Reply-To: <20180309103725.234ff988@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 2018年03月09日 17:37, Jesper Dangaard Brouer wrote: > 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? I mean can we associate page poll pointer to napi_struct, record NAPI id in xdp_mem_info and do lookup through NAPI id? Thanks