Subject: Re: linux-next: build failure after merge of the mm tree

From: Qi Zheng <[email-masked]>
Date: Tue, 5 Mar 2024 14:39:08 +0800

On 2024/3/5 12:26, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the mm tree, today's linux-next build (s390 defconfig)
> failed like this:
> 
> In file included from include/linux/smp.h:12,
>                   from include/linux/lockdep.h:14,
>                   from include/linux/spinlock.h:63,
>                   from include/linux/mmzone.h:8,
>                   from include/linux/gfp.h:7,
>                   from include/linux/mm.h:7,
>                   from include/linux/pagewalk.h:5,
>                   from arch/s390/mm/gmap.c:12:
> arch/s390/mm/gmap.c: In function 'gmap_free':
> include/linux/list.h:866:19: error: assignment to 'struct page *' from incompatible pointer type 'struct ptdesc *' [-Werror=incompatible-pointer-types]
>    866 |                 n = list_next_entry(pos, member);                       \
>        |                   ^
> arch/s390/mm/gmap.c:212:17: note: in expansion of macro 'list_for_each_entry_safe'
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                 ^~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/list.h:868:18: error: assignment to 'struct ptdesc *' from incompatible pointer type 'struct page *' [-Werror=incompatible-pointer-types]
>    868 |              pos = n, n = list_next_entry(n, member))
>        |                  ^
> arch/s390/mm/gmap.c:212:17: note: in expansion of macro 'list_for_each_entry_safe'
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                 ^~~~~~~~~~~~~~~~~~~~~~~~
> In file included from include/linux/kernel.h:22,
>                   from arch/s390/mm/gmap.c:11:
> arch/s390/mm/gmap.c:212:72: error: 'struct page' has no member named 'pt_list'; did you mean 'pcp_list'?
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                                                                        ^~~~~~~
> include/linux/container_of.h:19:33: note: in definition of macro 'container_of'
>     19 |         void *__mptr = (void *)(ptr);                                   \
>        |                                 ^~~
> include/linux/list.h:645:9: note: in expansion of macro 'list_entry'
>    645 |         list_entry((pos)->member.next, typeof(*(pos)), member)
>        |         ^~~~~~~~~~
> include/linux/list.h:868:27: note: in expansion of macro 'list_next_entry'
>    868 |              pos = n, n = list_next_entry(n, member))
>        |                           ^~~~~~~~~~~~~~~
> arch/s390/mm/gmap.c:212:17: note: in expansion of macro 'list_for_each_entry_safe'
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                 ^~~~~~~~~~~~~~~~~~~~~~~~
> In file included from include/linux/container_of.h:5:
> arch/s390/mm/gmap.c:212:72: error: 'struct page' has no member named 'pt_list'; did you mean 'pcp_list'?
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                                                                        ^~~~~~~
> include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
>     78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
>        |                                                        ^~~~
> include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert'
>     20 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
>        |         ^~~~~~~~~~~~~
> include/linux/container_of.h:20:23: note: in expansion of macro '__same_type'
>     20 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
>        |                       ^~~~~~~~~~~
> include/linux/list.h:601:9: note: in expansion of macro 'container_of'
>    601 |         container_of(ptr, type, member)
>        |         ^~~~~~~~~~~~
> include/linux/list.h:645:9: note: in expansion of macro 'list_entry'
>    645 |         list_entry((pos)->member.next, typeof(*(pos)), member)
>        |         ^~~~~~~~~~
> include/linux/list.h:868:27: note: in expansion of macro 'list_next_entry'
>    868 |              pos = n, n = list_next_entry(n, member))
>        |                           ^~~~~~~~~~~~~~~
> arch/s390/mm/gmap.c:212:17: note: in expansion of macro 'list_for_each_entry_safe'
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                 ^~~~~~~~~~~~~~~~~~~~~~~~
> arch/s390/mm/gmap.c:212:72: error: 'struct page' has no member named 'pt_list'; did you mean 'pcp_list'?
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                                                                        ^~~~~~~
> include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
>     78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
>        |                                                        ^~~~
> include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert'
>     20 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
>        |         ^~~~~~~~~~~~~
> include/linux/container_of.h:20:23: note: in expansion of macro '__same_type'
>     20 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
>        |                       ^~~~~~~~~~~
> include/linux/list.h:601:9: note: in expansion of macro 'container_of'
>    601 |         container_of(ptr, type, member)
>        |         ^~~~~~~~~~~~
> include/linux/list.h:645:9: note: in expansion of macro 'list_entry'
>    645 |         list_entry((pos)->member.next, typeof(*(pos)), member)
>        |         ^~~~~~~~~~
> include/linux/list.h:868:27: note: in expansion of macro 'list_next_entry'
>    868 |              pos = n, n = list_next_entry(n, member))
>        |                           ^~~~~~~~~~~~~~~
> arch/s390/mm/gmap.c:212:17: note: in expansion of macro 'list_for_each_entry_safe'
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                 ^~~~~~~~~~~~~~~~~~~~~~~~
> arch/s390/mm/gmap.c:212:72: error: 'struct page' has no member named 'pt_list'; did you mean 'pcp_list'?
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                                                                        ^~~~~~~
> include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
>     78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
>        |                                                        ^~~~
> include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert'
>     20 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
>        |         ^~~~~~~~~~~~~
> include/linux/container_of.h:21:23: note: in expansion of macro '__same_type'
>     21 |                       __same_type(*(ptr), void),                        \
>        |                       ^~~~~~~~~~~
> include/linux/list.h:601:9: note: in expansion of macro 'container_of'
>    601 |         container_of(ptr, type, member)
>        |         ^~~~~~~~~~~~
> include/linux/list.h:645:9: note: in expansion of macro 'list_entry'
>    645 |         list_entry((pos)->member.next, typeof(*(pos)), member)
>        |         ^~~~~~~~~~
> include/linux/list.h:868:27: note: in expansion of macro 'list_next_entry'
>    868 |              pos = n, n = list_next_entry(n, member))
>        |                           ^~~~~~~~~~~~~~~
> arch/s390/mm/gmap.c:212:17: note: in expansion of macro 'list_for_each_entry_safe'
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                 ^~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/compiler_types.h:390:27: error: expression in static assertion is not an integer
>    390 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
>        |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
>     78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
>        |                                                        ^~~~
> include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert'
>     20 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
>        |         ^~~~~~~~~~~~~
> include/linux/container_of.h:20:23: note: in expansion of macro '__same_type'
>     20 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
>        |                       ^~~~~~~~~~~
> include/linux/list.h:601:9: note: in expansion of macro 'container_of'
>    601 |         container_of(ptr, type, member)
>        |         ^~~~~~~~~~~~
> include/linux/list.h:645:9: note: in expansion of macro 'list_entry'
>    645 |         list_entry((pos)->member.next, typeof(*(pos)), member)
>        |         ^~~~~~~~~~
> include/linux/list.h:868:27: note: in expansion of macro 'list_next_entry'
>    868 |              pos = n, n = list_next_entry(n, member))
>        |                           ^~~~~~~~~~~~~~~
> arch/s390/mm/gmap.c:212:17: note: in expansion of macro 'list_for_each_entry_safe'
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                 ^~~~~~~~~~~~~~~~~~~~~~~~
> In file included from include/uapi/linux/posix_types.h:5,
>                   from include/uapi/linux/types.h:14,
>                   from include/linux/types.h:6,
>                   from include/linux/kasan-checks.h:5,
>                   from include/asm-generic/rwonce.h:26,
>                   from arch/s390/include/asm/rwonce.h:29,
>                   from include/linux/compiler.h:299,
>                   from include/linux/array_size.h:5,
>                   from include/linux/kernel.h:16:
> arch/s390/mm/gmap.c:212:72: error: 'struct page' has no member named 'pt_list'; did you mean 'pcp_list'?
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                                                                        ^~~~~~~
> include/linux/stddef.h:16:58: note: in definition of macro 'offsetof'
>     16 | #define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
>        |                                                          ^~~~~~
> include/linux/list.h:601:9: note: in expansion of macro 'container_of'
>    601 |         container_of(ptr, type, member)
>        |         ^~~~~~~~~~~~
> include/linux/list.h:645:9: note: in expansion of macro 'list_entry'
>    645 |         list_entry((pos)->member.next, typeof(*(pos)), member)
>        |         ^~~~~~~~~~
> include/linux/list.h:868:27: note: in expansion of macro 'list_next_entry'
>    868 |              pos = n, n = list_next_entry(n, member))
>        |                           ^~~~~~~~~~~~~~~
> arch/s390/mm/gmap.c:212:17: note: in expansion of macro 'list_for_each_entry_safe'
>    212 |                 list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list)
>        |                 ^~~~~~~~~~~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors

Thanks for reporting that, will fix it:

diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
index 4d2674f89322..e43a5a3befd4 100644
--- a/arch/s390/mm/gmap.c
+++ b/arch/s390/mm/gmap.c
@@ -206,10 +206,10 @@ static void gmap_free(struct gmap *gmap)

         /* Free additional data for a shadow gmap */
         if (gmap_is_shadow(gmap)) {
-               struct ptdesc *ptdesc;
+               struct ptdesc *ptdesc, *n;

                 /* Free all page tables. */
-               list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, 
pt_list)
+               list_for_each_entry_safe(ptdesc, n, &gmap->pt_list, pt_list)
                         page_table_free_pgste(ptdesc);
                 gmap_rmap_radix_tree_free(&gmap->host_to_rmap);
                 /* Release reference to the parent */

> 
> Caused by commit
> 
>    859584c3ddba ("s390: supplement for ptdesc conversion")
> 
> from the mm-unstable branch of the mm tree.
> 
> I have reverted that commit for today.