mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Mina Almasry <almasrymina@google.com>,
	netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	Kaiyuan Zhang <kaiyuanz@google.com>,
	Samiullah Khawaja <skhawaja@google.com>,
	linux-kernel@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Jason Gunthorpe <jgg@ziepe.ca>
Subject: Re: [PATCH net-next v2 3/5] page_pool: Set `dma_sync` to false for devmem memory provider
Date: Fri, 8 Nov 2024 16:34:44 +0000	[thread overview]
Message-ID: <c0b6d0a3-66d4-49aa-87fe-85a4346d723b@gmail.com> (raw)
In-Reply-To: <20241107212309.3097362-4-almasrymina@google.com>

On 11/7/24 21:23, Mina Almasry wrote:
> From: Samiullah Khawaja <skhawaja@google.com>
> 
> Move the `dma_map` and `dma_sync` checks to `page_pool_init` to make
> them generic. Set dma_sync to false for devmem memory provider because
> the dma_sync APIs should not be used for dma_buf backed devmem memory
> provider.
> 
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
> Signed-off-by: Mina Almasry <almasrymina@google.com>
> 
> ---
>   net/core/devmem.c    | 9 ++++-----
>   net/core/page_pool.c | 3 +++
>   2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/net/core/devmem.c b/net/core/devmem.c
> index 11b91c12ee11..826d0b00159f 100644
> --- a/net/core/devmem.c
> +++ b/net/core/devmem.c
> @@ -331,11 +331,10 @@ int mp_dmabuf_devmem_init(struct page_pool *pool)
>   	if (!binding)
>   		return -EINVAL;
>   
> -	if (!pool->dma_map)
> -		return -EOPNOTSUPP;
> -
> -	if (pool->dma_sync)
> -		return -EOPNOTSUPP;
> +	/* dma-buf dma addresses should not be used with
> +	 * dma_sync_for_cpu/device. Force disable dma_sync.
> +	 */
> +	pool->dma_sync = false;
>   
>   	if (pool->p.order != 0)
>   		return -E2BIG;
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index 77de79c1933b..528dd4d18eab 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -287,6 +287,9 @@ static int page_pool_init(struct page_pool *pool,
>   	}
>   
>   	if (pool->mp_priv) {
> +		if (!pool->dma_map || !pool->dma_sync)

Is there a reason why ->dma_sync is enforced for all providers?
It sounds like a devmem fix, on the other hand I don't really
care as we don't have drivers yet implementing queue api / etc.
but not passing PP_FLAG_DMA_SYNC_DEV.

Also, putting fixes first in the series or sending them separately
reduces backporting headache.

-- 
Pavel Begunkov

  parent reply	other threads:[~2024-11-08 16:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07 21:23 [PATCH net-next v2 0/5] devmem TCP fixes Mina Almasry
2024-11-07 21:23 ` [PATCH net-next v2 1/5] net: page_pool: rename page_pool_alloc_netmem to *_netmems Mina Almasry
2024-11-08 15:53   ` Stanislav Fomichev
2024-11-07 21:23 ` [PATCH net-next v2 2/5] net: page_pool: create page_pool_alloc_netmem Mina Almasry
2024-11-08 15:53   ` Stanislav Fomichev
2024-11-07 21:23 ` [PATCH net-next v2 3/5] page_pool: Set `dma_sync` to false for devmem memory provider Mina Almasry
2024-11-08 15:53   ` Stanislav Fomichev
2024-11-08 16:34   ` Pavel Begunkov [this message]
2024-11-12  2:34   ` Jakub Kicinski
2024-11-07 21:23 ` [PATCH net-next v2 4/5] page_pool: disable sync for cpu for dmabuf " Mina Almasry
2024-11-08 14:18   ` Jason Gunthorpe
2024-11-08 15:58     ` Stanislav Fomichev
2024-11-08 16:39       ` Pavel Begunkov
2024-11-08 19:01     ` Mina Almasry
2024-11-15  1:59       ` Jason Gunthorpe
2024-11-22 22:10         ` Samiullah Khawaja
2024-11-24  2:33           ` Jakub Kicinski
2024-11-07 21:23 ` [PATCH net-next v2 5/5] netmem: add netmem_prefetch Mina Almasry
2024-11-08  2:56   ` kernel test robot
2024-11-08  3:29   ` kernel test robot
2024-11-08  4:21   ` kernel test robot
2024-11-08 15:55   ` Stanislav Fomichev
2024-11-12  2:35   ` Jakub Kicinski

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=c0b6d0a3-66d4-49aa-87fe-85a4346d723b@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=almasrymina@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jgg@ziepe.ca \
    --cc=kaiyuanz@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=skhawaja@google.com \
    --cc=willemb@google.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

all inboxes | Powered by JetHome®