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 ED4FBC3DA7F for ; Tue, 13 Aug 2024 02:30:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FE8610E186; Tue, 13 Aug 2024 02:30:49 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GjnNYJCR"; dkim-atps=neutral Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id D0AC910E1F4 for ; Tue, 13 Aug 2024 02:30:47 +0000 (UTC) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-428163f7635so39103825e9.2 for ; Mon, 12 Aug 2024 19:30:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723516246; x=1724121046; darn=lists.freedesktop.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=XKrMThMFjWs/aD3lNtT8IXEfZvkhz9Tsh1qYW/MU/qc=; b=GjnNYJCRFU1vKMuEY1Q4We9U4ci95Zl27M5RtfaMg8vcYee7oPscHvht59S3Cmg+/Y FR3RGxsWeE4pktySrJZC/W29f9rzBawf31Kj6dYHJbfz3YsvgVGgExukBcSCySJ46S5l Lw/V7VVwYY677sHeRSYtC67ENDVrrXjujN8CKwvK6z9fl2uGYn7cXFaYNt6F8VH13NEe /GYa2oEkvQUHUW2f1waYplMxXaKlm4hp0fE7vnYPEZ/lqR3KGJWg9GSAO4mZp3UXwmml hKJDnNPvSMXG0qGOzBH+dpMFTsz3ZMwCg6uvbFJpsmlvmKcFOrdQqlKCrw9xu3PYxSzD wyGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723516246; x=1724121046; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XKrMThMFjWs/aD3lNtT8IXEfZvkhz9Tsh1qYW/MU/qc=; b=OTl/pOz8aXa3cIyU+zQpKVMvJAq5RX7rRHqEwhcHayBUxj9NRjVfq1Tg/2+0IxPP3u PFESc8gJ7+d0Z+rrq5brfMIO3qcEci4y+VroTUnSx1HV88TbDPA23+nZEta3bZ0il2TM BYKffEFJgysDMY+49hGFaZCiNdyriZcWuXiDElNMg+NkTRVcvIT/rQ7+JTTEi5ZmieVU mNFuyIFV2xouHl74S0Sa7W+n+ztOhlIoVpPnbVlaoHzZ/0V5ZHPtrAiaXtZTXkETLrxV loWzsECCIQ4gsiyyknELMLC/D76i1Ri0orkZnUTT2ftdfMPtB32HgHCXlhr2+Wwcqvdb wpiQ== X-Forwarded-Encrypted: i=1; AJvYcCW6WynzM7VRkuWSuxuPto88j+Mh/+UTcCNaZXOt/Ob3n43kzluqR/5UfXqHoG0OLQWqsRhlGwq2V1YU6nDqXdyRPYjR94TIM8iSt688XX3N X-Gm-Message-State: AOJu0YwaaN2/LsyM+wR03v5AMmsHPRNCTgdtWC4qrSQ/bWFPz+uRS5d0 d5VMzM7KBeRtKQVLY0LcgCQYTw/CAr9GD7xvnsqPpPb5ibj1U8kL X-Google-Smtp-Source: AGHT+IFcGtH1OGYfYfxBsWgRvAXHGpU7ZE/PdqDWYMcWWlG30R+CNhYXxUTKsBTiy9zS5HWhRnTsbg== X-Received: by 2002:a05:600c:450d:b0:428:14b6:ce32 with SMTP id 5b1f17b1804b1-429d480c40emr16491485e9.9.1723516245973; Mon, 12 Aug 2024 19:30:45 -0700 (PDT) Received: from [192.168.42.116] ([85.255.232.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4290c738e01sm204324535e9.11.2024.08.12.19.30.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Aug 2024 19:30:45 -0700 (PDT) Message-ID: <5a51b11d-9c35-42a5-879b-08dc7ca2ca18@gmail.com> Date: Tue, 13 Aug 2024 03:31:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v18 07/14] memory-provider: dmabuf devmem memory provider To: Jakub Kicinski Cc: Mina Almasry , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, bpf@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, Donald Hunter , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jonathan Corbet , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Andreas Larsson , Jesper Dangaard Brouer , Ilias Apalodimas , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Arnd Bergmann , Steffen Klassert , Herbert Xu , David Ahern , Willem de Bruijn , Shuah Khan , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Bagas Sanjaya , Christoph Hellwig , Nikolay Aleksandrov , Taehee Yoo , David Wei , Jason Gunthorpe , Yunsheng Lin , Shailend Chand , Harshitha Ramamurthy , Shakeel Butt , Jeroen de Borst , Praveen Kaligineedi , Willem de Bruijn , Kaiyuan Zhang References: <20240805212536.2172174-1-almasrymina@google.com> <20240805212536.2172174-8-almasrymina@google.com> <20240806135924.5bb65ec7@kernel.org> <20240808192410.37a49724@kernel.org> <20240809205236.77c959b0@kernel.org> <48f3a61f-9e04-4755-b50c-8fae6e6112eb@gmail.com> <20240812105732.5d2845e4@kernel.org> <20240812165708.33234ed6@kernel.org> Content-Language: en-US From: Pavel Begunkov In-Reply-To: <20240812165708.33234ed6@kernel.org> 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 8/13/24 00:57, Jakub Kicinski wrote: > On Mon, 12 Aug 2024 20:10:39 +0100 Pavel Begunkov wrote: >>> 1. Drivers need to be able to say "I support unreadable netmem". >>> Failure to report unreadable netmem support should cause the netlink >>> API to fail when the user tries to bind dmabuf/io uring memory. >>> >>> 2. Drivers need to be able to say "I want a header pool (with readable >>> netmem)" or "I want a data pool (potentially with unreadable netmem)". >>> >>> Pavel is suggesting implementing both of these in 2 different flags. >>> >>> Jakub is suggesting implementing both with 1 flag which says "I can >>> support unreadable netmem for this pool" , and guarding against #1 >>> with a refcount check to detect if a dmabuf pool should have been >>> created but wasn't. >> >> That would be iffy IIUC, but I think Jakub just explicitly said >> that the refcount trick was just for debugging purposes and not >> for gauging errors like "providers are not supported by the driver". >> >> "Yup, the refcount (now: check of the page pool list) was meant >> as a WARN_ONCE() to catch bad drivers." > > Sorry, insufficient caffeine level in the morning. > We can't WARN_ONCE(), indeed. I'm getting lost, so repeating myself a bit. What I think would be a good approach is if we get an error back from the driver if it doesn't support netiov / providers. netdev_rx_queue_restart() { ... err = dev->queue_mgmt_ops->ndo_queue_mem_alloc(); if (err == -EOPNOTSUPP) // the driver doesn't support netiov return -EOPNOTSUPP; ... } That can be done if drivers opt in to support providers, e.g. via a page pool flag. What I think wouldn't be a great option is getting back a "success" from the driver even though it ignored netdev_rx_queue_restart() { ... err = dev->queue_mgmt_ops->ndo_queue_mem_alloc(); if (err) return err; // we get err==0 even if the driver doesn't support // providers, verify it is _actually_ installed if (rxq->mp_params) { // or walking pp list, same thing if (rxq->mp_params->refcount == 0) goto fail; } } And if we go with the first version, the refcount check can also be added but as a warning. Maybe it's easier to put it into code and discuss then. -- Pavel Begunkov