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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3489FC001DC for ; Sun, 16 Jul 2023 23:57:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F9C410E0A5; Sun, 16 Jul 2023 23:57:18 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 15C1310E0A5 for ; Sun, 16 Jul 2023 23:57:15 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D96C260EE2; Sun, 16 Jul 2023 23:57:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78F19C433C7; Sun, 16 Jul 2023 23:57:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689551833; bh=+2BhqY9zrhKuYyQ9etJS5H8r5edL7fVLVmdomTcsJy0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=TBFRNmShB+QtUymfhfsuzlj3mrAUiU+5Hg+ldphDuktGwVKO+KxXQagpUkGBQJbWl hXyeF+Rfg6ewUcNhDMsuBvqcdWqvqawpVMD6yWImZiyxQtdvTYWzL+kMpw5xzqpRhG zeXaT0cOS+lRpVDZ6s045vluNNr6NG8cNDQ0AcffxOFmBiEOaCwDgVYYnRJ3T4sqWQ wzLuT7zwBFRFCBLF6Pt82BWVaS82xTXICHEGNuTljfml0iqwe6rpTBHVuINaJ0uP2a 1u6ABa3DonIrUNt5odDi+lmA05AzQN6US36BEfW0zBjuLP3/0xlzgySFmJCGVXiatb uc5uAgsCg/N8w== Message-ID: <73971895-6fa7-a5e1-542d-3faccbc4a830@kernel.org> Date: Sun, 16 Jul 2023 16:57:07 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [RFC PATCH 06/10] net: add SO_DEVMEM_DONTNEED setsockopt to release RX pages Content-Language: en-US To: Mina Almasry , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, netdev@vger.kernel.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20230710223304.1174642-1-almasrymina@google.com> <20230710223304.1174642-7-almasrymina@google.com> From: Andy Lutomirski In-Reply-To: <20230710223304.1174642-7-almasrymina@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Willem de Bruijn , Jesper Dangaard Brouer , Arnd Bergmann , =?UTF-8?Q?Christian_K=c3=b6nig?= , David Ahern , Ilias Apalodimas , Sumit Semwal , jgg@ziepe.ca, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , "David S. Miller" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 7/10/23 15:32, Mina Almasry wrote: > Add an interface for the user to notify the kernel that it is done reading > the NET_RX dmabuf pages returned as cmsg. The kernel will drop the > reference on the NET_RX pages to make them available for re-use. > > Signed-off-by: Mina Almasry > --- > + for (i = 0; i < num_tokens; i++) { > + for (j = 0; j < tokens[i].token_count; j++) { > + struct page *pg = xa_erase(&sk->sk_pagepool, > + tokens[i].token_start + j); > + > + if (pg) > + put_page(pg); > + else > + /* -EINTR here notifies the userspace > + * that not all tokens passed to it have > + * been freed. > + */ > + ret = -EINTR; Unless I'm missing something, this type of error reporting is unrecoverable -- userspace doesn't know how many tokens have been freed. I think you should either make it explicitly unrecoverable (somehow shut down dmabuf handling entirely) or tell userspace how many tokens were successfully freed. --Andy