From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 760C0157465; Tue, 5 Nov 2024 16:30:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.19 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730824217; cv=fail; b=J0XV8R2M87nezDhv2eYseWaCMcTa50o528+hB1zDlVtwhddrGhz6eeR6E2zYaXqVS2F1buaLt+uXUnAAJY0QF20T/YrEmaF8rK/YbcAfOYvuTOs1e4LiTjy+YbNLFRAut/mrsW/H/Yg9JZ+B/G2CgEdl4zqtOQY/nuZMkMQjxrU= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730824217; c=relaxed/simple; bh=MOLUfk3CeFNNWw7GHhWQ1FfJvYBfEz2jpIkjftx68HI=; h=Message-ID:Date:Subject:To:CC:References:From:In-Reply-To: Content-Type:MIME-Version; b=Zmi5vFVBEfIXSY0YDwefTs/82if/vT9/CHEX2fkXdnMSh0XeFWc/1ZVqODgx/9AhWATK48mwkGwV+BMbjhSohaJHFckiy/SdYAPsOvxL34fG2R1JEeXjGPLfeTO9UbvVqBU5bqg9l5DF4rSNuZwY8TshHDc35njQe9a3jfZwTKc= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=K2xPfX0P; arc=fail smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="K2xPfX0P" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730824216; x=1762360216; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=MOLUfk3CeFNNWw7GHhWQ1FfJvYBfEz2jpIkjftx68HI=; b=K2xPfX0PiqOACjcnwJvB6WOVN3nNcq4UwW5TDR3s9vF33KF1wc/P0Aza ocN18/4gRO1zL8gF7OQuEG/JHB8CkcoTI/x0GI9IIwdv5LBe9fC42VGfZ nJfwnp54YxlYzCM3QBi0v07ZWaJYfaKY0hTu7S66PdbHq6XAZW5wnvBiR ZYfYbgT2ZA3c4Opj8DpiI+pua93Lg/gpHuKnGWkRHr13UE0Z45C7UfNgi c/IMcsPfFtUXtQYPG08I+uyR3KF8WBhFSCo10sipvKAh1+50oa44oonIm Y7Gx+a8wfcB7EJWLh+4/LE0RvABwJmGiGd/goVph7GmkEk4pkiN8AIvV3 w==; X-CSE-ConnectionGUID: jo3K35T9TUW6DoQXHigipw== X-CSE-MsgGUID: 835KvinsS1utY/shsx0x0A== X-IronPort-AV: E=McAfee;i="6700,10204,11247"; a="29998524" X-IronPort-AV: E=Sophos;i="6.11,260,1725346800"; d="scan'208";a="29998524" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2024 08:30:06 -0800 X-CSE-ConnectionGUID: 6ZdDbjCpS1WIEiD56eY/tg== X-CSE-MsgGUID: WXM6UvLsRzqReaWa2T8fIg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,260,1725346800"; d="scan'208";a="89215825" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orviesa004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 Nov 2024 08:30:06 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 5 Nov 2024 08:30:05 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Tue, 5 Nov 2024 08:30:05 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.44) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 5 Nov 2024 08:30:05 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FY0HHLJIHs5ciwa7zz1QpUvXPysXM5c/6RX2tP9IFxiF1EslUOKkyo3yMRHXdm8TZz79K7bvkgW/K9ZZMKbPQIq/Or+6XCd83VTpQqTUyX0ZC3L3sc3whafB1ehsCydyAUSwlijYZS4/RIj/rboSpYCDtiRsKfkXswsmFdJK6d903KYf2rnwbp6DYpepRW+A2kTeU9Tbyp06PEOfziJkBDral9my7m6/tXQew+prfOvL29m/QMeYLeMaEcjvA1zXPAJTAFfHfG1Dvf8kQBU4YCQFBES+Bbelgx2trBcsmaFOtukndJlM2Ipzsu7smz4I4NT8oQtKggVHLxzQu1cyOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ocESmNPWeKpBKJslFgey3NacDaMQ7wqRR7l7Xl1fqWU=; b=GCAeBYW3KAX9vztj1vzvp/kOOd5AJRqY+Qghk/Zam6U7bYLcB63ybuEAHEyyZ+4hmII7JNm1h+87JUxb/3xBxwwKni+vdFUdGRgoRdke0iqVpQuC9OKIDUnzP5KJk5/W1Gk0vJatWVS47w/hFoQyU5IShv3tu5goxENcPZefY1YzFARwSssftbgFb66zv25pAZ//FTCOg5ekS+IIsW18Ka/SIPpNOz7HISDSkgsK7HEGnu81w3POrgDxiE3FvEZPMt8NnVzGA9RUDbUgEYHvCUk0Yoceuy/WllaLINY+fdmvCB4/0XsqHMS4O5hHdYuJTZAsqO6ctdQjcxxjt7H2aQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB8718.namprd11.prod.outlook.com (2603:10b6:8:1b9::20) by SA2PR11MB4937.namprd11.prod.outlook.com (2603:10b6:806:118::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Tue, 5 Nov 2024 16:29:54 +0000 Received: from DS0PR11MB8718.namprd11.prod.outlook.com ([fe80::4b3b:9dbe:f68c:d808]) by DS0PR11MB8718.namprd11.prod.outlook.com ([fe80::4b3b:9dbe:f68c:d808%4]) with mapi id 15.20.8114.028; Tue, 5 Nov 2024 16:29:54 +0000 Message-ID: <6d227ee7-68c9-4d81-8efa-c91bbfede750@intel.com> Date: Tue, 5 Nov 2024 17:28:00 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 03/15] net: page_pool: create hooks for custom page providers To: David Wei CC: , , Jens Axboe , Pavel Begunkov , Jakub Kicinski , Paolo Abeni , "David S. Miller" , Eric Dumazet , "Jesper Dangaard Brouer" , David Ahern , Mina Almasry , Stanislav Fomichev , "Joe Damato" , Pedro Tammela References: <20241029230521.2385749-1-dw@davidwei.uk> <20241029230521.2385749-4-dw@davidwei.uk> From: Alexander Lobakin Content-Language: en-US In-Reply-To: <20241029230521.2385749-4-dw@davidwei.uk> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MI2P293CA0014.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:45::13) To DS0PR11MB8718.namprd11.prod.outlook.com (2603:10b6:8:1b9::20) Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB8718:EE_|SA2PR11MB4937:EE_ X-MS-Office365-Filtering-Correlation-Id: bf04af80-0c45-42e8-2e48-08dcfdb71435 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?B?ZlpGUDdMQ3dmTW9HdldEL0p2Y0s3eEZSdEx3SkRZSUZZQ0JlelBCK0wxVWZk?= =?utf-8?B?UlF1ZmF5d05yWUZGdHl5R3Y0dFdwUko0bEpwU1U1R2kwenM1UzZHcEY3Z1Vr?= =?utf-8?B?ZlN4MUdoK1k4Si96ZHFCaWtQOG9qbmtGemF6Vk43RUdOeTVJc204bTdVWUxt?= =?utf-8?B?MGlEbHNCWDcrSVBTbUM3S0x1Qm5vVEJhbTBKZnF5SW83TkxwY0t3RDRlUDdD?= =?utf-8?B?YWVvWjAySWFHNklPaFBrS0p6S1lZSjR3V1pkTVZQSjhUQnNUdVZ3RnpUeTJh?= =?utf-8?B?a0NjZEswL0F5ei8xQW1PZ0lUd3Z5TUxrQys4T2dpSXZuR01UVWNRWGw2MXJG?= =?utf-8?B?dHh2K1MycHFPNjZpaVdaSzZoYmlKemkzSEkwSmY0clczWitVcW9J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NURpNGhHODc0MmNyWVhPckNN?= =?utf-8?B?R1hoNDhFSjF1YmVBNFpvSXVndk54SXlkV0tZY09WclFPRTIreHl2b0h3V0JY?= =?utf-8?B?RzI4d2YzLzVSd2JaYmVINFV5VDVoc3kzQVQrcTJZblFxRi9JYkE2eWlBaGVO?= =?utf-8?B?a1ZpUzYweW40ejh3ZzRiKzNWdjRaSXpKSWpxM01KOVNoWmFOQXI0bjdMc1ls?= =?utf-8?B?L3llVFNiVnNCQWFwQTRHU2JUcVJPZE9jVHBlZjFPQnFyYkZwdURGMjlxYUUv?= =?utf-8?B?TlNlRjN5T0RiNWZOVFdmV1h1ZFo2SGdFRkN2U21aWWJ6cUVFYXZpb2pQdUxX?= =?utf-8?B?YVlLVkVsR2xGMVArcEZlcnp1dGkzRlpnUXZsbGlmKzNnUkZhUWVmRHg0VnhE?= =?utf-8?B?UWx1VldnN21wNEJlYVFDRDZGWlhwK01TTWtQaVhEWGhHMWlXcDBPa0k5WEl1?= =?utf-8?Q?qCnrA2D3yRvHcfJOnubDhscdEP7aJP8aV/4yoYv?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR11MB8718.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?b1ZJWTg5RTVSaDh4YUc5V3l0ZjkrM29XbHpVNHJjMTk3Tm9kcDFnWVYxWS9t?= =?utf-8?B?VE9jQUxlNU9EWDRHanlXMHpCZUVtaFpsUFlHY1lJQ1U3ZVpFWjgweUxaQTRL?= =?utf-8?B?ZGh6Y3BxNWJBRTdadkZ4QnE5R3lzRjhINXJVRmZrUTN5TVVuU1RNYWZpZ0lC?= =?utf-8?B?ZVZLTjNkTDFDSkJCbnZzbTNVNm5yWm5RSktZ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B?YjNRZWRBb2x4S1FrVmx4TWUzMml0OUx3UFN0SElJUENEc2ozc3lmUVh5RnpK?= =?utf-8?B?U1Bhb0hQWjVNNmtKbllJVEYxVzZ6ZElETnNZazhaVy82Q0s5NmxRbHVndkx2?= =?utf-8?B?Z3cwaWtDajZiK2E5NGMvSDVONzcwcWp6NnR4VjZIQ2J5bmZ5V1dRNHVJU0gr?= =?utf-8?B?cGc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: bf04af80-0c45-42e8-2e48-08dcfdb71435 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB8718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2024 16:29:54.2340 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SUdi5RABV5sHkE8fgJkQq6CWfDkCEBYIiFjUyILSzf2hwFvxoqkNmhlF2nO2HQzkHLjs0F+LErMBi+nSxN0STGFcHvuF9r7qk0+KHB9Z3ek= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB4937 X-OriginatorOrg: intel.com From: David Wei Date: Tue, 29 Oct 2024 16:05:06 -0700 > From: Jakub Kicinski > > The page providers which try to reuse the same pages will > need to hold onto the ref, even if page gets released from > the pool - as in releasing the page from the pp just transfers > the "ownership" reference from pp to the provider, and provider > will wait for other references to be gone before feeding this > page back into the pool. > > Signed-off-by: Jakub Kicinski > [Pavel] Rebased, renamed callback, +converted devmem > Signed-off-by: Pavel Begunkov > Signed-off-by: David Wei > --- > include/net/page_pool/types.h | 9 +++++++++ > net/core/devmem.c | 14 +++++++++++++- > net/core/page_pool.c | 17 +++++++++-------- > 3 files changed, 31 insertions(+), 9 deletions(-) > > diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h > index c022c410abe3..8a35fe474adb 100644 > --- a/include/net/page_pool/types.h > +++ b/include/net/page_pool/types.h > @@ -152,8 +152,16 @@ struct page_pool_stats { > */ > #define PAGE_POOL_FRAG_GROUP_ALIGN (4 * sizeof(long)) > > +struct memory_provider_ops { > + netmem_ref (*alloc_netmems)(struct page_pool *pool, gfp_t gfp); > + bool (*release_netmem)(struct page_pool *pool, netmem_ref netmem); > + int (*init)(struct page_pool *pool); > + void (*destroy)(struct page_pool *pool); > +}; > + > struct pp_memory_provider_params { > void *mp_priv; > + const struct memory_provider_ops *mp_ops; > }; > > struct page_pool { > @@ -215,6 +223,7 @@ struct page_pool { > struct ptr_ring ring; > > void *mp_priv; > + const struct memory_provider_ops *mp_ops; > > #ifdef CONFIG_PAGE_POOL_STATS > /* recycle stats are per-cpu to avoid locking */ > diff --git a/net/core/devmem.c b/net/core/devmem.c > index 5c10cf0e2a18..01738029e35c 100644 > --- a/net/core/devmem.c > +++ b/net/core/devmem.c > @@ -26,6 +26,8 @@ > /* Protected by rtnl_lock() */ > static DEFINE_XARRAY_FLAGS(net_devmem_dmabuf_bindings, XA_FLAGS_ALLOC1); > > +static const struct memory_provider_ops dmabuf_devmem_ops; > + > static void net_devmem_dmabuf_free_chunk_owner(struct gen_pool *genpool, > struct gen_pool_chunk *chunk, > void *not_used) > @@ -117,6 +119,7 @@ void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding) > WARN_ON(rxq->mp_params.mp_priv != binding); > > rxq->mp_params.mp_priv = NULL; > + rxq->mp_params.mp_ops = NULL; > > rxq_idx = get_netdev_rx_queue_index(rxq); > > @@ -142,7 +145,7 @@ int net_devmem_bind_dmabuf_to_queue(struct net_device *dev, u32 rxq_idx, > } > > rxq = __netif_get_rx_queue(dev, rxq_idx); > - if (rxq->mp_params.mp_priv) { > + if (rxq->mp_params.mp_ops) { > NL_SET_ERR_MSG(extack, "designated queue already memory provider bound"); > return -EEXIST; > } > @@ -160,6 +163,7 @@ int net_devmem_bind_dmabuf_to_queue(struct net_device *dev, u32 rxq_idx, > return err; > > rxq->mp_params.mp_priv = binding; > + rxq->mp_params.mp_ops = &dmabuf_devmem_ops; > > err = netdev_rx_queue_restart(dev, rxq_idx); > if (err) > @@ -169,6 +173,7 @@ int net_devmem_bind_dmabuf_to_queue(struct net_device *dev, u32 rxq_idx, > > err_xa_erase: > rxq->mp_params.mp_priv = NULL; > + rxq->mp_params.mp_ops = NULL; > xa_erase(&binding->bound_rxqs, xa_idx); > > return err; > @@ -388,3 +393,10 @@ bool mp_dmabuf_devmem_release_page(struct page_pool *pool, netmem_ref netmem) > /* We don't want the page pool put_page()ing our net_iovs. */ > return false; > } > + > +static const struct memory_provider_ops dmabuf_devmem_ops = { > + .init = mp_dmabuf_devmem_init, > + .destroy = mp_dmabuf_devmem_destroy, > + .alloc_netmems = mp_dmabuf_devmem_alloc_netmems, > + .release_netmem = mp_dmabuf_devmem_release_page, > +}; > diff --git a/net/core/page_pool.c b/net/core/page_pool.c > index a813d30d2135..c21c5b9edc68 100644 > --- a/net/core/page_pool.c > +++ b/net/core/page_pool.c > @@ -284,10 +284,11 @@ static int page_pool_init(struct page_pool *pool, > rxq = __netif_get_rx_queue(pool->slow.netdev, > pool->slow.queue_idx); > pool->mp_priv = rxq->mp_params.mp_priv; > + pool->mp_ops = rxq->mp_params.mp_ops; > } > > - if (pool->mp_priv) { > - err = mp_dmabuf_devmem_init(pool); > + if (pool->mp_ops) { > + err = pool->mp_ops->init(pool); Can't we just switch-case instead of indirect calls? IO_URING is bool, it can't be a module, which means its functions will be available here when it's enabled. These ops are easy to predict (no ops, dmabuf, io_uring), so this really looks like an enum with 3 entries + switch-case ("regular" path is out if this switch-case under likely etc). > if (err) { > pr_warn("%s() mem-provider init failed %d\n", __func__, > err); > @@ -584,8 +585,8 @@ netmem_ref page_pool_alloc_netmem(struct page_pool *pool, gfp_t gfp) > return netmem; Thanks, Olek