linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv10 0/3] enable nr_cpus for powerpc without re-ordering cpu number
@ 2023-12-27  2:39 Pingfan Liu
  2023-12-27  2:39 ` [PATCHv10 1/3] powerpc/kernel: Remove check on paca_ptrs_size Pingfan Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Pingfan Liu @ 2023-12-27  2:39 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Baoquan He, Pingfan Liu, kexec, Mahesh Salgaonkar, Ming Lei,
	Nicholas Piggin, Sourabh Jain, Hari Bathini, Wen Xiong

From: Pingfan Liu <piliu@redhat.com>

This series addresses the nr_cpus issue for PowerPC without re-ordering
cpu number. To save the memory used by percpu area, it also limits the
possible cpu numbers by allowing hole in cpu_possible_mask.

Because the last cpu number will bigger than nr_cpu_ids in this way,
some pointer arrays indexed by cpu should be extended to hold the
pointer, e.g. paca_ptrs.

Please notice that this series still has some issue (some cpu can not be
brought up), but before I resolve it. Please share your thoughts about
it.

Thanks


Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Cc: Wen Xiong <wenxiong@us.ibm.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: kexec@lists.infradead.org
To: linuxppc-dev@lists.ozlabs.org

Pingfan Liu (3):
  powerpc/kernel: Remove check on paca_ptrs_size
  powerpc/kernel: Extend arrays' size to make room for a hole in
    cpu_possible_mask
  powerpc/smp: Allow hole in paca_ptrs to accommodate boot_cpu

 arch/powerpc/include/asm/paca.h    |  2 ++
 arch/powerpc/include/asm/smp.h     |  1 +
 arch/powerpc/kernel/paca.c         | 24 +++++++-----------------
 arch/powerpc/kernel/prom.c         |  6 ++++++
 arch/powerpc/kernel/setup-common.c | 26 +++++++++++++++++++++-----
 arch/powerpc/kernel/smp.c          |  3 ++-
 6 files changed, 39 insertions(+), 23 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCHv10 1/3] powerpc/kernel: Remove check on paca_ptrs_size
  2023-12-27  2:39 [PATCHv10 0/3] enable nr_cpus for powerpc without re-ordering cpu number Pingfan Liu
@ 2023-12-27  2:39 ` Pingfan Liu
  2023-12-27  2:41 ` [PATCHv10 2/3] powerpc/kernel: Extend arrays' size to make room for a hole in cpu_possible_mask Pingfan Liu
  2023-12-27  2:41 ` [PATCHv10 3/3] powerpc/smp: Allow hole in paca_ptrs to accommodate boot_cpu Pingfan Liu
  2 siblings, 0 replies; 7+ messages in thread
From: Pingfan Liu @ 2023-12-27  2:39 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Baoquan He, Pingfan Liu, kexec, Mahesh Salgaonkar, Ming Lei,
	Nicholas Piggin, Sourabh Jain, Hari Bathini, Wen Xiong

From: Pingfan Liu <piliu@redhat.com>

Between early_setup()->allocate_paca_ptrs() and
smp_setup_cpu_maps()->free_unused_pacas(), there is no call to
set_nr_cpu_ids(), which means nr_cpu_ids is unchanged.

Hence removing the check.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Cc: Wen Xiong <wenxiong@us.ibm.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: kexec@lists.infradead.org
To: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/kernel/paca.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index cda4e00b67c1..760f371cf096 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -286,16 +286,6 @@ void __init allocate_paca(int cpu)
 
 void __init free_unused_pacas(void)
 {
-	int new_ptrs_size;
-
-	new_ptrs_size = sizeof(struct paca_struct *) * nr_cpu_ids;
-	if (new_ptrs_size < paca_ptrs_size)
-		memblock_phys_free(__pa(paca_ptrs) + new_ptrs_size,
-				   paca_ptrs_size - new_ptrs_size);
-
-	paca_nr_cpu_ids = nr_cpu_ids;
-	paca_ptrs_size = new_ptrs_size;
-
 #ifdef CONFIG_PPC_64S_HASH_MMU
 	if (early_radix_enabled()) {
 		/* Ugly fixup, see new_slb_shadow() */
@@ -304,9 +294,6 @@ void __init free_unused_pacas(void)
 		paca_ptrs[boot_cpuid]->slb_shadow_ptr = NULL;
 	}
 #endif
-
-	printk(KERN_DEBUG "Allocated %u bytes for %u pacas\n",
-			paca_ptrs_size + paca_struct_size, nr_cpu_ids);
 }
 
 #ifdef CONFIG_PPC_64S_HASH_MMU
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv10 2/3] powerpc/kernel: Extend arrays' size to make room for a hole in cpu_possible_mask
  2023-12-27  2:39 [PATCHv10 0/3] enable nr_cpus for powerpc without re-ordering cpu number Pingfan Liu
  2023-12-27  2:39 ` [PATCHv10 1/3] powerpc/kernel: Remove check on paca_ptrs_size Pingfan Liu
@ 2023-12-27  2:41 ` Pingfan Liu
  2023-12-27 19:52   ` kernel test robot
  2023-12-27  2:41 ` [PATCHv10 3/3] powerpc/smp: Allow hole in paca_ptrs to accommodate boot_cpu Pingfan Liu
  2 siblings, 1 reply; 7+ messages in thread
From: Pingfan Liu @ 2023-12-27  2:41 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Baoquan He, Pingfan Liu, kexec, Mahesh Salgaonkar, Ming Lei,
	Nicholas Piggin, Sourabh Jain, Hari Bathini, Wen Xiong

From: Pingfan Liu <piliu@redhat.com>

This patch aims to mark all the arrays which size is decided by
nr_cpu_ids or num_possible_cpus().  Later if a hole is allowed in
cpu_possible_mask, the corresponding array should extend to hold the
last bit number in cpu_possible_mask.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Cc: Wen Xiong <wenxiong@us.ibm.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: kexec@lists.infradead.org
To: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/include/asm/paca.h    | 2 ++
 arch/powerpc/kernel/paca.c         | 8 ++++----
 arch/powerpc/kernel/setup-common.c | 2 +-
 arch/powerpc/kernel/smp.c          | 3 ++-
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index e667d455ecb4..a577d98dd0d8 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -299,5 +299,7 @@ static inline void free_unused_pacas(void) { }
 
 #endif /* CONFIG_PPC64 */
 
