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

From: Stephen Rothwell <[email-masked]>
Date: Wed, 12 Mar 2025 14:52:47 +1100

Hi all,

After merging the bpf-next tree, today's linux-next build (powerpc
ppc64_defconfig) failed like this:

In file included from include/asm-generic/percpu.h:7,
                 from arch/powerpc/include/asm/percpu.h:28,
                 from arch/powerpc/include/asm/smp.h:26,
                 from include/linux/smp.h:119,
                 from include/linux/lockdep.h:14,
                 from include/linux/radix-tree.h:14,
                 from include/linux/idr.h:15,
                 from include/linux/cgroup-defs.h:13,
                 from mm/memcontrol.c:28:
mm/memcontrol.c: In function 'memcg_hotplug_cpu_dead':
include/linux/percpu-defs.h:242:2: error: passing argument 1 of 'local_lock_acquire' from incompatible pointer type [-Wincompatible-pointer-types]
  242 | ({                                                                      \
      | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |  |
      |  localtry_lock_t *
  243 |         __verify_pcpu_ptr(ptr);                                         \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  244 |         arch_raw_cpu_ptr(ptr);                                          \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  245 | })
      | ~~
include/linux/percpu-defs.h:254:27: note: in expansion of macro 'raw_cpu_ptr'
  254 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
      |                           ^~~~~~~~~~~
include/linux/local_lock_internal.h:105:36: note: in expansion of macro 'this_cpu_ptr'
  105 |                 local_lock_acquire(this_cpu_ptr(lock));         \
      |                                    ^~~~~~~~~~~~
include/linux/local_lock.h:31:9: note: in expansion of macro '__local_lock_irqsave'
   31 |         __local_lock_irqsave(lock, flags)
      |         ^~~~~~~~~~~~~~~~~~~~
mm/memcontrol.c:1960:9: note: in expansion of macro 'local_lock_irqsave'
 1960 |         local_lock_irqsave(&memcg_stock.stock_lock, flags);
      |         ^~~~~~~~~~~~~~~~~~
In file included from include/linux/local_lock.h:5,
                 from include/linux/mmzone.h:24,
                 from include/linux/gfp.h:7,
                 from include/linux/xarray.h:16,
                 from include/linux/radix-tree.h:21:
include/linux/local_lock_internal.h:59:53: note: expected 'local_lock_t *' but argument is of type 'localtry_lock_t *'
   59 | static inline void local_lock_acquire(local_lock_t *l) { }
      |                                       ~~~~~~~~~~~~~~^
include/linux/percpu-defs.h:242:2: error: passing argument 1 of 'local_lock_release' from incompatible pointer type [-Wincompatible-pointer-types]
  242 | ({                                                                      \
      | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |  |
      |  localtry_lock_t *
  243 |         __verify_pcpu_ptr(ptr);                                         \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  244 |         arch_raw_cpu_ptr(ptr);                                          \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  245 | })
      | ~~
include/linux/percpu-defs.h:254:27: note: in expansion of macro 'raw_cpu_ptr'
  254 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
      |                           ^~~~~~~~~~~
include/linux/local_lock_internal.h:122:36: note: in expansion of macro 'this_cpu_ptr'
  122 |                 local_lock_release(this_cpu_ptr(lock));         \
      |                                    ^~~~~~~~~~~~
include/linux/local_lock.h:52:9: note: in expansion of macro '__local_unlock_irqrestore'
   52 |         __local_unlock_irqrestore(lock, flags)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
mm/memcontrol.c:1962:9: note: in expansion of macro 'local_unlock_irqrestore'
 1962 |         local_unlock_irqrestore(&memcg_stock.stock_lock, flags);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/local_lock_internal.h:61:53: note: expected 'local_lock_t *' but argument is of type 'localtry_lock_t *'
   61 | static inline void local_lock_release(local_lock_t *l) { }
      |                                       ~~~~~~~~~~~~~~^

Caused by commits

  0aaddfb06882 ("locking/local_lock: Introduce localtry_lock_t")
  01d37228d331 ("memcg: Use trylock to access memcg stock_lock.")

interacting with commit

  885aa5fe7b1d ("memcg: drain obj stock on cpu hotplug teardown")

from the mm-hotfixes tree.

I applied the following merge fix patch.

From: Stephen Rothwell <[email-masked]>
Date: Wed, 12 Mar 2025 14:18:03 +1100
Subject: [PATCH] fix up for "memcg: Use trylock to access memcg stock_lock"

interacting with "memcg: drain obj stock on cpu hotplug teardown" from
the mm-hotfixes tree.

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 mm/memcontrol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 8f88b8dd8097..87544df4c3b8 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1957,9 +1957,9 @@ static int memcg_hotplug_cpu_dead(unsigned int cpu)
 	stock = &per_cpu(memcg_stock, cpu);
 
 	/* drain_obj_stock requires stock_lock */
-	local_lock_irqsave(&memcg_stock.stock_lock, flags);
+	localtry_lock_irqsave(&memcg_stock.stock_lock, flags);
 	old = drain_obj_stock(stock);
-	local_unlock_irqrestore(&memcg_stock.stock_lock, flags);
+	localtry_unlock_irqrestore(&memcg_stock.stock_lock, flags);
 
 	drain_stock(stock);
 	obj_cgroup_put(old);
-- 
2.45.2

-- 
Cheers,
Stephen Rothwell