From: Pavel Begunkov <asml.silence@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "Mina Almasry" <almasrymina@google.com>,
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" <donald.hunter@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Ivan Kokshaysky" <ink@jurassic.park.msu.ru>,
"Matt Turner" <mattst88@gmail.com>,
"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
"Helge Deller" <deller@gmx.de>,
"Andreas Larsson" <andreas@gaisler.com>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Steffen Klassert" <steffen.klassert@secunet.com>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"David Ahern" <dsahern@kernel.org>,
"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>,
"Shuah Khan" <shuah@kernel.org>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
"Bagas Sanjaya" <bagasdotme@gmail.com>,
"Christoph Hellwig" <hch@infradead.org>,
"Nikolay Aleksandrov" <razor@blackwall.org>,
"Taehee Yoo" <ap420073@gmail.com>, "David Wei" <dw@davidwei.uk>,
"Jason Gunthorpe" <jgg@ziepe.ca>,
"Yunsheng Lin" <linyunsheng@huawei.com>,
"Shailend Chand" <shailend@google.com>,
"Harshitha Ramamurthy" <hramamurthy@google.com>,
"Shakeel Butt" <shakeel.butt@linux.dev>,
"Jeroen de Borst" <jeroendb@google.com>,
"Praveen Kaligineedi" <pkaligineedi@google.com>,
"Willem de Bruijn" <willemb@google.com>,
"Kaiyuan Zhang" <kaiyuanz@google.com>
Subject: Re: [PATCH net-next v18 07/14] memory-provider: dmabuf devmem memory provider
Date: Mon, 12 Aug 2024 20:04:41 +0100 [thread overview]
Message-ID: <71260e3c-dee4-4bf0-b257-cdabd8cff3f1@gmail.com> (raw)
In-Reply-To: <7e2ffe62-032a-4c5e-953b-b7117ab076be@gmail.com>
On 8/12/24 19:57, Pavel Begunkov wrote:
> On 8/12/24 18:57, Jakub Kicinski wrote:
>> On Sun, 11 Aug 2024 22:51:13 +0100 Pavel Begunkov wrote:
>>>> I think we're talking about 2 slightly different flags, AFAIU.>
>>>> Pavel and I are suggesting the driver reports "I support memory
>>>> providers" directly to core (via the queue-api or what not), and we
>>>> check that flag directly in netdev_rx_queue_restart(), and fail
>>>> immediately if the support is not there.
>>>
>>> I might've misread Jakub, but yes, I believe it's different. It'd
>>> communicate about support for providers to upper layers, so we can
>>> fail even before attempting to allocate a new queue and init a
>>> page pool.
>>
>> Got it. Since allocating memory happens before stopping traffic
>> I think it's acceptable to stick to a single flag.
>
> I agree, it's an failure case of init path, shouldn't be
> a problem.
>
>
>>>> Jakub is suggesting a page_pool_params flag which lets the driver
>>>> report "I support memory providers". If the driver doesn't support it
>>>> but core is trying to configure that, then the page_pool_create will
>>>> fail, which will cause the queue API operation
>>>> (ndo_queue_alloc_mem_alloc) to fail, which causes
>>>> netdev_rx_queue_restart() to fail.
>>>
>>> And I'm not against this way either if we explicitly get an error
>>> back instead of trying to figure it out post-factum like by
>>> checking the references and possibly reverting the allocation.
>>> Maybe that's where I was confused, and that refcount thing was
>>> suggested as a WARN_ONCE?
>>
>> Yup, the refcount (now: check of the page pool list) was meant
>> as a WARN_ONCE() to catch bad drivers.
>>
>>> FWIW, I think it warrants two flags. The first saying that the
>>> driver supports providers at all:
>>>
>>> page_pool_init() {
>>> if (rxq->mp_params)
>>> if (!(flags & PP_PROVIDERS_SUPPORTED))
>>> goto fail;
>>> }
>>>
>>> And the second telling whether the driver wants to install
>>> providers for this particular page pool, so if there is a
>>> separate pool for headers we can set it with plain old kernel
>>> pages.
>>
>> The implementation of the queue API should be resilient against
>> failures in alloc, and not being MP capable is just a form of
>> alloc failure. I don't see the upside of double-flag.
>>
>>> payload_pool = page_pool_create(rqx, PP_PROVIDERS_SUPPORTED);
>>> header_pool = page_pool_create(rqx, PP_PROVIDERS_SUPPORTED |
>>> PP_IGNORE_PROVIDERS);
>>
>> Also don't see the upside of the explicit "non-capable" flag,
>> but I haven't thought of that. Is there any use?
Or maybe I don't get what you're asking, I explained
why to have that "PP_IGNORE_PROVIDERS" on top of the flag
saying that it's supported.
Which "non-capable" flag you have in mind? A page pool create
flag or one facing upper layers like devmem tcp?
> Considering that we pass a mp to page pool indirectly via
> a queue
>
> rxq->mp_param = devmemtcp;
> ... // later
> pp_params.queue = rxq;
> page_pool_create(pp_params);
>
> How can we create a separate header pool without mp and let
> the other data pool be initialized with mp? We can make
> sure pp_params.queue is NULL, but API isn't sound, I think
> the plans are to reuse the queue argument for some other
> purposes.
>
> param_tmp = rxq->mp_param;
> rxq->mp_param = NULL;
> page_pool_create(pp_params);
> rxq->mp_param = param_tmp;
>
> Temporarily erasing mp_param is another option, but I think
> by far the simplest is another flag.
>
>> One important note. The flag should not be tied to memory providers
>> but rather to netmem, IOW unreadable memory. MP is an internal detail,
>> the important fact from the driver-facing API perspective is that the
>> driver doesn't need struct pages.
>
> Sure, didn't want to go into describing how these are not
> the same thing. Naming should reflect it, and if we expect
> providers that don't produce net_iov, we might want to have
> a flag in mp_param or so.
>
--
Pavel Begunkov
next prev parent reply other threads:[~2024-08-12 19:04 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 21:25 [PATCH net-next v18 00/14] Device Memory TCP Mina Almasry
2024-08-05 21:25 ` [PATCH net-next v18 01/14] netdev: add netdev_rx_queue_restart() Mina Almasry
2024-08-05 21:25 ` [PATCH net-next v18 02/14] net: netdev netlink api to bind dma-buf to a net device Mina Almasry
2024-08-05 21:25 ` [PATCH net-next v18 03/14] netdev: support binding dma-buf to netdevice Mina Almasry
2024-08-06 20:37 ` Jakub Kicinski
2024-08-05 21:25 ` [PATCH net-next v18 04/14] netdev: netdevice devmem allocator Mina Almasry
2024-08-06 20:47 ` Jakub Kicinski
2024-08-05 21:25 ` [PATCH net-next v18 05/14] page_pool: move dmaddr helpers to .c file Mina Almasry
2024-08-06 20:42 ` Jakub Kicinski
2024-08-05 21:25 ` [PATCH net-next v18 06/14] page_pool: devmem support Mina Almasry
2024-08-05 21:25 ` [PATCH net-next v18 07/14] memory-provider: dmabuf devmem memory provider Mina Almasry
2024-08-06 20:59 ` Jakub Kicinski
2024-08-08 20:36 ` Mina Almasry
2024-08-09 2:24 ` Jakub Kicinski
2024-08-09 14:10 ` Mina Almasry
2024-08-09 15:45 ` Pavel Begunkov
2024-08-10 3:52 ` Jakub Kicinski
2024-08-11 2:21 ` Mina Almasry
2024-08-11 21:51 ` Pavel Begunkov
2024-08-12 17:57 ` Jakub Kicinski
2024-08-12 18:55 ` Mina Almasry
2024-08-12 19:10 ` Pavel Begunkov
2024-08-12 23:57 ` Jakub Kicinski
2024-08-13 2:31 ` Pavel Begunkov
2024-08-13 14:39 ` Jakub Kicinski
2024-08-13 15:11 ` Pavel Begunkov
2024-08-13 15:26 ` Jakub Kicinski
2024-08-12 18:57 ` Pavel Begunkov
2024-08-12 19:04 ` Pavel Begunkov [this message]
2024-08-13 0:15 ` Jakub Kicinski
2024-08-13 1:56 ` Pavel Begunkov
2024-08-13 8:39 ` Mina Almasry
2024-08-13 9:03 ` Mina Almasry
2024-08-13 14:33 ` Jakub Kicinski
2024-08-05 21:25 ` [PATCH net-next v18 08/14] net: support non paged skb frags Mina Almasry
2024-08-05 21:25 ` [PATCH net-next v18 09/14] net: add support for skbs with unreadable frags Mina Almasry
2024-08-05 21:25 ` [PATCH net-next v18 10/14] tcp: RX path for devmem TCP Mina Almasry
2024-08-05 21:25 ` [PATCH net-next v18 11/14] net: add SO_DEVMEM_DONTNEED setsockopt to release RX frags Mina Almasry
2024-08-05 21:25 ` [PATCH net-next v18 12/14] net: add devmem TCP documentation Mina Almasry
2024-08-05 21:25 ` [PATCH net-next v18 13/14] selftests: add ncdevmem, netcat for devmem TCP Mina Almasry
2024-08-05 21:25 ` [PATCH net-next v18 14/14] netdev: add dmabuf introspection Mina Almasry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=71260e3c-dee4-4bf0-b257-cdabd8cff3f1@gmail.com \
--to=asml.silence@gmail.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=almasrymina@google.com \
--cc=andreas@gaisler.com \
--cc=ap420073@gmail.com \
--cc=arnd@arndb.de \
--cc=bagasdotme@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=christian.koenig@amd.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=deller@gmx.de \
--cc=donald.hunter@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=dsahern@kernel.org \
--cc=dw@davidwei.uk \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=hch@infradead.org \
--cc=herbert@gondor.apana.org.au \
--cc=hramamurthy@google.com \
--cc=ilias.apalodimas@linaro.org \
--cc=ink@jurassic.park.msu.ru \
--cc=jeroendb@google.com \
--cc=jgg@ziepe.ca \
--cc=kaiyuanz@google.com \
--cc=kuba@kernel.org \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linyunsheng@huawei.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mattst88@gmail.com \
--cc=mhiramat@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pkaligineedi@google.com \
--cc=razor@blackwall.org \
--cc=richard.henderson@linaro.org \
--cc=rostedt@goodmis.org \
--cc=shailend@google.com \
--cc=shakeel.butt@linux.dev \
--cc=shuah@kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=sumit.semwal@linaro.org \
--cc=tsbogend@alpha.franken.de \
--cc=willemb@google.com \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox