From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B88D1C4332F for ; Wed, 8 Nov 2023 11:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344403AbjKHL0T (ORCPT ); Wed, 8 Nov 2023 06:26:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344373AbjKHLZ4 (ORCPT ); Wed, 8 Nov 2023 06:25:56 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 338D01BFA; Wed, 8 Nov 2023 03:25:54 -0800 (PST) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SQN3h1ypLzrTq2; Wed, 8 Nov 2023 19:22:40 +0800 (CST) Received: from [10.69.30.204] (10.69.30.204) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 8 Nov 2023 19:25:17 +0800 Subject: Re: [RFC PATCH v3 08/12] net: support non paged skb frags To: Mina Almasry CC: , , , , , , , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesper Dangaard Brouer , Ilias Apalodimas , Arnd Bergmann , David Ahern , Willem de Bruijn , Shuah Khan , Sumit Semwal , =?UTF-8?Q?Christian_K=c3=b6nig?= , Shakeel Butt , Jeroen de Borst , Praveen Kaligineedi References: <20231106024413.2801438-1-almasrymina@google.com> <20231106024413.2801438-9-almasrymina@google.com> <7e851882-9a85-3672-c3d5-73b47599873c@huawei.com> From: Yunsheng Lin Message-ID: Date: Wed, 8 Nov 2023 19:25:16 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/11/8 5:19, Mina Almasry wrote: >> >> > > My personal immediate reaction is that this may just introduce code > churn without significant benefit. If an unsuspecting caller call > skb_frag_page() on devmem frag and doesn't correctly handle NULL > return, it will crash or error out anyway, and likely in some obvious > way, so maybe the BUG_ON() isn't so useful that it's worth changing If it will always crash or error out, then I agree that BUG_ON() is unnecessary. > all the call sites. But if there is consensus on adding a change like > you propose, I have no problem adding it. One obvious benefit I forget to mention is that, it provides a better semantic that if a caller need to do the return checking: 1. For the old helper, the semantic is not to do the checking if the caller has ensure that it has passed a readable frag to skb_frag_page(), which avoid adding some overhead for non-devmen supported drivers. 2. For the new helper, the semantic is to do the checking and we may provide a compiler '__must_check' function-attribute to ensure the caller to do the checking. >