Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp406783rdb; Tue, 16 Jan 2024 04:16:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSv1CesQa7+PI7EttOtX+8cc3SYHl8aBj1T34eV9ByfbOQw/eqbztRiYsUKwKQGpM+jbtA X-Received: by 2002:ac2:4157:0:b0:50e:7bbb:55c with SMTP id c23-20020ac24157000000b0050e7bbb055cmr2643853lfi.139.1705407391816; Tue, 16 Jan 2024 04:16:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705407391; cv=pass; d=google.com; s=arc-20160816; b=s0mJtmrsG10knrYnfvEyXBrA6Hj5Pq1Pc7gKy/KT8kswO8d4Qt+adp0qE8KsaCziMu HnCWl7ZPLHhZUSKF7hPXu5D1jTg8ygfKVh3xdIiRLWj1keKckXHfiFwsIgVOibd9CEZj nBK+nC8sNDRxWg5bomtKj1CEDJkoB8GrAvPaUfCLzEd1FfeE7Hxw38MU10WAtYb2ZuV9 oVmE/+EVcM6uiXpd9UVMS6PEFaHlZkkma2LRYF7a8CsTnXqTGmNzZXNE2E8K9WBq4SYJ 9BhuGP7ES+KmdyCYZTAEuaJby3mF7RpT6UdzTPoF0FKJZyx2YrrMlgJnTEmAKh72W5hm lZfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :in-reply-to:content-disposition:references:message-id:subject:cc:to :from:date:dkim-signature; bh=GAf+5D1fu/XTFqXZW1ylZ/gCZcvqn5DY65aBXODH4Y0=; fh=SqAZylkvA30wLWcmZdPG86BfFYZDuuLa55m0zjeB6Mw=; b=0LjNfzZdGesHmaTpDQ2kQx484mdVl1s9uklcrF36tiZ9swy04T8o4D4WGqvApbmFL2 XSO6X097L7XLBTzWKE0gPfS16NBVpiboQawwcr9+ddXc5bpLvyKAhU6FgoupNALnkRr7 GbhMezDh8UF31xk+DiSqf1vtn1e8PdvN/oZChGjIxVAwUq9AdZXWGowpyqWsJiM6OzIu G4lkaEmn2eApOPRV1/NTW2OPZC6bQq8Unbyhbhfoy9kJiAsiigzwMLFNEoqdYWlgcM9O wn7gS5u6W0fhMFPIKZ7/0eUG1TieiMH8QgqFnN9+e7D32UAPKFteteeg/RRJZHpCHC+q Ixaw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Th8sIBBv; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel+bounces-27369-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27369-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w6-20020a170906384600b00a2ea0703d64si19731ejc.174.2024.01.16.04.16.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 04:16:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27369-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Th8sIBBv; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel+bounces-27369-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27369-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6374E1F23C58 for ; Tue, 16 Jan 2024 12:16:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C672D1BC28; Tue, 16 Jan 2024 12:16:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Th8sIBBv" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2058.outbound.protection.outlook.com [40.107.237.58]) (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 503081B944; Tue, 16 Jan 2024 12:16:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=USXYMK5iWpQPOjR7H61oyqU4mlKuiFCRUjKczijWV2Xv9gUR4WSS7UaoVUzFnez/HDlQvobWuTz8u/3t0qY2SqL6ujAmYtTcM06CdJtE4B8tAF6mkmuypz+LXmni146IScecTlz7d0wAUbCTWBvT+xUL7Sj2iCuqWVK7etILk8zSJ5N9WTPbZgu798wSznn9ZlmMxs5yaBTAT2M91CGL4atbgiD/yiRGYu4OXpfQNUjhk/lxyj8xuFbarKreCvDgnDXmlWB0YwkBKh72qPutgXlbrIKpcTGvrrMfXzwyZrgQkXIIxYjEZY/q3iRHkt6v11zmrCeVzdEhH/Fkqp28pA== 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=GAf+5D1fu/XTFqXZW1ylZ/gCZcvqn5DY65aBXODH4Y0=; b=OFTrzyFtV0OBuYpdPlcFkrPOeHRlr/sdet1aY+w6uIMcpD5uRu7LO0NGuKrSuTmmSocObmgSxiqUwGkvfD7Z4TiZ2kLqdAnTL8JlVOrO6HqBsXdslNK7jOfKIEtW3S8vC/4KFF+PUTzSYptDe0DbWIf9yJP3rtOnObj+lAzLDmAX+rFRlVQDCM6+/Zthu5t1H3FduG5XHBMSb3S+84TRMASQObysowVXD0s+O2ZikdXYakpddEEyDXAr9WwIC+4qJLaT3BFU9AsOB3wCl0RFC+Okd/L38JphkXn5yL1qNQ6naSAepkaM5VMdW1isNrnKIVD2bqOJMu9i7yCtmEABIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GAf+5D1fu/XTFqXZW1ylZ/gCZcvqn5DY65aBXODH4Y0=; b=Th8sIBBvfGJu1zEEgzRTkwXpKbXTYrKyBSv2eqi9U+NwQwwhrCQEFaqqTVowhgsIj2iyiv5c7+CK0+WF+j0inua/ld5O+4m1tiMU9lQgHY/A0cVZ1+wkjMX/GAevWzq5spNHtYxtGmDMrWE/Qb45V/ZArPXpqwr85IsPY2rCV0T+Qm+y9GxK07rw7c+qoc40BwOjQV6OF2s5as3ks2pFkB/vH5ODWUJwAo6JyBqxD7uxidJvXGDbopJAHysm7VQ5/rM4CMAcCtyk/O51LN1W6gYTxAfYF4hRwKOSO6eyuC7SuXZ2F3LZtr7SgFoBulUiZrOON0Pu4BiQwnxCfGJwkw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by CY5PR12MB6526.namprd12.prod.outlook.com (2603:10b6:930:31::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.18; Tue, 16 Jan 2024 12:16:12 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::96dd:1160:6472:9873%6]) with mapi id 15.20.7181.020; Tue, 16 Jan 2024 12:16:12 +0000 Date: Tue, 16 Jan 2024 08:16:11 -0400 From: Jason Gunthorpe To: Yunsheng Lin Cc: Mina Almasry , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Christian =?utf-8?B?S8O2bmln?= , Shakeel Butt , Willem de Bruijn Subject: Re: [RFC PATCH net-next v5 2/2] net: add netmem to skb_frag_t Message-ID: <20240116121611.GY734935@nvidia.com> References: <20240109011455.1061529-1-almasrymina@google.com> <20240109011455.1061529-3-almasrymina@google.com> <5219f2cd-6854-0134-560d-8ae3f363b53f@huawei.com> <0711845b-c435-251f-0bbc-20b243721c06@huawei.com> <66bc7b8f-51b6-0d9e-db5b-47e7ee5e9029@huawei.com> <20240116000129.GX734935@nvidia.com> <9c1a6725-c4c3-2bb1-344f-5e71f8ce7e63@huawei.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9c1a6725-c4c3-2bb1-344f-5e71f8ce7e63@huawei.com> X-ClientProxiedBy: BLAPR03CA0123.namprd03.prod.outlook.com (2603:10b6:208:32e::8) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|CY5PR12MB6526:EE_ X-MS-Office365-Filtering-Correlation-Id: ce765626-33cd-4943-dd57-08dc168cedeb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h7IcwKden+yL1d6GEb6PXSNCkY2vAjNTXYZOUri0QLsIrDumpWZMxKOs0g4aiYLdvG1XwusMP0E4+Ksx26pu/dJaZfVli2UzT7pYq3bigBK74xwCJXdeZ/Gwqey4ng/6XsmnTISNmi2C+RItgX4E0439UY8qDXCf9NuWSPO79O74c+SGtQ/e0kZJeinzDz8LInSApDZ3pK2G3seObk68hsGFDvTDJXHPDyxnzP+632orBM38dmJ+0Aj5nfn31GfuF9cHvkZfdJnXENtuLUF9pvdz5jJsEn/SIHKWW8NY9TweFjYCtwH/5DyeUccXDopEj6VJClTAB6v1wq9w9uhPQaA3j1rXMaX0AQVhe50DySMq1b5z33RDxvAFQwHa1jKZzqm0ukKQbYkxRcUJoThk2HHjhmqlUnK1A1odiKb40iJnXUxo9N9p1/mAA+xMJ/2J87Ksy12jHTeZVX0Z2B8d2qXg0i+Cj8lz4QL1YMaCkmcg8FIo8gOD5uHTjxNgclaaUbWAvzVQqZeujB4oDhpDy9SpAeN4ozdmACsUagEJ4xq/BOidNNKYNid61Auz/sjIpjtfCz0vL69cmYCSPYVkKrYiFVjl8SH/oKM4LgyFThpsO+ocWtuHV/h51G2tTvt+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(376002)(136003)(346002)(366004)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(6506007)(33656002)(53546011)(26005)(2616005)(478600001)(1076003)(6512007)(5660300002)(38100700002)(86362001)(36756003)(41300700001)(66946007)(83380400001)(7416002)(2906002)(4326008)(8936002)(66556008)(6916009)(6486002)(316002)(66476007)(54906003)(8676002)(27376004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8ybCN4ESvJEolQQM1MBMWaVR5ASfu1Ume5ANDojGflElDbx1qfvs79QhjHKX?= =?us-ascii?Q?8cp1aXqhZWj74Gyi7utjiJ5onF2zsPzqsplPsPwaJm9H8SEFpgFh/3BiKfp1?= =?us-ascii?Q?K7uvTpY9Y9/Atd8CvWxRTOppUotdMsHJBmdfdGu7m3mGFbzv5NnXiKKrRjLX?= =?us-ascii?Q?yEpQeDeoe0LfcqD8LkIajfW0vmG4nwk890mCErXmUsAJ4OS5kKKw0E0s2CVf?= =?us-ascii?Q?bvIkqlSKcupq69x71nIIRB8LP+4r+A10muSwPH0PUvxlSF4e1sgVsRo37oFp?= =?us-ascii?Q?bizJuef2j8awT2IZN76ApshdQauMOGA9FWpUHu7YAG2dfvcwjaZuMKWz+7Kb?= =?us-ascii?Q?LUUkCruqqmyKjW4A8frY08SxNSFH7znIvNEPy6y1N4yydKHhaRaVn3Cr+8JX?= =?us-ascii?Q?9c63VvMfXFeNePzKuj+8MBvtesKffEbkcd6agVC0UVp9s2dj9uGPVDJLihnz?= =?us-ascii?Q?zFWinxMuZtm1dE0SNNL9oeP7R7XbKLk589TiJDM8wXVSCUmzPB8ybr1Q1iJ3?= =?us-ascii?Q?I3qFg5VjHYJdIOq3igscSPj9bZxJyDSBF9bnr35pfowcZrBp0SgbQSBcGWBY?= =?us-ascii?Q?PGFWg/0/YcevayMJrs9+S8wG36OBVc2lZp+QHClzgPJWIgmLlJ767gJ2bgpH?= =?us-ascii?Q?UvnuelfdGAFCbYHCUQIJsVj95LdAbgyQRJZEBPDUUQzwsfKCBa+ZVkXup9nE?= =?us-ascii?Q?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i2L3?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce765626-33cd-4943-dd57-08dc168cedeb X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2024 12:16:12.3779 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ysi1jYzSFjReI6xHC3WF9P0WOadl2nzklmfE4uO06bOSGUahImeK3/Kk6lhGGZlL X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6526 On Tue, Jan 16, 2024 at 07:04:13PM +0800, Yunsheng Lin wrote: > On 2024/1/16 8:01, Jason Gunthorpe wrote: > > On Mon, Jan 15, 2024 at 03:23:33PM -0800, Mina Almasry wrote: > >>>> You did not answer my question that I asked here, and ignoring this > >>>> question is preventing us from making any forward progress on this > >>>> discussion. What do you expect or want skb_frag_page() to do when > >>>> there is no page in the frag? > >>> > >>> I would expect it to do nothing. > >> > >> I don't understand. skb_frag_page() with an empty implementation just > >> results in a compiler error as the function needs to return a page > >> pointer. Do you actually expect skb_frag_page() to unconditionally > >> cast frag->netmem to a page pointer? That was explained as > >> unacceptable over and over again by Jason and Christian as it risks > >> casting devmem to page; completely unacceptable and will get nacked. > >> Do you have a suggestion of what skb_frag_page() should do that will > >> not get nacked by mm? > > > > WARN_ON and return NULL seems reasonable? > > While I am agreed that it may be a nightmare to debug the case of passing > a false page into the mm system, but I am not sure what's the point of > returning NULL to caller if the caller is not expecting or handling > the You have to return something and NULL will largely reliably crash the thread. The WARN_ON explains in detail why your thread just crashed. > NULL returning[for example, most of mm API called by the networking does not > seems to handling NULL as input page], isn't the NULL returning will make > the kernel panic anyway? Doesn't it make more sense to just add a BUG_ON() > depending on some configuration like CONFIG_DEBUG_NET or CONFIG_DEVMEM? > As returning NULL seems to be causing a confusion for the caller of > skb_frag_page() as whether to or how to handle the NULL returning case. Possibly, though Linus doesn't like BUG_ON on principle.. I think the bigger challenge is convincing people that this devmem stuff doesn't just open a bunch of holes in the kernel where userspace can crash it. The fact you all are debating what to do with skb_frag_page() suggests to me there isn't confidence... Jason