Unverified Commit 80da2afd authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3374 cpumask: cleanup nr_cpu_ids vs nr_cpumask_bits mess

Merge Pull Request from: @ci-robot 
 
PR sync from: Lu Jialin <lujialin4@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/SFJYVDZZ2MMENFD7HZX6O7KWCBB7KY5R/ 
From: Zheng Zucheng <zhengzucheng@huawei.com>

cpumask subsystem uses nr_cpu_ids and nr_cpumask_bits interchangeably
despite that the variables have different meaning and purpose. It makes
some cpumask functions broken.

This series cleans that mess and adds new config FORCE_NR_CPUS that
allows to optimize cpumask subsystem if the number of CPUs is known
at compile-time.

After some testing I found build broken when SMP is on and NR_CPUS == 1.
This is addressed in a new patch #1, and in the following patch #2 that
now declares set_nr_cpu_ids in cpumask.h (was in smp.h).

Yury Norov (6):
  smp: don't declare nr_cpu_ids if NR_CPUS == 1
  smp: add set_nr_cpu_ids()
  lib/cpumask: delete misleading comment
  lib/cpumask: deprecate nr_cpumask_bits
  lib/cpumask: add FORCE_NR_CPUS config option
  powerpc/64: don't refer nr_cpu_ids in asm code when it's undefined

Zheng Zucheng (1):
  config: Add FORCE_NR_CPUS to openeuler_defconfig


-- 
2.34.1
 
https://gitee.com/openeuler/kernel/issues/I8KQBZ 
 
Link:https://gitee.com/openeuler/kernel/pulls/3374

 

Reviewed-by: default avatarLiu Chao <liuchao173@huawei.com>
Reviewed-by: default avatarZhang Jianhua <chris.zjh@huawei.com>
Reviewed-by: default avatarHongchen Zhang <zhanghongchen@loongson.cn>
Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents db10ed58 1170e985
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7074,6 +7074,7 @@ CONFIG_CMA_ALIGNMENT=8
CONFIG_DMA_MAP_BENCHMARK=y
CONFIG_SGL_ALLOC=y
CONFIG_CHECK_SIGNATURE=y
# CONFIG_FORCE_NR_CPUS is not set
CONFIG_CPU_RMAP=y
CONFIG_DQL=y
CONFIG_GLOB=y
+1 −1
Original line number Diff line number Diff line
@@ -526,7 +526,7 @@ static void __init prefill_possible_map(void)
	for (; i < NR_CPUS; i++)
		set_cpu_possible(i, false);

	nr_cpu_ids = possible;
	set_nr_cpu_ids(possible);
}
#endif

+1 −1
Original line number Diff line number Diff line
@@ -756,7 +756,7 @@ static void __init prefill_possible_map(void)
	for (; i < NR_CPUS; i++)
		set_cpu_possible(i, false);

	nr_cpu_ids = possible;
	set_nr_cpu_ids(possible);
}
#else
static inline void prefill_possible_map(void) {}
+4 −0
Original line number Diff line number Diff line
@@ -398,8 +398,12 @@ generic_secondary_common_init:
#else
	LOAD_REG_ADDR(r8, paca_ptrs)	/* Load paca_ptrs pointe	 */
	ld	r8,0(r8)		/* Get base vaddr of array	 */
#if (NR_CPUS == 1) || defined(CONFIG_FORCE_NR_CPUS)
	LOAD_REG_IMMEDIATE(r7, NR_CPUS)
#else
	LOAD_REG_ADDR(r7, nr_cpu_ids)	/* Load nr_cpu_ids address       */
	lwz	r7,0(r7)		/* also the max paca allocated 	 */
#endif
	li	r5,0			/* logical cpu id                */
1:
	sldi	r9,r5,3			/* get paca_ptrs[] index from cpu id */
+1 −0
Original line number Diff line number Diff line
@@ -8135,6 +8135,7 @@ CONFIG_DMA_COHERENT_POOL=y
CONFIG_SGL_ALLOC=y
CONFIG_CHECK_SIGNATURE=y
CONFIG_CPUMASK_OFFSTACK=y
# CONFIG_FORCE_NR_CPUS is not set
CONFIG_CPU_RMAP=y
CONFIG_DQL=y
CONFIG_GLOB=y
Loading