+extern int paca_last_cpu_num;
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_PACA_H */
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 760f371cf096..840c74dd17d6 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -236,15 +236,15 @@ void setup_paca(struct paca_struct *new_paca)
 
 }
 
-static int __initdata paca_nr_cpu_ids;
+int __initdata paca_last_cpu_num;
 static int __initdata paca_ptrs_size;
 static int __initdata paca_struct_size;
 
 void __init allocate_paca_ptrs(void)
 {
-	paca_nr_cpu_ids = nr_cpu_ids;
+	paca_last_cpu_num = nr_cpu_ids;
 
-	paca_ptrs_size = sizeof(struct paca_struct *) * nr_cpu_ids;
+	paca_ptrs_size = sizeof(struct paca_struct *) * paca_last_cpu_num;
 	paca_ptrs = memblock_alloc_raw(paca_ptrs_size, SMP_CACHE_BYTES);
 	if (!paca_ptrs)
 		panic("Failed to allocate %d bytes for paca pointers\n",
@@ -258,7 +258,7 @@ void __init allocate_paca(int cpu)
 	u64 limit;
 	struct paca_struct *paca;
 
-	BUG_ON(cpu >= paca_nr_cpu_ids);
+	BUG_ON(cpu >= paca_last_cpu_num);
 
 #ifdef CONFIG_PPC_BOOK3S_64
 	/*
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 2f1026fba00d..f9f5f313abf0 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -453,7 +453,7 @@ void __init smp_setup_cpu_maps(void)
 
 	DBG("smp_setup_cpu_maps()\n");
 
-	cpu_to_phys_id = memblock_alloc(nr_cpu_ids * sizeof(u32),
+	cpu_to_phys_id = memblock_alloc(paca_last_cpu_num * sizeof(u32),
 					__alignof__(u32));
 	if (!cpu_to_phys_id)
 		panic("%s: Failed to allocate %zu bytes align=0x%zx\n",
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 5826f5108a12..6fefe22fd118 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1140,7 +1140,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 	}
 
 	if (cpu_to_chip_id(boot_cpuid) != -1) {
-		int idx = DIV_ROUND_UP(num_possible_cpus(), threads_per_core);
+		int idx = DIV_ROUND_UP(cpumask_last(cpu_possible_mask),
+				threads_per_core);
 
 		/*
 		 * All threads of a core will all belong to the same core,
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv10 3/3] powerpc/smp: Allow hole in paca_ptrs to accommodate boot_cpu
  2023-12-27  2:39 [PATCHv10 0/3] enable nr_cpus for powerpc without re-ordering cpu number Pingfan Liu
  2023-12-27  2:39 ` [PATCHv10 1/3] powerpc/kernel: Remove check on paca_ptrs_size Pingfan Liu
  2023-12-27  2:41 ` [PATCHv10 2/3] powerpc/kernel: Extend arrays' size to make room for a hole in cpu_possible_mask Pingfan Liu
@ 2023-12-27  2:41 ` Pingfan Liu
  2023-12-27 20:45   ` kernel test robot
  2023-12-28  4:07   ` kernel test robot
  2 siblings, 2 replies; 7+ messages in thread
From: Pingfan Liu @ 2023-12-27  2:41 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Baoquan He, Pingfan Liu, kexec, Mahesh Salgaonkar, Ming Lei,
	Nicholas Piggin, Sourabh Jain, Hari Bathini, Wen Xiong

From: Pingfan Liu <piliu@redhat.com>

This patch always forces the first core onlined due to some subsystem
needs cpu0. After core0, a hole may follow, then comes the crashed core.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Cc: Wen Xiong <wenxiong@us.ibm.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: kexec@lists.infradead.org
To: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/include/asm/smp.h     |  1 +
 arch/powerpc/kernel/paca.c         |  7 +++++--
 arch/powerpc/kernel/prom.c         |  6 ++++++
 arch/powerpc/kernel/setup-common.c | 24 ++++++++++++++++++++----
 4 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index aaaa576d0e15..f01c7891b0d7 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -27,6 +27,7 @@
 
 extern int boot_cpuid;
 extern int boot_cpu_hwid; /* PPC64 only */
+extern int threads_in_core;
 extern int spinning_secondaries;
 extern u32 *cpu_to_phys_id;
 extern bool coregroup_enabled;
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 840c74dd17d6..1fe0fd2a6021 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -242,9 +242,12 @@ static int __initdata paca_struct_size;
 
 void __init allocate_paca_ptrs(void)
 {
-	paca_last_cpu_num = nr_cpu_ids;
+	unsigned int cnt;
 
-	paca_ptrs_size = sizeof(struct paca_struct *) * paca_last_cpu_num;
+	/* paca_ptrs should be big enough to hold boot cpu */
+	cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
+	paca_last_cpu_num = cnt;
+	paca_ptrs_size = sizeof(struct paca_struct *) * cnt;
 	paca_ptrs = memblock_alloc_raw(paca_ptrs_size, SMP_CACHE_BYTES);
 	if (!paca_ptrs)
 		panic("Failed to allocate %d bytes for paca pointers\n",
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 0b5878c3125b..e1a671156941 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -371,9 +371,15 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 	DBG("boot cpu: logical %d physical %d\n", found,
 	    be32_to_cpu(intserv[found_thread]));
 	boot_cpuid = found;
+	/* This forces all threads in a core to be onlined */
+	set_nr_cpu_ids(ALIGN(nr_cpu_ids, nthreads));
+	/* Core 0 is always onlined and assure enough room for boot core */
+	if (nthreads -1 < boot_cpuid && nr_cpu_ids < 2 * nthreads)
+		set_nr_cpu_ids(2 * nthreads);
 
 	if (IS_ENABLED(CONFIG_PPC64))
 		boot_cpu_hwid = be32_to_cpu(intserv[found_thread]);
+	threads_in_core = nthreads;
 
 	/*
 	 * PAPR defines "logical" PVR values for cpus that
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index f9f5f313abf0..b70474e1b5fe 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -86,6 +86,7 @@ EXPORT_SYMBOL(machine_id);
 
 int boot_cpuid = -1;
 EXPORT_SYMBOL_GPL(boot_cpuid);
+int __initdata threads_in_core = 1;
 
 #ifdef CONFIG_PPC64
 int boot_cpu_hwid = -1;
@@ -448,8 +449,9 @@ u32 *cpu_to_phys_id = NULL;
 void __init smp_setup_cpu_maps(void)
 {
 	struct device_node *dn;
-	int cpu = 0;
+	int cpu_onlined = 0, cpu = 0;
 	int nthreads = 1;
+	bool bootcpu_covered = false;
 
 	DBG("smp_setup_cpu_maps()\n");
 
@@ -484,7 +486,19 @@ void __init smp_setup_cpu_maps(void)
 
 		nthreads = len / sizeof(int);
 
-		for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
+		if (!bootcpu_covered) {
+			if (cpu == ALIGN_DOWN(boot_cpuid, nthreads)) {
+				bootcpu_covered = true;
+				goto scan;
+
+			/* Reserve the last online slot for boot core */
+			} else if (cpu >= nr_cpu_ids - nthreads && !bootcpu_covered) {
+				cpu += nthreads;
+				continue;
+			}
+		}
+scan:
+		for (j = 0; j < nthreads && cpu_onlined < nr_cpu_ids; j++) {
 			bool avail;
 
 			DBG("    thread %d -> cpu %d (hard id %d)\n",
@@ -499,9 +513,10 @@ void __init smp_setup_cpu_maps(void)
 			set_cpu_possible(cpu, true);
 			cpu_to_phys_id[cpu] = be32_to_cpu(intserv[j]);
 			cpu++;
+			cpu_onlined++;
 		}
 
-		if (cpu >= nr_cpu_ids) {
+		if (cpu_onlined >= nr_cpu_ids) {
 			of_node_put(dn);
 			break;
 		}
@@ -547,7 +562,8 @@ void __init smp_setup_cpu_maps(void)
 			printk(KERN_INFO "Partition configured for %d cpus.\n",
 			       maxcpus);
 
-		for (cpu = 0; cpu < maxcpus; cpu++)
+		/* Bits below #cpu have been set */
+		for (; cpu < maxcpus; cpu++)
 			set_cpu_possible(cpu, true);
 	out:
 		of_node_put(dn);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCHv10 2/3] powerpc/kernel: Extend arrays' size to make room for a hole in cpu_possible_mask
  2023-12-27  2:41 ` [PATCHv10 2/3] powerpc/kernel: Extend arrays' size to make room for a hole in cpu_possible_mask Pingfan Liu
@ 2023-12-27 19:52   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-12-27 19:52 UTC (permalink / raw)
  To: Pingfan Liu, linuxppc-dev
  Cc: Baoquan He, Pingfan Liu, kexec, Mahesh Salgaonkar,
	Nicholas Piggin, Ming Lei, Sourabh Jain, oe-kbuild-all,
	Hari Bathini, Wen Xiong

Hi Pingfan,

kernel test robot noticed the following build errors:

[auto build test ERROR on powerpc/next]
[also build test ERROR on powerpc/fixes linus/master v6.7-rc7 next-20231222]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Pingfan-Liu/powerpc-kernel-Remove-check-on-paca_ptrs_size/20231227-104412
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link:    https://lore.kernel.org/r/20231227024126.12424-1-kernelfans%40gmail.com
patch subject: [PATCHv10 2/3] powerpc/kernel: Extend arrays' size to make room for a hole in cpu_possible_mask
config: powerpc-iss476-smp_defconfig (https://download.01.org/0day-ci/archive/20231228/202312280350.GpyKSrB6-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231228/202312280350.GpyKSrB6-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312280350.GpyKSrB6-lkp@intel.com/

All errors (new ones prefixed by >>):

   powerpc-linux-ld: arch/powerpc/kernel/setup-common.o: in function `smp_setup_cpu_maps':
>> arch/powerpc/kernel/setup-common.c:440:(.init.text+0x6a): undefined reference to `paca_last_cpu_num'
>> powerpc-linux-ld: arch/powerpc/kernel/setup-common.c:440:(.init.text+0x72): undefined reference to `paca_last_cpu_num'

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for HOTPLUG_CPU
   Depends on [n]: SMP [=y] && (PPC_PSERIES [=n] || PPC_PMAC [=n] || PPC_POWERNV [=n] || FSL_SOC_BOOKE [=n])
   Selected by [y]:
   - PM_SLEEP_SMP [=y] && SMP [=y] && (ARCH_SUSPEND_POSSIBLE [=y] || ARCH_HIBERNATION_POSSIBLE [=y]) && PM_SLEEP [=y]


vim +440 arch/powerpc/kernel/setup-common.c

   413	
   414	/**
   415	 * setup_cpu_maps - initialize the following cpu maps:
   416	 *                  cpu_possible_mask
   417	 *                  cpu_present_mask
   418	 *
   419	 * Having the possible map set up early allows us to restrict allocations
   420	 * of things like irqstacks to nr_cpu_ids rather than NR_CPUS.
   421	 *
   422	 * We do not initialize the online map here; cpus set their own bits in
   423	 * cpu_online_mask as they come up.
   424	 *
   425	 * This function is valid only for Open Firmware systems.  finish_device_tree
   426	 * must be called before using this.
   427	 *
   428	 * While we're here, we may as well set the "physical" cpu ids in the paca.
   429	 *
   430	 * NOTE: This must match the parsing done in early_init_dt_scan_cpus.
   431	 */
   432	void __init smp_setup_cpu_maps(void)
   433	{
   434		struct device_node *dn;
   435		int cpu = 0;
   436		int nthreads = 1;
   437	
   438		DBG("smp_setup_cpu_maps()\n");
   439	
 > 440		cpu_to_phys_id = memblock_alloc(paca_last_cpu_num * sizeof(u32),
   441						__alignof__(u32));
   442		if (!cpu_to_phys_id)
   443			panic("%s: Failed to allocate %zu bytes align=0x%zx\n",
   444			      __func__, nr_cpu_ids * sizeof(u32), __alignof__(u32));
   445	
   446		for_each_node_by_type(dn, "cpu") {
   447			const __be32 *intserv;
   448			__be32 cpu_be;
   449			int j, len;
   450	
   451			DBG("  * %pOF...\n", dn);
   452	
   453			intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s",
   454					&len);
   455			if (intserv) {
   456				DBG("    ibm,ppc-interrupt-server#s -> %lu threads\n",
   457				    (len / sizeof(int)));
   458			} else {
   459				DBG("    no ibm,ppc-interrupt-server#s -> 1 thread\n");
   460				intserv = of_get_property(dn, "reg", &len);
   461				if (!intserv) {
   462					cpu_be = cpu_to_be32(cpu);
   463					/* XXX: what is this? uninitialized?? */
   464					intserv = &cpu_be;	/* assume logical == phys */
   465					len = 4;
   466				}
   467			}
   468	
   469			nthreads = len / sizeof(int);
   470	
   471			for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
   472				bool avail;
   473	
   474				DBG("    thread %d -> cpu %d (hard id %d)\n",
   475				    j, cpu, be32_to_cpu(intserv[j]));
   476	
   477				avail = of_device_is_available(dn);
   478				if (!avail)
   479					avail = !of_property_match_string(dn,
   480							"enable-method", "spin-table");
   481	
   482				set_cpu_present(cpu, avail);
   483				set_cpu_possible(cpu, true);
   484				cpu_to_phys_id[cpu] = be32_to_cpu(intserv[j]);
   485				cpu++;
   486			}
   487	
   488			if (cpu >= nr_cpu_ids) {
   489				of_node_put(dn);
   490				break;
   491			}
   492		}
   493	
   494		/* If no SMT supported, nthreads is forced to 1 */
   495		if (!cpu_has_feature(CPU_FTR_SMT)) {
   496			DBG("  SMT disabled ! nthreads forced to 1\n");
   497			nthreads = 1;
   498		}
   499	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCHv10 3/3] powerpc/smp: Allow hole in paca_ptrs to accommodate boot_cpu
  2023-12-27  2:41 ` [PATCHv10 3/3] powerpc/smp: Allow hole in paca_ptrs to accommodate boot_cpu Pingfan Liu
@ 2023-12-27 20:45   ` kernel test robot
  2023-12-28  4:07   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-12-27 20:45 UTC (permalink / raw)
  To: Pingfan Liu, linuxppc-dev
  Cc: Baoquan He, Pingfan Liu, llvm, kexec, Mahesh Salgaonkar,
	Nicholas Piggin, Ming Lei, Sourabh Jain, oe-kbuild-all,
	Hari Bathini, Wen Xiong

Hi Pingfan,

kernel test robot noticed the following build errors:

[auto build test ERROR on powerpc/next]
[also build test ERROR on powerpc/fixes linus/master v6.7-rc7 next-20231222]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Pingfan-Liu/powerpc-kernel-Remove-check-on-paca_ptrs_size/20231227-104412
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link:    https://lore.kernel.org/r/20231227024147.12485-1-kernelfans%40gmail.com
patch subject: [PATCHv10 3/3] powerpc/smp: Allow hole in paca_ptrs to accommodate boot_cpu
config: powerpc64-randconfig-001-20231227 (https://download.01.org/0day-ci/archive/20231228/202312280454.Et1Ovm5u-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231228/202312280454.Et1Ovm5u-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312280454.Et1Ovm5u-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

>> arch/powerpc/kernel/paca.c:248:48: error: use of undeclared identifier 'threads_in_core'; did you mean 'cpu_thread_in_core'?
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                                                         ^~~~~~~~~~~~~~~
                                                         cpu_thread_in_core
   include/linux/align.h:8:43: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                                        ^
   include/uapi/linux/const.h:31:70: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                                  ^
   include/uapi/linux/const.h:32:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                    ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                                              ^
   include/linux/minmax.h:56:40: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__is_constexpr((x) - (y)),        \
                                                 ^
   include/linux/compiler.h:236:48: note: expanded from macro '__is_constexpr'
           (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
                                                         ^
   arch/powerpc/include/asm/cputhreads.h:48:19: note: 'cpu_thread_in_core' declared here
   static inline int cpu_thread_in_core(int cpu)
                     ^
>> arch/powerpc/kernel/paca.c:248:26: warning: cast to smaller integer type 'typeof ((0 + 1))' (aka 'int') from 'int (*)(int)' [-Wpointer-to-int-cast]
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:22: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                   ^
   include/uapi/linux/const.h:31:54: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                  ^
   include/uapi/linux/const.h:32:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                    ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                           ~~~~~~~~~~~~~~~~~~~^~~~~
   include/linux/minmax.h:56:40: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__is_constexpr((x) - (y)),        \
                                 ~~~~~~~~~~~~~~~~^~~~~~~~~
   include/linux/compiler.h:236:48: note: expanded from macro '__is_constexpr'
           (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
                                                         ^
>> arch/powerpc/kernel/paca.c:248:48: error: use of undeclared identifier 'threads_in_core'; did you mean 'cpu_thread_in_core'?
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                                                         ^~~~~~~~~~~~~~~
                                                         cpu_thread_in_core
   include/linux/align.h:8:43: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                                        ^
   include/uapi/linux/const.h:31:70: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                                  ^
   include/uapi/linux/const.h:32:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                               ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                                              ^
   include/linux/minmax.h:56:40: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__is_constexpr((x) - (y)),        \
                                                 ^
   include/linux/compiler.h:236:48: note: expanded from macro '__is_constexpr'
           (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
                                                         ^
   arch/powerpc/include/asm/cputhreads.h:48:19: note: 'cpu_thread_in_core' declared here
   static inline int cpu_thread_in_core(int cpu)
                     ^
>> arch/powerpc/kernel/paca.c:248:26: warning: cast to smaller integer type 'typeof ((0 + 1))' (aka 'int') from 'int (*)(int)' [-Wpointer-to-int-cast]
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:22: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                   ^
   include/uapi/linux/const.h:31:54: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                  ^
   include/uapi/linux/const.h:32:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                               ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                           ~~~~~~~~~~~~~~~~~~~^~~~~
   include/linux/minmax.h:56:40: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__is_constexpr((x) - (y)),        \
                                 ~~~~~~~~~~~~~~~~^~~~~~~~~
   include/linux/compiler.h:236:48: note: expanded from macro '__is_constexpr'
           (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
                                                         ^
>> arch/powerpc/kernel/paca.c:248:48: error: use of undeclared identifier 'threads_in_core'; did you mean 'cpu_thread_in_core'?
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                                                         ^~~~~~~~~~~~~~~
                                                         cpu_thread_in_core
   include/linux/align.h:8:43: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                                        ^
   include/uapi/linux/const.h:31:70: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                                  ^
   include/uapi/linux/const.h:32:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                    ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                                              ^
   include/linux/minmax.h:57:13: note: expanded from macro '__careful_cmp'
                   __cmp(op, x, y),                                \
                             ^
   include/linux/minmax.h:46:27: note: expanded from macro '__cmp'
   #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
                             ^
   arch/powerpc/include/asm/cputhreads.h:48:19: note: 'cpu_thread_in_core' declared here
   static inline int cpu_thread_in_core(int cpu)
                     ^
>> arch/powerpc/kernel/paca.c:248:26: warning: cast to smaller integer type 'typeof ((0 + 1))' (aka 'int') from 'int (*)(int)' [-Wpointer-to-int-cast]
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:22: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                   ^
   include/uapi/linux/const.h:31:54: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                  ^
   include/uapi/linux/const.h:32:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                    ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                           ~~~~~~~~~~~~~~~~~~~^~~~~
   include/linux/minmax.h:57:13: note: expanded from macro '__careful_cmp'
                   __cmp(op, x, y),                                \
                   ~~~~~~~~~~^~~~~
   include/linux/minmax.h:46:27: note: expanded from macro '__cmp'
   #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
                             ^
>> arch/powerpc/kernel/paca.c:248:48: error: use of undeclared identifier 'threads_in_core'; did you mean 'cpu_thread_in_core'?
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                                                         ^~~~~~~~~~~~~~~
                                                         cpu_thread_in_core
   include/linux/align.h:8:43: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                                        ^
   include/uapi/linux/const.h:31:70: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                                  ^
   include/uapi/linux/const.h:32:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                               ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                                              ^
   include/linux/minmax.h:57:13: note: expanded from macro '__careful_cmp'
                   __cmp(op, x, y),                                \
                             ^
   include/linux/minmax.h:46:27: note: expanded from macro '__cmp'
   #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
                             ^
   arch/powerpc/include/asm/cputhreads.h:48:19: note: 'cpu_thread_in_core' declared here
   static inline int cpu_thread_in_core(int cpu)
                     ^
>> arch/powerpc/kernel/paca.c:248:26: warning: cast to smaller integer type 'typeof ((0 + 1))' (aka 'int') from 'int (*)(int)' [-Wpointer-to-int-cast]
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:22: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                   ^
   include/uapi/linux/const.h:31:54: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                  ^
   include/uapi/linux/const.h:32:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                               ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                           ~~~~~~~~~~~~~~~~~~~^~~~~
   include/linux/minmax.h:57:13: note: expanded from macro '__careful_cmp'
                   __cmp(op, x, y),                                \
                   ~~~~~~~~~~^~~~~
   include/linux/minmax.h:46:27: note: expanded from macro '__cmp'
   #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
                             ^
>> arch/powerpc/kernel/paca.c:248:48: error: use of undeclared identifier 'threads_in_core'; did you mean 'cpu_thread_in_core'?
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                                                         ^~~~~~~~~~~~~~~
                                                         cpu_thread_in_core
   include/linux/align.h:8:43: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                                        ^
   include/uapi/linux/const.h:31:70: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                                  ^
   include/uapi/linux/const.h:32:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                    ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                                              ^
   include/linux/minmax.h:57:13: note: expanded from macro '__careful_cmp'
                   __cmp(op, x, y),                                \
                             ^
   include/linux/minmax.h:46:51: note: expanded from macro '__cmp'
   #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
                                                     ^
   arch/powerpc/include/asm/cputhreads.h:48:19: note: 'cpu_thread_in_core' declared here
   static inline int cpu_thread_in_core(int cpu)
                     ^
>> arch/powerpc/kernel/paca.c:248:26: warning: cast to smaller integer type 'typeof ((0 + 1))' (aka 'int') from 'int (*)(int)' [-Wpointer-to-int-cast]
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:22: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                   ^
   include/uapi/linux/const.h:31:54: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                  ^
   include/uapi/linux/const.h:32:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                    ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                           ~~~~~~~~~~~~~~~~~~~^~~~~
   include/linux/minmax.h:57:13: note: expanded from macro '__careful_cmp'
                   __cmp(op, x, y),                                \
                   ~~~~~~~~~~^~~~~
   include/linux/minmax.h:46:51: note: expanded from macro '__cmp'
   #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
                                                     ^
>> arch/powerpc/kernel/paca.c:248:48: error: use of undeclared identifier 'threads_in_core'; did you mean 'cpu_thread_in_core'?
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                                                         ^~~~~~~~~~~~~~~
                                                         cpu_thread_in_core
   include/linux/align.h:8:43: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                                        ^
   include/uapi/linux/const.h:31:70: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                                  ^
   include/uapi/linux/const.h:32:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                               ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                                              ^
   include/linux/minmax.h:57:13: note: expanded from macro '__careful_cmp'
                   __cmp(op, x, y),                                \
                             ^
   include/linux/minmax.h:46:51: note: expanded from macro '__cmp'
   #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
                                                     ^
   arch/powerpc/include/asm/cputhreads.h:48:19: note: 'cpu_thread_in_core' declared here
   static inline int cpu_thread_in_core(int cpu)
                     ^
>> arch/powerpc/kernel/paca.c:248:26: warning: cast to smaller integer type 'typeof ((0 + 1))' (aka 'int') from 'int (*)(int)' [-Wpointer-to-int-cast]
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:22: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                   ^
   include/uapi/linux/const.h:31:54: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                  ^
   include/uapi/linux/const.h:32:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                               ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                           ~~~~~~~~~~~~~~~~~~~^~~~~
   include/linux/minmax.h:57:13: note: expanded from macro '__careful_cmp'
                   __cmp(op, x, y),                                \
                   ~~~~~~~~~~^~~~~
   include/linux/minmax.h:46:51: note: expanded from macro '__cmp'
   #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
                                                     ^
>> arch/powerpc/kernel/paca.c:248:48: error: use of undeclared identifier 'threads_in_core'; did you mean 'cpu_thread_in_core'?
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                                                         ^~~~~~~~~~~~~~~
                                                         cpu_thread_in_core
   include/linux/align.h:8:43: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                                        ^
   include/uapi/linux/const.h:31:70: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                                  ^
   include/uapi/linux/const.h:32:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                    ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                                              ^
   include/linux/minmax.h:58:18: note: expanded from macro '__careful_cmp'
                   __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
                                  ^
   include/linux/minmax.h:49:9: note: expanded from macro '__cmp_once'
           typeof(x) unique_x = (x);                       \
                  ^
   arch/powerpc/include/asm/cputhreads.h:48:19: note: 'cpu_thread_in_core' declared here
   static inline int cpu_thread_in_core(int cpu)
                     ^
>> arch/powerpc/kernel/paca.c:248:26: warning: cast to smaller integer type 'typeof ((0 + 1))' (aka 'int') from 'int (*)(int)' [-Wpointer-to-int-cast]
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:22: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                   ^
   include/uapi/linux/const.h:31:54: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                  ^
   include/uapi/linux/const.h:32:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                    ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                           ~~~~~~~~~~~~~~~~~~~^~~~~
   include/linux/minmax.h:58:18: note: expanded from macro '__careful_cmp'
                   __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:49:9: note: expanded from macro '__cmp_once'
           typeof(x) unique_x = (x);                       \
                  ^
>> arch/powerpc/kernel/paca.c:248:48: error: use of undeclared identifier 'threads_in_core'; did you mean 'cpu_thread_in_core'?
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                                                         ^~~~~~~~~~~~~~~
                                                         cpu_thread_in_core
   include/linux/align.h:8:43: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                                        ^
   include/uapi/linux/const.h:31:70: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                                  ^
   include/uapi/linux/const.h:32:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                               ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                                              ^
   include/linux/minmax.h:58:18: note: expanded from macro '__careful_cmp'
                   __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
                                  ^
   include/linux/minmax.h:49:9: note: expanded from macro '__cmp_once'
           typeof(x) unique_x = (x);                       \
                  ^
   arch/powerpc/include/asm/cputhreads.h:48:19: note: 'cpu_thread_in_core' declared here
   static inline int cpu_thread_in_core(int cpu)
                     ^
>> arch/powerpc/kernel/paca.c:248:26: warning: cast to smaller integer type 'typeof ((0 + 1))' (aka 'int') from 'int (*)(int)' [-Wpointer-to-int-cast]
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:22: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                   ^
   include/uapi/linux/const.h:31:54: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                  ^
   include/uapi/linux/const.h:32:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                               ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                           ~~~~~~~~~~~~~~~~~~~^~~~~
   include/linux/minmax.h:58:18: note: expanded from macro '__careful_cmp'
                   __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:49:9: note: expanded from macro '__cmp_once'
           typeof(x) unique_x = (x);                       \
                  ^
>> arch/powerpc/kernel/paca.c:248:48: error: use of undeclared identifier 'threads_in_core'; did you mean 'cpu_thread_in_core'?
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                                                         ^~~~~~~~~~~~~~~
                                                         cpu_thread_in_core
   include/linux/align.h:8:43: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                                        ^
   include/uapi/linux/const.h:31:70: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                                  ^
   include/uapi/linux/const.h:32:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                    ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                                              ^
   include/linux/minmax.h:58:18: note: expanded from macro '__careful_cmp'
                   __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
                                  ^
   include/linux/minmax.h:49:24: note: expanded from macro '__cmp_once'
           typeof(x) unique_x = (x);                       \
                                 ^
   arch/powerpc/include/asm/cputhreads.h:48:19: note: 'cpu_thread_in_core' declared here
   static inline int cpu_thread_in_core(int cpu)
                     ^
>> arch/powerpc/kernel/paca.c:248:26: warning: cast to smaller integer type 'typeof ((0 + 1))' (aka 'int') from 'int (*)(int)' [-Wpointer-to-int-cast]
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:22: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                   ^
   include/uapi/linux/const.h:31:54: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                  ^
   include/uapi/linux/const.h:32:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                    ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                           ~~~~~~~~~~~~~~~~~~~^~~~~
   include/linux/minmax.h:58:18: note: expanded from macro '__careful_cmp'
                   __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:49:24: note: expanded from macro '__cmp_once'
           typeof(x) unique_x = (x);                       \
                                 ^
>> arch/powerpc/kernel/paca.c:248:48: error: use of undeclared identifier 'threads_in_core'; did you mean 'cpu_thread_in_core'?
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                                                         ^~~~~~~~~~~~~~~
                                                         cpu_thread_in_core
   include/linux/align.h:8:43: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                                        ^
   include/uapi/linux/const.h:31:70: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                                  ^
   include/uapi/linux/const.h:32:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                               ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                                              ^
   include/linux/minmax.h:58:18: note: expanded from macro '__careful_cmp'
                   __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
                                  ^
   include/linux/minmax.h:49:24: note: expanded from macro '__cmp_once'
           typeof(x) unique_x = (x);                       \
                                 ^
   arch/powerpc/include/asm/cputhreads.h:48:19: note: 'cpu_thread_in_core' declared here
   static inline int cpu_thread_in_core(int cpu)
                     ^
>> arch/powerpc/kernel/paca.c:248:26: warning: cast to smaller integer type 'typeof ((0 + 1))' (aka 'int') from 'int (*)(int)' [-Wpointer-to-int-cast]
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:22: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                   ^
   include/uapi/linux/const.h:31:54: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                  ^
   include/uapi/linux/const.h:32:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                               ^
   include/linux/minmax.h:92:38: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(max, x, y)
                           ~~~~~~~~~~~~~~~~~~~^~~~~
   include/linux/minmax.h:58:18: note: expanded from macro '__careful_cmp'
                   __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:49:24: note: expanded from macro '__cmp_once'
           typeof(x) unique_x = (x);                       \
                                 ^
   arch/powerpc/kernel/paca.c:248:48: error: use of undeclared identifier 'threads_in_core'; did you mean 'cpu_thread_in_core'?
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                                                         ^~~~~~~~~~~~~~~
                                                         cpu_thread_in_core
   include/linux/align.h:8:43: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                                        ^
   include/uapi/linux/const.h:31:70: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                                  ^
   include/uapi/linux/const.h:32:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                    ^
   note: (skipping 6 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler.h:236:48: note: expanded from macro '__is_constexpr'
           (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
                                                         ^
   include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
   #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
                                                    ^
   include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
   #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
                                                          ^
   arch/powerpc/include/asm/cputhreads.h:48:19: note: 'cpu_thread_in_core' declared here
   static inline int cpu_thread_in_core(int cpu)
                     ^
   arch/powerpc/kernel/paca.c:248:26: warning: cast to smaller integer type 'typeof ((0 + 1))' (aka 'int') from 'int (*)(int)' [-Wpointer-to-int-cast]
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:22: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                   ^
   include/uapi/linux/const.h:31:54: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                  ^
   include/uapi/linux/const.h:32:47: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                    ^
   note: (skipping 6 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler.h:236:48: note: expanded from macro '__is_constexpr'
           (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
                                                         ^
   include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
   #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
                                    ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
   #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
                                                          ^~~~
   arch/powerpc/kernel/paca.c:248:48: error: use of undeclared identifier 'threads_in_core'; did you mean 'cpu_thread_in_core'?
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                                                         ^~~~~~~~~~~~~~~
                                                         cpu_thread_in_core
   include/linux/align.h:8:43: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                                        ^
   include/uapi/linux/const.h:31:70: note: expanded from macro '__ALIGN_KERNEL'
   #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
                                                                                  ^
   include/uapi/linux/const.h:32:58: note: expanded from macro '__ALIGN_KERNEL_MASK'
   #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
                                                               ^
   note: (skipping 6 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler.h:236:48: note: expanded from macro '__is_constexpr'
           (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
                                                         ^
   include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
   #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
                                                    ^
   include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
   #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
                                                          ^
   arch/powerpc/include/asm/cputhreads.h:48:19: note: 'cpu_thread_in_core' declared here
   static inline int cpu_thread_in_core(int cpu)
                     ^
   arch/powerpc/kernel/paca.c:248:26: warning: cast to smaller integer type 'typeof ((0 + 1))' (aka 'int') from 'int (*)(int)' [-Wpointer-to-int-cast]
           cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:22: note: expanded from macro 'ALIGN'
   #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
                                   ^


vim +248 arch/powerpc/kernel/paca.c

   242	
   243	void __init allocate_paca_ptrs(void)
   244	{
   245		unsigned int cnt;
   246	
   247		/* paca_ptrs should be big enough to hold boot cpu */
 > 248		cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
   249		paca_last_cpu_num = cnt;
   250		paca_ptrs_size = sizeof(struct paca_struct *) * cnt;
   251		paca_ptrs = memblock_alloc_raw(paca_ptrs_size, SMP_CACHE_BYTES);
   252		if (!paca_ptrs)
   253			panic("Failed to allocate %d bytes for paca pointers\n",
   254			      paca_ptrs_size);
   255	
   256		memset(paca_ptrs, 0x88, paca_ptrs_size);
   257	}
   258	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCHv10 3/3] powerpc/smp: Allow hole in paca_ptrs to accommodate boot_cpu
  2023-12-27  2:41 ` [PATCHv10 3/3] powerpc/smp: Allow hole in paca_ptrs to accommodate boot_cpu Pingfan Liu
  2023-12-27 20:45   ` kernel test robot
@ 2023-12-28  4:07   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-12-28  4:07 UTC (permalink / raw)
  To: Pingfan Liu, linuxppc-dev
  Cc: Baoquan He, Pingfan Liu, kexec, Mahesh Salgaonkar,
	Nicholas Piggin, Ming Lei, Sourabh Jain, oe-kbuild-all,
	Hari Bathini, Wen Xiong

Hi Pingfan,

kernel test robot noticed the following build errors:

[auto build test ERROR on powerpc/next]
[also build test ERROR on powerpc/fixes linus/master v6.7-rc7 next-20231222]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Pingfan-Liu/powerpc-kernel-Remove-check-on-paca_ptrs_size/20231227-104412
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link:    https://lore.kernel.org/r/20231227024147.12485-1-kernelfans%40gmail.com
patch subject: [PATCHv10 3/3] powerpc/smp: Allow hole in paca_ptrs to accommodate boot_cpu
config: powerpc-microwatt_defconfig (https://download.01.org/0day-ci/archive/20231228/202312281100.39B8MAEU-lkp@intel.com/config)
compiler: powerpc64le-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231228/202312281100.39B8MAEU-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312281100.39B8MAEU-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/build_bug.h:5,
                    from include/linux/container_of.h:5,
                    from include/linux/list.h:5,
                    from include/linux/smp.h:12,
                    from arch/powerpc/kernel/paca.c:6:
   arch/powerpc/kernel/paca.c: In function 'allocate_paca_ptrs':
>> arch/powerpc/kernel/paca.c:248:55: error: 'threads_in_core' undeclared (first use in this function); did you mean 'threads_per_core'?
     248 |         cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
         |                                                       ^~~~~~~~~~~~~~~
   include/linux/compiler.h:236:55: note: in definition of macro '__is_constexpr'
     236 |         (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
         |                                                       ^
   include/linux/minmax.h:92:25: note: in expansion of macro '__careful_cmp'
      92 | #define max(x, y)       __careful_cmp(max, x, y)
         |                         ^~~~~~~~~~~~~
   arch/powerpc/kernel/paca.c:248:15: note: in expansion of macro 'max'
     248 |         cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
         |               ^~~
   include/uapi/linux/const.h:31:41: note: in expansion of macro '__ALIGN_KERNEL_MASK'
      31 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ^~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ^~~~~~~~~~~~~~
   arch/powerpc/kernel/paca.c:248:33: note: in expansion of macro 'ALIGN'
     248 |         cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
         |                                 ^~~~~
   arch/powerpc/kernel/paca.c:248:55: note: each undeclared identifier is reported only once for each function it appears in
     248 |         cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
         |                                                       ^~~~~~~~~~~~~~~
   include/linux/compiler.h:236:55: note: in definition of macro '__is_constexpr'
     236 |         (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
         |                                                       ^
   include/linux/minmax.h:92:25: note: in expansion of macro '__careful_cmp'
      92 | #define max(x, y)       __careful_cmp(max, x, y)
         |                         ^~~~~~~~~~~~~
   arch/powerpc/kernel/paca.c:248:15: note: in expansion of macro 'max'
     248 |         cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
         |               ^~~
   include/uapi/linux/const.h:31:41: note: in expansion of macro '__ALIGN_KERNEL_MASK'
      31 | #define __ALIGN_KERNEL(x, a)            __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
         |                                         ^~~~~~~~~~~~~~~~~~~
   include/linux/align.h:8:33: note: in expansion of macro '__ALIGN_KERNEL'
       8 | #define ALIGN(x, a)             __ALIGN_KERNEL((x), (a))
         |                                 ^~~~~~~~~~~~~~
   arch/powerpc/kernel/paca.c:248:33: note: in expansion of macro 'ALIGN'
     248 |         cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
         |                                 ^~~~~
   include/linux/minmax.h:31:9: error: first argument to '__builtin_choose_expr' not a constant
      31 |         __builtin_choose_expr(__is_constexpr(is_signed_type(typeof(x))),        \
         |         ^~~~~~~~~~~~~~~~~~~~~
   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/minmax.h:51:9: note: in expansion of macro 'static_assert'
      51 |         static_assert(__types_ok(x, y),                 \
         |         ^~~~~~~~~~~~~
   include/linux/minmax.h:39:10: note: in expansion of macro '__is_signed'
      39 |         (__is_signed(x) == __is_signed(y) ||                    \
         |          ^~~~~~~~~~~
   include/linux/minmax.h:51:23: note: in expansion of macro '__types_ok'
      51 |         static_assert(__types_ok(x, y),                 \
         |                       ^~~~~~~~~~
   include/linux/minmax.h:58:17: note: in expansion of macro '__cmp_once'
      58 |                 __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
         |                 ^~~~~~~~~~
   include/linux/minmax.h:92:25: note: in expansion of macro '__careful_cmp'
      92 | #define max(x, y)       __careful_cmp(max, x, y)
         |                         ^~~~~~~~~~~~~
   arch/powerpc/kernel/paca.c:248:15: note: in expansion of macro 'max'
     248 |         cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
         |               ^~~
   include/linux/minmax.h:31:9: error: first argument to '__builtin_choose_expr' not a constant
      31 |         __builtin_choose_expr(__is_constexpr(is_signed_type(typeof(x))),        \
         |         ^~~~~~~~~~~~~~~~~~~~~
   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/minmax.h:51:9: note: in expansion of macro 'static_assert'
      51 |         static_assert(__types_ok(x, y),                 \
         |         ^~~~~~~~~~~~~
   include/linux/minmax.h:40:17: note: in expansion of macro '__is_signed'
      40 |                 __is_signed((x) + 0) == __is_signed((y) + 0) || \
         |                 ^~~~~~~~~~~
   include/linux/minmax.h:51:23: note: in expansion of macro '__types_ok'
      51 |         static_assert(__types_ok(x, y),                 \
         |                       ^~~~~~~~~~
   include/linux/minmax.h:58:17: note: in expansion of macro '__cmp_once'
      58 |                 __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
         |                 ^~~~~~~~~~
   include/linux/minmax.h:92:25: note: in expansion of macro '__careful_cmp'
      92 | #define max(x, y)       __careful_cmp(max, x, y)
         |                         ^~~~~~~~~~~~~
   arch/powerpc/kernel/paca.c:248:15: note: in expansion of macro 'max'
     248 |         cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
         |               ^~~
   include/linux/minmax.h:31:9: error: first argument to '__builtin_choose_expr' not a constant
      31 |         __builtin_choose_expr(__is_constexpr(is_signed_type(typeof(x))),        \
         |         ^~~~~~~~~~~~~~~~~~~~~
   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/minmax.h:51:9: note: in expansion of macro 'static_assert'
      51 |         static_assert(__types_ok(x, y),                 \
         |         ^~~~~~~~~~~~~
   include/linux/minmax.h:36:53: note: in expansion of macro '__is_signed'
      36 |         (__builtin_choose_expr(__is_constexpr(x) && __is_signed(x), x, -1) >= 0)


vim +248 arch/powerpc/kernel/paca.c

   242	
   243	void __init allocate_paca_ptrs(void)
   244	{
   245		unsigned int cnt;
   246	
   247		/* paca_ptrs should be big enough to hold boot cpu */
 > 248		cnt = max((unsigned int)ALIGN(boot_cpuid + 1, threads_in_core), nr_cpu_ids);
   249		paca_last_cpu_num = cnt;
   250		paca_ptrs_size = sizeof(struct paca_struct *) * cnt;
   251		paca_ptrs = memblock_alloc_raw(paca_ptrs_size, SMP_CACHE_BYTES);
   252		if (!paca_ptrs)
   253			panic("Failed to allocate %d bytes for paca pointers\n",
   254			      paca_ptrs_size);
   255	
   256		memset(paca_ptrs, 0x88, paca_ptrs_size);
   257	}
   258	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-12-28  4:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-27  2:39 [PATCHv10 0/3] enable nr_cpus for powerpc without re-ordering cpu number Pingfan Liu
2023-12-27  2:39 ` [PATCHv10 1/3] powerpc/kernel: Remove check on paca_ptrs_size Pingfan Liu
2023-12-27  2:41 ` [PATCHv10 2/3] powerpc/kernel: Extend arrays' size to make room for a hole in cpu_possible_mask Pingfan Liu
2023-12-27 19:52   ` kernel test robot
2023-12-27  2:41 ` [PATCHv10 3/3] powerpc/smp: Allow hole in paca_ptrs to accommodate boot_cpu Pingfan Liu
2023-12-27 20:45   ` kernel test robot
2023-12-28  4:07   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).