Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5156760rdb; Tue, 12 Dec 2023 23:49:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYEC+0INPbhJUmPnMyp+RlqKp/1MaXWUR4lVbO6HyeCvarlsSRyw4euYa9WVGznjPVXIfU X-Received: by 2002:a9d:74cd:0:b0:6d9:e9b8:75e0 with SMTP id a13-20020a9d74cd000000b006d9e9b875e0mr7008517otl.38.1702453774587; Tue, 12 Dec 2023 23:49:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702453774; cv=pass; d=google.com; s=arc-20160816; b=0ctXw7w/hQdf+47A+1wvL1D+PHFemspq/pRS3fmelLpLthFtdMIWZyE+51PiJhOaiQ QfXOKRe0iNiRMROPmMrxFzB0lq1tn/mvYhXrSxhZUmlZIVS//Gh1G5jcA+F9V0VWTgfg etbsusaHyLrl59QkkZD2NGFACYUa9bsRqH6vEcZkdks8PKn32iG+HBfQZnkTXixi407n tHMz1N8J2SiJu1j5TtHtnWXF8qcVwUEypsAbBVxX6vPLTeF1H8bJsIJCzcpDrx5X9P7R PRh+4n+YzCyU1zuIVTQuUG+vOIpAZGMIkxUoiHEW/wLv1Nf/FNjNSgqQ3AODux/oCt2A ffEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x4EN4hxm4yC3+hbu01w6YOLOueOVafh1vFMtbiyyAlM=; fh=ICzMIW7dZdLK589Np7aDQkBX/055yMw1sqRotnMq7Fg=; b=YR0rCX3AgNA7T/4qguCokK0O4eTnuABJtljiEd+UkODjW9bmjemNxiN7OA0c/BMsdW 1mXG0ZB/EDVKyMp5kK3OD88zwt9cwLs1PPIEfkAVL4ucn922xQ7VOZO9wITdgBK5pnGZ BHkZ0H3VZpwBB88PTVl6Op24wF36g8t+tIZg3aBoYET0NdeHzpDBVcl359TPRzav2gTe TZvquG1izwwCNaIbex8yRHQfmkXJcJvqTE50aUasB0TssSY1Zu/nI+FeNgy/kvW5Xaih +1I4GEMbxIWi8DeuP6aBeMetXBv+P5VgmzrXguMyh2NrKQ9rQJkKkD1v33O/kM/UNKBb YK0g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=IfxPMc5e; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bz39-20020a056a02062700b005c5e24c7e8csi9530510pgb.414.2023.12.12.23.49.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 23:49:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=IfxPMc5e; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8C2538042B43; Tue, 12 Dec 2023 23:49:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378668AbjLMHtR (ORCPT + 99 others); Wed, 13 Dec 2023 02:49:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233184AbjLMHtQ (ORCPT ); Wed, 13 Dec 2023 02:49:16 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2127.outbound.protection.outlook.com [40.107.243.127]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E44B0D0; Tue, 12 Dec 2023 23:49:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kZYczsKMA1jYFryT7K3AJHeoVjCpI//g8z+Ae71F3uLxUhXxjGvVnUPCieV05nAZ1zugmiRX3WpKphim2+6EYRasDffyHw1bXCo8U7k64SpqK/BTkQeXfrSIy6Bd6VDrT1rmqdcefJP87Rn1gRAw3fBX7bJvegWPK2daaZAwuyoMhpokWT2AbeBv4rS6qBwJzQFjIbJJgl8J/uGemJ1jxLM5x2SXn5POcJnZtVExCMgUbAqjN/0uhrGp/GqW91igODF8EJSwfRUDo4IeoQSQyg4TF0wy+VF29N6nJtOZ2I8aly9ywdpqXbmHlrKyyyX+jb/wuQJ7Ms1YzVzzMdDm5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=x4EN4hxm4yC3+hbu01w6YOLOueOVafh1vFMtbiyyAlM=; b=XwHbI8/5VNECi9s3utDIDNvISeexz71FHyjPtxflvhTN8ooGAHZqTuifSjTjQnetx4EvfJ1ZIzej/UWpXvAL3SG+bBjlvqriRYQkA3sxTKnMHNI323bHJWzaNzlAn6gURRU9bbRlbEfoX7IDbMOCcrjSeB5n0d3BtipHTbx/ctmVwHUF6offz7oPA932czMzrjoGINtmc1MDjPpxyxqy+zSBO5BkshgyTyGKNMzdJLh8QDNQM+g+bjHFghTNMvZOKZkTc7nQLrUsUQEhobRDPBqCH+A3SZ6Wl1lAXWSSg/DUaNZojGVqXjdhildCGbtdiWOzhjQCM3wmfTiJZGSveA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x4EN4hxm4yC3+hbu01w6YOLOueOVafh1vFMtbiyyAlM=; b=IfxPMc5emAfGqmYt9nWbJROAM7j4IecpWQ868AJsW6xu/BNRUOzkyAjZGo2UP53jTDwshQLZEkEPYiRw6JTAz9ll50JtB7aoWSfYB168qIdBmUL0P+UiJPgOHEVtb7fex+zFqGTcYnRqDAZF6zNYcDBr9/oPKeJHkqR4ji5XUfs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from DM6PR13MB3705.namprd13.prod.outlook.com (2603:10b6:5:24c::16) by MN2PR13MB3911.namprd13.prod.outlook.com (2603:10b6:208:268::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Wed, 13 Dec 2023 07:49:18 +0000 Received: from DM6PR13MB3705.namprd13.prod.outlook.com ([fe80::91e8:b139:26e3:f374]) by DM6PR13MB3705.namprd13.prod.outlook.com ([fe80::91e8:b139:26e3:f374%3]) with mapi id 15.20.7091.022; Wed, 13 Dec 2023 07:49:18 +0000 From: Yinjun Zhang To: almasrymina@google.com Cc: arnd@arndb.de, bpf@vger.kernel.org, christian.koenig@amd.com, corbet@lwn.net, davem@davemloft.net, dri-devel@lists.freedesktop.org, dsahern@kernel.org, edumazet@google.com, hawk@kernel.org, hramamurthy@google.com, ilias.apalodimas@linaro.org, jeroendb@google.com, kaiyuanz@google.com, kuba@kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org, linyunsheng@huawei.com, netdev@vger.kernel.org, pabeni@redhat.com, pkaligineedi@google.com, shailend@google.com, shakeelb@google.com, shuah@kernel.org, sumit.semwal@linaro.org, willemb@google.com, willemdebruijn.kernel@gmail.com Subject: Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider Date: Wed, 13 Dec 2023 15:49:12 +0800 Message-Id: <20231213074912.1275130-1-yinjun.zhang@corigine.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231208005250.2910004-9-almasrymina@google.com> References: <20231208005250.2910004-9-almasrymina@google.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0038.apcprd02.prod.outlook.com (2603:1096:4:196::22) To DM6PR13MB3705.namprd13.prod.outlook.com (2603:10b6:5:24c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR13MB3705:EE_|MN2PR13MB3911:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ffd81d8-5acf-4e69-b4fb-08dbfbb00298 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u/TFxhMaUPlO9CrG39J2/Pl6caQYn7popi3+XThmNNeawNdL0CA0v6K8IbQrveg5QO2OttFrpymBQ3EAGpFCPya2TUUC+ilE/GRlRL8YWhsFn/Q/OyRAD9VmgVLPWPRq1Rubvxnvep1n8MN9bok1dZr+VLEmmEXIshlHECTefN5W9kmfRycjAiObNWHL9FPbKAQl4xfrI+aceIF7+HTcgUuwu7a2yWd082rQuQGw7/VtKVQpsL3OJ/ZbArJmR3ravSpzeM/Hjnl9bKeJqt9LQFrkxpjqLHva9Obz0eR1wzPCTcY9Y9lI7M9RsPlYrMCXXF7pJUQd5B80dz/ez/lV/Qp9vVbLCkBFosisF6A5y1swNgB+Pgl6Dk9SCwjf4aWxdUQYiHb2QfuSkpHxNDJzuf7qEhVgUqCPiN8XWfD0M0AKJHz5HuncfwDuB1QOR1uuy3Pk/O3cLNKnFd+it8PObbPEzv4x0ntKKd2VA2VEklvoARLs10REkLL0ROboFTTQ4XncgEs11ZLw1W2m5m2t1up3sHnDLNe9/xFVKR44tbM5T+JIf9I9PapZWrjQzCiDsHi3YCEc3tJ7f2wf7LuXkBN3s+tbSYFM6Ixgkeuk2eL/gWenjN5DTWOeCfc65n3eD0Y/+JeWvg20zNSyYugE0rvXzs994jHLmiheHsZOjiM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR13MB3705.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39830400003)(346002)(396003)(376002)(136003)(366004)(230922051799003)(186009)(451199024)(1800799012)(64100799003)(38350700005)(66476007)(66946007)(66556008)(38100700002)(36756003)(86362001)(26005)(83380400001)(1076003)(52116002)(6512007)(6506007)(2616005)(2906002)(7416002)(7406005)(6486002)(6916009)(316002)(478600001)(6666004)(5660300002)(8936002)(8676002)(4326008)(44832011)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?GJH1GrK/kcD+ggAEBKftEI72XHFTrDvAHUiUqPb43B9V6IB/iob6DX4nTInO?= =?us-ascii?Q?H/6eMN1QFQIIL/0Z41eCxtR+S2vlsUVJbHV4avP/VFLsD5o8V0XuaXTa5Aq7?= =?us-ascii?Q?QSD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Fq5uA+Z/xNIw?= =?us-ascii?Q?nPpH3akwGPfNtrZCYDMbEs08U2hfxlg1YleHmb8Z8hVwghXTcyOlVkSIbd6h?= =?us-ascii?Q?6Ol2eMfA7gdjSwUUQ8QPlx5HztwCThIHxO3gl5z/EMOI+HcLzf5khXu+d6ZD?= =?us-ascii?Q?a6ZY1xyOS6NLtgu4tgsDfEswxvA+uPzkJj3bFlxBm5n8nNBobya6jURi8DA+?= =?us-ascii?Q?hObg27au4MDBgQt33AU3HzkPiwM2EEbOzxTpZ7hJOAuZ6Ampzh4wrEMH/wsk?= =?us-ascii?Q?rlGEhaccSyeAH+PvXQxCLJsNO3Tlz3SBrqf21wIgUrjSvcJi8zs3/NDfbss1?= =?us-ascii?Q?xCvC9qMlW6xVeMhaULQ+uetM89CBfJ22M2NyO8fMkBMmhQuV1fYsOLZaowOb?= =?us-ascii?Q?c66aQ15RM3P8mgHUSNQXoIunhY3Y/HJ2rxEvhfCCURad+YCrJA/PRcbmMOoB?= =?us-ascii?Q?/b5VFGqU2v42Ie4PGFce5iBH9SqNApjzPBMuEzN6t77aAwNulddI9Nr2Ctoa?= =?us-ascii?Q?HPyKh9fJIT5T0t9wT/VyVIL3b/unQU4zz/pIJOfsj8O9fgQIiUZd/J1Fd4X/?= =?us-ascii?Q?nEtfa2esrgKAlVjmmx0u6sZnUJW8+T89bFq/FswaTJrpI7731PhLBTKwyDO7?= =?us-ascii?Q?Nw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ffd81d8-5acf-4e69-b4fb-08dbfbb00298 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB3705.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2023 07:49:18.4956 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VJGSBc4CBjl7hFKShRgkL1Xzv/9yW4v4oPFloOwak53LJsK0BMCy1D4Ste8jp4L7nt3qYEm2fgNWgJusDeJGu8VB1BavXe1OIAF4jiqyo+I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3911 X-Spam-Status: No, score=1.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SORTED_RECIPS, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 12 Dec 2023 23:49:31 -0800 (PST) X-Spam-Level: * On Thu, 7 Dec 2023 16:52:39 -0800, Mina Almasry wrote: <...> > +static int mp_dmabuf_devmem_init(struct page_pool *pool) > +{ > + struct netdev_dmabuf_binding *binding = pool->mp_priv; > + > + if (!binding) > + return -EINVAL; > + > + if (!(pool->p.flags & PP_FLAG_DMA_MAP)) > + return -EOPNOTSUPP; > + > + if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV) > + return -EOPNOTSUPP; > + > + netdev_dmabuf_binding_get(binding); > + return 0; > +} > + > +static struct page *mp_dmabuf_devmem_alloc_pages(struct page_pool *pool, > + gfp_t gfp) > +{ > + struct netdev_dmabuf_binding *binding = pool->mp_priv; > + struct page_pool_iov *ppiov; > + > + ppiov = netdev_alloc_dmabuf(binding); Since it only supports one-page allocation, we'd better add a check in `ops->init()` that `pool->p.order` must be 0. > + if (!ppiov) > + return NULL; > + > + ppiov->pp = pool; > + pool->pages_state_hold_cnt++; > + trace_page_pool_state_hold(pool, (struct page *)ppiov, > + pool->pages_state_hold_cnt); > + return (struct page *)((unsigned long)ppiov | PP_IOV); > +} <...>