2024-05-07 23:58:13

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the dma-mapping tree

Hi all,

After merging the dma-mapping tree, today's linux-next build (x86_64
allmodconfig) failed like this:

net/core/page_pool.c: In function '__page_pool_dma_sync_for_device':
net/core/page_pool.c:406:54: error: passing argument 1 of 'page_pool_get_dma_addr' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
406 | dma_addr_t dma_addr = page_pool_get_dma_addr(page);
| ^~~~
In file included from net/core/page_pool.c:13:
include/net/page_pool/helpers.h:373:62: note: expected 'struct page *' but argument is of type 'const struct page *'
373 | static inline dma_addr_t page_pool_get_dma_addr(struct page *page)
| ~~~~~~~~~~~~~^~~~
cc1: all warnings being treated as errors

Caused by commit

8bf4d7154d4c ("page_pool: check for DMA sync shortcut earlier")

I have used the dma-mapping tree from next-20240507 for today.

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2024-05-08 06:51:16

by Christoph Hellwig

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the dma-mapping tree

On Wed, May 08, 2024 at 09:16:31AM +1000, Stephen Rothwell wrote:
> Hi all,
>
> After merging the dma-mapping tree, today's linux-next build (x86_64
> allmodconfig) failed like this:

Thanks. I'll fold in the patch below to drop two consts for now.
Alexander, if you want to pass the consts through we'll also need to
modify page_pool_get_dma_addr, which looks doable. If you want that,
please send an incremental patch.

diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 8836aaaf23855f..4f9d1bd7f4d187 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -399,7 +399,7 @@ static struct page *__page_pool_get_cached(struct page_pool *pool)
}

static void __page_pool_dma_sync_for_device(const struct page_pool *pool,
- const struct page *page,
+ struct page *page,
u32 dma_sync_size)
{
#if defined(CONFIG_HAS_DMA) && defined(CONFIG_DMA_NEED_SYNC)
@@ -413,7 +413,7 @@ static void __page_pool_dma_sync_for_device(const struct page_pool *pool,

static __always_inline void
page_pool_dma_sync_for_device(const struct page_pool *pool,
- const struct page *page,
+ struct page *page,
u32 dma_sync_size)
{
if (pool->dma_sync && dma_dev_need_sync(pool->p.dev))

2024-05-08 09:11:35

by Alexander Lobakin

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the dma-mapping tree

From: Christoph Hellwig <[email protected]>
Date: Wed, 8 May 2024 08:51:02 +0200

> On Wed, May 08, 2024 at 09:16:31AM +1000, Stephen Rothwell wrote:
>> Hi all,
>>
>> After merging the dma-mapping tree, today's linux-next build (x86_64
>> allmodconfig) failed like this:
>
> Thanks. I'll fold in the patch below to drop two consts for now.
> Alexander, if you want to pass the consts through we'll also need to
> modify page_pool_get_dma_addr, which looks doable. If you want that,
> please send an incremental patch.

I'm verry sorry for that. I had 2 trees, one with const get_dma_addr()
and dma-for-next without const, and didn't check it compiles after
rebasing >_<

net-next already has this const. We could leave it as in your attached
patch, but then there'll be a trivial conflict when merging with
net-next. Or I can send an incremental quick fix for dma-for-next, but
then 2 commits (one in your tree and one in net-next) will have these
changes duplicated.
What do you think?

>
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index 8836aaaf23855f..4f9d1bd7f4d187 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -399,7 +399,7 @@ static struct page *__page_pool_get_cached(struct page_pool *pool)
> }
>
> static void __page_pool_dma_sync_for_device(const struct page_pool *pool,
> - const struct page *page,
> + struct page *page,
> u32 dma_sync_size)
> {
> #if defined(CONFIG_HAS_DMA) && defined(CONFIG_DMA_NEED_SYNC)
> @@ -413,7 +413,7 @@ static void __page_pool_dma_sync_for_device(const struct page_pool *pool,
>
> static __always_inline void
> page_pool_dma_sync_for_device(const struct page_pool *pool,
> - const struct page *page,
> + struct page *page,
> u32 dma_sync_size)
> {
> if (pool->dma_sync && dma_dev_need_sync(pool->p.dev))

Thanks,
Olek

2024-05-08 13:52:53

by Christoph Hellwig

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the dma-mapping tree

On Wed, May 08, 2024 at 10:51:28AM +0200, Alexander Lobakin wrote:
> I'm verry sorry for that. I had 2 trees, one with const get_dma_addr()
> and dma-for-next without const, and didn't check it compiles after
> rebasing >_<
>
> net-next already has this const. We could leave it as in your attached
> patch, but then there'll be a trivial conflict when merging with
> net-next. Or I can send an incremental quick fix for dma-for-next, but
> then 2 commits (one in your tree and one in net-next) will have these
> changes duplicated.
> What do you think?

Let's just add the const annoations after the trees are merged into
Linus' tree. Nothing really wrong with not having them right now.