All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] rcu/nocb: Delete local variable 'need_rcu_nocb_mask' in rcu_init_nohz()
@ 2022-08-16 12:48 Zhen Lei
  2022-08-16 12:48 ` [PATCH v3 1/2] rcu: Eliminate rcu_state.nocb_is_setup Zhen Lei
  2022-08-16 12:48 ` [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz() Zhen Lei
  0 siblings, 2 replies; 10+ messages in thread
From: Zhen Lei @ 2022-08-16 12:48 UTC (permalink / raw)
  To: Paul E . McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	Joel Fernandes, rcu, linux-kernel
  Cc: Zhen Lei

v2 --> v3:
1. Eliminate rcu_state.nocb_is_setup
2. Update the code based on the above patch and commit b37a667c6242
   ("rcu/nocb: Add an option to offload all CPUs on boot").

Test cases and test results as below:

 ----------------------------------------------------------------------
| CONFIG_NO_HZ_FULL  | CONFIG_RCU_NOCB_CPU_DEFAULT_ALL |    cmdline    |
 ----------------------------------------------------------------------
1)         N         |                 N               |     none      |
2)         N         |                 N               | rcu_nocbs=1-2 |
3)         Y         |                 N               | nohz_full=1-2 |
4)         Y         |                 Y               |     none      |
 ----------------------------------------------------------------------

1)
[ 1085.691770] rcu-torture:--- End of test: SUCCESS: (default)
root@genericarmv8:~# dmesg | grep "Offload RCU callbacks"
[    0.000000] rcu:     Offload RCU callbacks from CPUs: (none).
root@genericarmv8:~# zcat /proc/config.gz | grep NOCB
CONFIG_RCU_NOCB_CPU=y
# CONFIG_RCU_NOCB_CPU_DEFAULT_ALL is not set
root@genericarmv8:~# zcat /proc/config.gz | grep NO_HZ_FULL
# CONFIG_NO_HZ_FULL is not set
root@genericarmv8:~# cat /proc/cmdline
console=ttyAMA0 root=/dev/vda2 crashkernel=256M@ee000000

2)
[ 1022.532198] rcu-torture:--- End of test: SUCCESS: (default)
root@genericarmv8:~# dmesg | grep "Offload RCU callbacks"
[    0.000000] rcu:     Offload RCU callbacks from CPUs: 1-2.
root@genericarmv8:~# zcat /proc/config.gz | grep NOCB
CONFIG_RCU_NOCB_CPU=y
# CONFIG_RCU_NOCB_CPU_DEFAULT_ALL is not set
root@genericarmv8:~# zcat /proc/config.gz | grep NO_HZ_FULL
# CONFIG_NO_HZ_FULL is not set
root@genericarmv8:~# cat /proc/cmdline
console=ttyAMA0 root=/dev/vda2 crashkernel=256M@ee000000 rcu_nocbs=1-2

3)
[ 1011.714712] rcu-torture:--- End of test: SUCCESS: (default)
root@genericarmv8:~# dmesg | grep "Offload RCU callbacks"
[    0.000000] rcu:     Offload RCU callbacks from CPUs: 1-2.
root@genericarmv8:~# zcat /proc/config.gz | grep NOCB
CONFIG_RCU_NOCB_CPU=y
# CONFIG_RCU_NOCB_CPU_DEFAULT_ALL is not set
root@genericarmv8:~# zcat /proc/config.gz | grep NO_HZ_FULL
CONFIG_NO_HZ_FULL=y
root@genericarmv8:~# cat /proc/cmdline
console=ttyAMA0 root=/dev/vda2 crashkernel=256M@ee000000 nohz_full=1-2

4)
[ 1031.047094] rcu-torture:--- End of test: SUCCESS: (default)
root@genericarmv8:~# dmesg | grep "Offload RCU callbacks"
[    0.000000] rcu:     Offload RCU callbacks from CPUs: 0-3.
root@genericarmv8:~# zcat /proc/config.gz | grep NOCB
CONFIG_RCU_NOCB_CPU=y
CONFIG_RCU_NOCB_CPU_DEFAULT_ALL=y
root@genericarmv8:~# zcat /proc/config.gz | grep NO_HZ_FULL
CONFIG_NO_HZ_FULL=y
root@genericarmv8:~# cat /proc/cmdline
console=ttyAMA0 root=/dev/vda2 crashkernel=256M@ee000000


v1 --> v2:
Update commit message.

Zhen Lei (2):
  rcu: Eliminate rcu_state.nocb_is_setup
  rcu: Simplify the code logic of rcu_init_nohz()

 kernel/rcu/tree.h      |  1 -
 kernel/rcu/tree_nocb.h | 38 +++++++++++---------------------------
 2 files changed, 11 insertions(+), 28 deletions(-)

-- 
2.25.1


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

* [PATCH v3 1/2] rcu: Eliminate rcu_state.nocb_is_setup
  2022-08-16 12:48 [PATCH v3 0/2] rcu/nocb: Delete local variable 'need_rcu_nocb_mask' in rcu_init_nohz() Zhen Lei
@ 2022-08-16 12:48 ` Zhen Lei
  2022-08-16 12:48 ` [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz() Zhen Lei
  1 sibling, 0 replies; 10+ messages in thread
From: Zhen Lei @ 2022-08-16 12:48 UTC (permalink / raw)
  To: Paul E . McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	Joel Fernandes, rcu, linux-kernel
  Cc: Zhen Lei

'rcu_state.nocb_is_setup' is initialized to true only if 'rcu_nocb_mask'
successfully allocates memory. So it can be replaced by
'cpumask_available(rcu_nocb_mask)'. More importantly, the latter is more
intuitive, and it has been used in several places.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 kernel/rcu/tree.h      | 1 -
 kernel/rcu/tree_nocb.h | 8 +++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index d4a97e40ea9c3e2..06f659c63d2d192 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -375,7 +375,6 @@ struct rcu_state {
 	arch_spinlock_t ofl_lock ____cacheline_internodealigned_in_smp;
 						/* Synchronize offline with */
 						/*  GP pre-initialization. */
-	int nocb_is_setup;			/* nocb is setup from boot */
 };
 
 /* Values for rcu_state structure's gp_flags field. */
diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
index 0a5f0ef41484518..ff763e7dc53551f 100644
--- a/kernel/rcu/tree_nocb.h
+++ b/kernel/rcu/tree_nocb.h
@@ -69,7 +69,6 @@ static int __init rcu_nocb_setup(char *str)
 			cpumask_setall(rcu_nocb_mask);
 		}
 	}
-	rcu_state.nocb_is_setup = true;
 	return 1;
 }
 __setup("rcu_nocbs", rcu_nocb_setup);
@@ -1215,7 +1214,7 @@ void __init rcu_init_nohz(void)
 	struct rcu_data *rdp;
 
 #if defined(CONFIG_RCU_NOCB_CPU_DEFAULT_ALL)
-	if (!rcu_state.nocb_is_setup) {
+	if (!cpumask_available(rcu_nocb_mask)) {
 		need_rcu_nocb_mask = true;
 		offload_all = true;
 	}
@@ -1235,10 +1234,9 @@ void __init rcu_init_nohz(void)
 				return;
 			}
 		}
-		rcu_state.nocb_is_setup = true;
 	}
 
-	if (!rcu_state.nocb_is_setup)
+	if (!cpumask_available(rcu_nocb_mask))
 		return;
 
 #if defined(CONFIG_NO_HZ_FULL)
@@ -1299,7 +1297,7 @@ static void rcu_spawn_cpu_nocb_kthread(int cpu)
 	struct task_struct *t;
 	struct sched_param sp;
 
-	if (!rcu_scheduler_fully_active || !rcu_state.nocb_is_setup)
+	if (!rcu_scheduler_fully_active || !cpumask_available(rcu_nocb_mask))
 		return;
 
 	/* If there already is an rcuo kthread, then nothing to do. */
-- 
2.25.1


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

* [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz()
  2022-08-16 12:48 [PATCH v3 0/2] rcu/nocb: Delete local variable 'need_rcu_nocb_mask' in rcu_init_nohz() Zhen Lei
  2022-08-16 12:48 ` [PATCH v3 1/2] rcu: Eliminate rcu_state.nocb_is_setup Zhen Lei
@ 2022-08-16 12:48 ` Zhen Lei
  2022-08-16 19:55   ` kernel test robot
                     ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Zhen Lei @ 2022-08-16 12:48 UTC (permalink / raw)
  To: Paul E . McKenney, Frederic Weisbecker, Neeraj Upadhyay,
	Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	Joel Fernandes, rcu, linux-kernel
  Cc: Zhen Lei

When CONFIG_RCU_NOCB_CPU_DEFAULT_ALL=y or CONFIG_NO_HZ_FULL=y, additional
CPUs need to be added to 'rcu_nocb_mask'. But 'rcu_nocb_mask' may be not
available now, due to 'rcu_nocbs' is not specified. Check and initialize
'rcu_nocb_mask' before using it. This code simplification strictly follows
this logic, compared with old implementations, unnecessary crossovers are
avoided and easy to understand.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 kernel/rcu/tree_nocb.h | 32 +++++++++-----------------------
 1 file changed, 9 insertions(+), 23 deletions(-)

diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
index ff763e7dc53551f..07b415e8117a10a 100644
--- a/kernel/rcu/tree_nocb.h
+++ b/kernel/rcu/tree_nocb.h
@@ -1209,44 +1209,30 @@ EXPORT_SYMBOL_GPL(rcu_nocb_cpu_offload);
 void __init rcu_init_nohz(void)
 {
 	int cpu;
-	bool need_rcu_nocb_mask = false;
-	bool offload_all = false;
 	struct rcu_data *rdp;
+	struct cpumask *cpumask = NULL;
 
 #if defined(CONFIG_RCU_NOCB_CPU_DEFAULT_ALL)
-	if (!cpumask_available(rcu_nocb_mask)) {
-		need_rcu_nocb_mask = true;
-		offload_all = true;
-	}
-#endif /* #if defined(CONFIG_RCU_NOCB_CPU_DEFAULT_ALL) */
-
-#if defined(CONFIG_NO_HZ_FULL)
-	if (tick_nohz_full_running && !cpumask_empty(tick_nohz_full_mask)) {
-		need_rcu_nocb_mask = true;
-		offload_all = false; /* NO_HZ_FULL has its own mask. */
-	}
-#endif /* #if defined(CONFIG_NO_HZ_FULL) */
+	cpumask = cpu_possible_mask;
+#elif defined(CONFIG_NO_HZ_FULL)
+	if (tick_nohz_full_running && !cpumask_empty(tick_nohz_full_mask))
+		cpumask = tick_nohz_full_mask;
+#endif
 
-	if (need_rcu_nocb_mask) {
+	if (cpumask) {
 		if (!cpumask_available(rcu_nocb_mask)) {
 			if (!zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL)) {
 				pr_info("rcu_nocb_mask allocation failed, callback offloading disabled.\n");
 				return;
 			}
 		}
+
+		cpumask_or(rcu_nocb_mask, rcu_nocb_mask, cpumask);
 	}
 
 	if (!cpumask_available(rcu_nocb_mask))
 		return;
 
-#if defined(CONFIG_NO_HZ_FULL)
-	if (tick_nohz_full_running)
-		cpumask_or(rcu_nocb_mask, rcu_nocb_mask, tick_nohz_full_mask);
-#endif /* #if defined(CONFIG_NO_HZ_FULL) */
-
-	if (offload_all)
-		cpumask_setall(rcu_nocb_mask);
-
 	if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
 		pr_info("\tNote: kernel parameter 'rcu_nocbs=', 'nohz_full', or 'isolcpus=' contains nonexistent CPUs.\n");
 		cpumask_and(rcu_nocb_mask, cpu_possible_mask,
-- 
2.25.1


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

* Re: [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz()
  2022-08-16 12:48 ` [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz() Zhen Lei
@ 2022-08-16 19:55   ` kernel test robot
  2022-08-17  1:22       ` Leizhen
  2022-08-17 22:16   ` kernel test robot
  2022-08-18  1:19   ` kernel test robot
  2 siblings, 1 reply; 10+ messages in thread
From: kernel test robot @ 2022-08-16 19:55 UTC (permalink / raw)
  To: Zhen Lei, Paul E . McKenney, Frederic Weisbecker,
	Neeraj Upadhyay, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes, rcu,
	linux-kernel
  Cc: kbuild-all, Zhen Lei

Hi Zhen,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on paulmck-rcu/dev]
[also build test WARNING on linus/master v6.0-rc1 next-20220816]
[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/Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
base:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
config: x86_64-randconfig-a004-20220815 (https://download.01.org/0day-ci/archive/20220817/202208170309.j1yYU9wN-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/a1d5079765918764de3ff6e3e63fa2db7f7c14df
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
        git checkout a1d5079765918764de3ff6e3e63fa2db7f7c14df
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash kernel/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from kernel/rcu/tree.c:4801:
   kernel/rcu/tree_nocb.h: In function 'rcu_init_nohz':
>> kernel/rcu/tree_nocb.h:1216:17: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
    1216 |         cpumask = cpu_possible_mask;
         |                 ^


vim +/const +1216 kernel/rcu/tree_nocb.h

  1208	
  1209	void __init rcu_init_nohz(void)
  1210	{
  1211		int cpu;
  1212		struct rcu_data *rdp;
  1213		struct cpumask *cpumask = NULL;
  1214	
  1215	#if defined(CONFIG_RCU_NOCB_CPU_DEFAULT_ALL)
> 1216		cpumask = cpu_possible_mask;
  1217	#elif defined(CONFIG_NO_HZ_FULL)
  1218		if (tick_nohz_full_running && !cpumask_empty(tick_nohz_full_mask))
  1219			cpumask = tick_nohz_full_mask;
  1220	#endif
  1221	
  1222		if (cpumask) {
  1223			if (!cpumask_available(rcu_nocb_mask)) {
  1224				if (!zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL)) {
  1225					pr_info("rcu_nocb_mask allocation failed, callback offloading disabled.\n");
  1226					return;
  1227				}
  1228			}
  1229	
  1230			cpumask_or(rcu_nocb_mask, rcu_nocb_mask, cpumask);
  1231		}
  1232	
  1233		if (!cpumask_available(rcu_nocb_mask))
  1234			return;
  1235	
  1236		if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
  1237			pr_info("\tNote: kernel parameter 'rcu_nocbs=', 'nohz_full', or 'isolcpus=' contains nonexistent CPUs.\n");
  1238			cpumask_and(rcu_nocb_mask, cpu_possible_mask,
  1239				    rcu_nocb_mask);
  1240		}
  1241		if (cpumask_empty(rcu_nocb_mask))
  1242			pr_info("\tOffload RCU callbacks from CPUs: (none).\n");
  1243		else
  1244			pr_info("\tOffload RCU callbacks from CPUs: %*pbl.\n",
  1245				cpumask_pr_args(rcu_nocb_mask));
  1246		if (rcu_nocb_poll)
  1247			pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
  1248	
  1249		for_each_cpu(cpu, rcu_nocb_mask) {
  1250			rdp = per_cpu_ptr(&rcu_data, cpu);
  1251			if (rcu_segcblist_empty(&rdp->cblist))
  1252				rcu_segcblist_init(&rdp->cblist);
  1253			rcu_segcblist_offload(&rdp->cblist, true);
  1254			rcu_segcblist_set_flags(&rdp->cblist, SEGCBLIST_KTHREAD_CB | SEGCBLIST_KTHREAD_GP);
  1255			rcu_segcblist_clear_flags(&rdp->cblist, SEGCBLIST_RCU_CORE);
  1256		}
  1257		rcu_organize_nocb_kthreads();
  1258	}
  1259	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz()
  2022-08-16 19:55   ` kernel test robot
@ 2022-08-17  1:22       ` Leizhen
  0 siblings, 0 replies; 10+ messages in thread
From: Leizhen (ThunderTown) @ 2022-08-17  1:22 UTC (permalink / raw)
  To: kernel test robot, Paul E . McKenney, Frederic Weisbecker,
	Neeraj Upadhyay, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes, rcu,
	linux-kernel
  Cc: kbuild-all



On 2022/8/17 3:55, kernel test robot wrote:
> Hi Zhen,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on paulmck-rcu/dev]
> [also build test WARNING on linus/master v6.0-rc1 next-20220816]
> [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/Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
> config: x86_64-randconfig-a004-20220815 (https://download.01.org/0day-ci/archive/20220817/202208170309.j1yYU9wN-lkp@intel.com/config)
> compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
> reproduce (this is a W=1 build):
>         # https://github.com/intel-lab-lkp/linux/commit/a1d5079765918764de3ff6e3e63fa2db7f7c14df
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
>         git checkout a1d5079765918764de3ff6e3e63fa2db7f7c14df
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash kernel/
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from kernel/rcu/tree.c:4801:
>    kernel/rcu/tree_nocb.h: In function 'rcu_init_nohz':
>>> kernel/rcu/tree_nocb.h:1216:17: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>     1216 |         cpumask = cpu_possible_mask;
>          |                 ^
> 
> 
> vim +/const +1216 kernel/rcu/tree_nocb.h

It's a shame. Sorry, I forgot to check "> error.txt".

> 
>   1208	
>   1209	void __init rcu_init_nohz(void)
>   1210	{
>   1211		int cpu;
>   1212		struct rcu_data *rdp;
>   1213		struct cpumask *cpumask = NULL;
>   1214	
>   1215	#if defined(CONFIG_RCU_NOCB_CPU_DEFAULT_ALL)
>> 1216		cpumask = cpu_possible_mask;
>   1217	#elif defined(CONFIG_NO_HZ_FULL)
>   1218		if (tick_nohz_full_running && !cpumask_empty(tick_nohz_full_mask))
>   1219			cpumask = tick_nohz_full_mask;
>   1220	#endif
>   1221	
>   1222		if (cpumask) {
>   1223			if (!cpumask_available(rcu_nocb_mask)) {
>   1224				if (!zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL)) {
>   1225					pr_info("rcu_nocb_mask allocation failed, callback offloading disabled.\n");
>   1226					return;
>   1227				}
>   1228			}
>   1229	
>   1230			cpumask_or(rcu_nocb_mask, rcu_nocb_mask, cpumask);
>   1231		}
>   1232	
>   1233		if (!cpumask_available(rcu_nocb_mask))
>   1234			return;
>   1235	
>   1236		if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
>   1237			pr_info("\tNote: kernel parameter 'rcu_nocbs=', 'nohz_full', or 'isolcpus=' contains nonexistent CPUs.\n");
>   1238			cpumask_and(rcu_nocb_mask, cpu_possible_mask,
>   1239				    rcu_nocb_mask);
>   1240		}
>   1241		if (cpumask_empty(rcu_nocb_mask))
>   1242			pr_info("\tOffload RCU callbacks from CPUs: (none).\n");
>   1243		else
>   1244			pr_info("\tOffload RCU callbacks from CPUs: %*pbl.\n",
>   1245				cpumask_pr_args(rcu_nocb_mask));
>   1246		if (rcu_nocb_poll)
>   1247			pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
>   1248	
>   1249		for_each_cpu(cpu, rcu_nocb_mask) {
>   1250			rdp = per_cpu_ptr(&rcu_data, cpu);
>   1251			if (rcu_segcblist_empty(&rdp->cblist))
>   1252				rcu_segcblist_init(&rdp->cblist);
>   1253			rcu_segcblist_offload(&rdp->cblist, true);
>   1254			rcu_segcblist_set_flags(&rdp->cblist, SEGCBLIST_KTHREAD_CB | SEGCBLIST_KTHREAD_GP);
>   1255			rcu_segcblist_clear_flags(&rdp->cblist, SEGCBLIST_RCU_CORE);
>   1256		}
>   1257		rcu_organize_nocb_kthreads();
>   1258	}
>   1259	
> 

-- 
Regards,
  Zhen Lei

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

* Re: [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz()
@ 2022-08-17  1:22       ` Leizhen
  0 siblings, 0 replies; 10+ messages in thread
From: Leizhen @ 2022-08-17  1:22 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4164 bytes --]



On 2022/8/17 3:55, kernel test robot wrote:
> Hi Zhen,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on paulmck-rcu/dev]
> [also build test WARNING on linus/master v6.0-rc1 next-20220816]
> [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/Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
> config: x86_64-randconfig-a004-20220815 (https://download.01.org/0day-ci/archive/20220817/202208170309.j1yYU9wN-lkp(a)intel.com/config)
> compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
> reproduce (this is a W=1 build):
>         # https://github.com/intel-lab-lkp/linux/commit/a1d5079765918764de3ff6e3e63fa2db7f7c14df
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
>         git checkout a1d5079765918764de3ff6e3e63fa2db7f7c14df
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash kernel/
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from kernel/rcu/tree.c:4801:
>    kernel/rcu/tree_nocb.h: In function 'rcu_init_nohz':
>>> kernel/rcu/tree_nocb.h:1216:17: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>     1216 |         cpumask = cpu_possible_mask;
>          |                 ^
> 
> 
> vim +/const +1216 kernel/rcu/tree_nocb.h

It's a shame. Sorry, I forgot to check "> error.txt".

> 
>   1208	
>   1209	void __init rcu_init_nohz(void)
>   1210	{
>   1211		int cpu;
>   1212		struct rcu_data *rdp;
>   1213		struct cpumask *cpumask = NULL;
>   1214	
>   1215	#if defined(CONFIG_RCU_NOCB_CPU_DEFAULT_ALL)
>> 1216		cpumask = cpu_possible_mask;
>   1217	#elif defined(CONFIG_NO_HZ_FULL)
>   1218		if (tick_nohz_full_running && !cpumask_empty(tick_nohz_full_mask))
>   1219			cpumask = tick_nohz_full_mask;
>   1220	#endif
>   1221	
>   1222		if (cpumask) {
>   1223			if (!cpumask_available(rcu_nocb_mask)) {
>   1224				if (!zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL)) {
>   1225					pr_info("rcu_nocb_mask allocation failed, callback offloading disabled.\n");
>   1226					return;
>   1227				}
>   1228			}
>   1229	
>   1230			cpumask_or(rcu_nocb_mask, rcu_nocb_mask, cpumask);
>   1231		}
>   1232	
>   1233		if (!cpumask_available(rcu_nocb_mask))
>   1234			return;
>   1235	
>   1236		if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
>   1237			pr_info("\tNote: kernel parameter 'rcu_nocbs=', 'nohz_full', or 'isolcpus=' contains nonexistent CPUs.\n");
>   1238			cpumask_and(rcu_nocb_mask, cpu_possible_mask,
>   1239				    rcu_nocb_mask);
>   1240		}
>   1241		if (cpumask_empty(rcu_nocb_mask))
>   1242			pr_info("\tOffload RCU callbacks from CPUs: (none).\n");
>   1243		else
>   1244			pr_info("\tOffload RCU callbacks from CPUs: %*pbl.\n",
>   1245				cpumask_pr_args(rcu_nocb_mask));
>   1246		if (rcu_nocb_poll)
>   1247			pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
>   1248	
>   1249		for_each_cpu(cpu, rcu_nocb_mask) {
>   1250			rdp = per_cpu_ptr(&rcu_data, cpu);
>   1251			if (rcu_segcblist_empty(&rdp->cblist))
>   1252				rcu_segcblist_init(&rdp->cblist);
>   1253			rcu_segcblist_offload(&rdp->cblist, true);
>   1254			rcu_segcblist_set_flags(&rdp->cblist, SEGCBLIST_KTHREAD_CB | SEGCBLIST_KTHREAD_GP);
>   1255			rcu_segcblist_clear_flags(&rdp->cblist, SEGCBLIST_RCU_CORE);
>   1256		}
>   1257		rcu_organize_nocb_kthreads();
>   1258	}
>   1259	
> 

-- 
Regards,
  Zhen Lei

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

* Re: [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz()
  2022-08-16 12:48 ` [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz() Zhen Lei
  2022-08-16 19:55   ` kernel test robot
@ 2022-08-17 22:16   ` kernel test robot
  2022-08-18  1:19   ` kernel test robot
  2 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2022-08-17 22:16 UTC (permalink / raw)
  To: Zhen Lei, Paul E . McKenney, Frederic Weisbecker,
	Neeraj Upadhyay, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes, rcu,
	linux-kernel
  Cc: kbuild-all, Zhen Lei

Hi Zhen,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on paulmck-rcu/dev]
[also build test WARNING on linus/master v6.0-rc1 next-20220817]
[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/Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
base:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
config: s390-randconfig-s052-20220818 (https://download.01.org/0day-ci/archive/20220818/202208180612.UVvfRJSR-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 12.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/intel-lab-lkp/linux/commit/a1d5079765918764de3ff6e3e63fa2db7f7c14df
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
        git checkout a1d5079765918764de3ff6e3e63fa2db7f7c14df
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

sparse warnings: (new ones prefixed by >>)
   kernel/rcu/tree.c: note: in included file:
>> kernel/rcu/tree_nocb.h:1216:17: sparse: sparse: incorrect type in assignment (different modifiers) @@     expected struct cpumask *cpumask @@     got struct cpumask const * @@
   kernel/rcu/tree_nocb.h:1216:17: sparse:     expected struct cpumask *cpumask
   kernel/rcu/tree_nocb.h:1216:17: sparse:     got struct cpumask const *
   kernel/rcu/tree.c:1032:9: sparse: sparse: context imbalance in 'rcu_start_this_gp' - different lock contexts for basic block
   kernel/rcu/tree.c:1413:9: sparse: sparse: context imbalance in 'rcu_poll_gp_seq_start_unlocked' - different lock contexts for basic block
   kernel/rcu/tree.c:1428:9: sparse: sparse: context imbalance in 'rcu_poll_gp_seq_end_unlocked' - different lock contexts for basic block
   kernel/rcu/tree.c:1544:9: sparse: sparse: context imbalance in 'rcu_gp_init' - different lock contexts for basic block
   kernel/rcu/tree.c:2004:1: sparse: sparse: context imbalance in 'rcu_report_qs_rdp' - different lock contexts for basic block
   kernel/rcu/tree.c:2186:13: sparse: sparse: context imbalance in 'rcu_do_batch' - wrong count at exit
   kernel/rcu/tree.c:2371:9: sparse: sparse: context imbalance in 'force_qs_rnp' - different lock contexts for basic block
   kernel/rcu/tree.c:2424:25: sparse: sparse: context imbalance in 'rcu_force_quiescent_state' - unexpected unlock
   kernel/rcu/tree.c:2454:30: sparse: sparse: context imbalance in 'rcu_core' - different lock contexts for basic block
   kernel/rcu/tree.c: note: in included file:
   kernel/rcu/tree_exp.h:191:9: sparse: sparse: context imbalance in '__rcu_report_exp_rnp' - different lock contexts for basic block
   kernel/rcu/tree_exp.h:1032:9: sparse: sparse: context imbalance in 'start_poll_synchronize_rcu_expedited' - different lock contexts for basic block
   kernel/rcu/tree.c: note: in included file:
   kernel/rcu/tree_nocb.h:134:16: sparse: sparse: context imbalance in 'rcu_nocb_bypass_trylock' - wrong count at exit
   kernel/rcu/tree_nocb.h:151:13: sparse: sparse: context imbalance in 'rcu_nocb_lock' - wrong count at exit
   kernel/rcu/tree_nocb.h:167:17: sparse: sparse: context imbalance in 'rcu_nocb_unlock' - unexpected unlock
   kernel/rcu/tree_nocb.h:180:17: sparse: sparse: context imbalance in 'rcu_nocb_unlock_irqrestore' - unexpected unlock
   kernel/rcu/tree_nocb.h:312:9: sparse: sparse: context imbalance in 'rcu_nocb_do_flush_bypass' - unexpected unlock
   kernel/rcu/tree_nocb.h:327:13: sparse: sparse: context imbalance in 'rcu_nocb_flush_bypass' - wrong count at exit
   kernel/rcu/tree_nocb.h:489:13: sparse: sparse: context imbalance in '__call_rcu_nocb_wake' - wrong count at exit
   kernel/rcu/tree_nocb.h:581:9: sparse: sparse: context imbalance in 'nocb_gp_toggle_rdp' - wrong count at exit
   kernel/rcu/tree_nocb.h:635:9: sparse: sparse: context imbalance in 'nocb_gp_wait' - different lock contexts for basic block
   kernel/rcu/tree_nocb.h:888:9: sparse: sparse: context imbalance in 'nocb_cb_wait' - wrong count at exit
   kernel/rcu/tree_nocb.h:1002:9: sparse: sparse: context imbalance in 'rdp_offload_toggle' - wrong count at exit
   kernel/rcu/tree_nocb.h:1086:34: sparse: sparse: context imbalance in 'rcu_nocb_rdp_deoffload' - different lock contexts for basic block
   kernel/rcu/tree_nocb.h:1124:13: sparse: sparse: context imbalance in 'rcu_nocb_rdp_offload' - different lock contexts for basic block

vim +1216 kernel/rcu/tree_nocb.h

  1208	
  1209	void __init rcu_init_nohz(void)
  1210	{
  1211		int cpu;
  1212		struct rcu_data *rdp;
  1213		struct cpumask *cpumask = NULL;
  1214	
  1215	#if defined(CONFIG_RCU_NOCB_CPU_DEFAULT_ALL)
> 1216		cpumask = cpu_possible_mask;
  1217	#elif defined(CONFIG_NO_HZ_FULL)
  1218		if (tick_nohz_full_running && !cpumask_empty(tick_nohz_full_mask))
  1219			cpumask = tick_nohz_full_mask;
  1220	#endif
  1221	
  1222		if (cpumask) {
  1223			if (!cpumask_available(rcu_nocb_mask)) {
  1224				if (!zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL)) {
  1225					pr_info("rcu_nocb_mask allocation failed, callback offloading disabled.\n");
  1226					return;
  1227				}
  1228			}
  1229	
  1230			cpumask_or(rcu_nocb_mask, rcu_nocb_mask, cpumask);
  1231		}
  1232	
  1233		if (!cpumask_available(rcu_nocb_mask))
  1234			return;
  1235	
  1236		if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
  1237			pr_info("\tNote: kernel parameter 'rcu_nocbs=', 'nohz_full', or 'isolcpus=' contains nonexistent CPUs.\n");
  1238			cpumask_and(rcu_nocb_mask, cpu_possible_mask,
  1239				    rcu_nocb_mask);
  1240		}
  1241		if (cpumask_empty(rcu_nocb_mask))
  1242			pr_info("\tOffload RCU callbacks from CPUs: (none).\n");
  1243		else
  1244			pr_info("\tOffload RCU callbacks from CPUs: %*pbl.\n",
  1245				cpumask_pr_args(rcu_nocb_mask));
  1246		if (rcu_nocb_poll)
  1247			pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
  1248	
  1249		for_each_cpu(cpu, rcu_nocb_mask) {
  1250			rdp = per_cpu_ptr(&rcu_data, cpu);
  1251			if (rcu_segcblist_empty(&rdp->cblist))
  1252				rcu_segcblist_init(&rdp->cblist);
  1253			rcu_segcblist_offload(&rdp->cblist, true);
  1254			rcu_segcblist_set_flags(&rdp->cblist, SEGCBLIST_KTHREAD_CB | SEGCBLIST_KTHREAD_GP);
  1255			rcu_segcblist_clear_flags(&rdp->cblist, SEGCBLIST_RCU_CORE);
  1256		}
  1257		rcu_organize_nocb_kthreads();
  1258	}
  1259	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz()
  2022-08-16 12:48 ` [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz() Zhen Lei
  2022-08-16 19:55   ` kernel test robot
  2022-08-17 22:16   ` kernel test robot
@ 2022-08-18  1:19   ` kernel test robot
  2022-08-18  1:36       ` Leizhen
  2 siblings, 1 reply; 10+ messages in thread
From: kernel test robot @ 2022-08-18  1:19 UTC (permalink / raw)
  To: Zhen Lei, Paul E . McKenney, Frederic Weisbecker,
	Neeraj Upadhyay, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes, rcu,
	linux-kernel
  Cc: llvm, kbuild-all, Zhen Lei

Hi Zhen,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on paulmck-rcu/dev]
[also build test ERROR on linus/master v6.0-rc1 next-20220817]
[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/Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
base:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
config: hexagon-randconfig-r041-20220818 (https://download.01.org/0day-ci/archive/20220818/202208180940.Jks0rOXz-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project aed5e3bea138ce581d682158eb61c27b3cfdd6ec)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/a1d5079765918764de3ff6e3e63fa2db7f7c14df
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
        git checkout a1d5079765918764de3ff6e3e63fa2db7f7c14df
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash kernel/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from kernel/rcu/tree.c:4801:
>> kernel/rcu/tree_nocb.h:1216:10: error: assigning to 'struct cpumask *' from 'const struct cpumask *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           cpumask = cpu_possible_mask;
                   ^ ~~~~~~~~~~~~~~~~~
   1 error generated.


vim +1216 kernel/rcu/tree_nocb.h

  1208	
  1209	void __init rcu_init_nohz(void)
  1210	{
  1211		int cpu;
  1212		struct rcu_data *rdp;
  1213		struct cpumask *cpumask = NULL;
  1214	
  1215	#if defined(CONFIG_RCU_NOCB_CPU_DEFAULT_ALL)
> 1216		cpumask = cpu_possible_mask;
  1217	#elif defined(CONFIG_NO_HZ_FULL)
  1218		if (tick_nohz_full_running && !cpumask_empty(tick_nohz_full_mask))
  1219			cpumask = tick_nohz_full_mask;
  1220	#endif
  1221	
  1222		if (cpumask) {
  1223			if (!cpumask_available(rcu_nocb_mask)) {
  1224				if (!zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL)) {
  1225					pr_info("rcu_nocb_mask allocation failed, callback offloading disabled.\n");
  1226					return;
  1227				}
  1228			}
  1229	
  1230			cpumask_or(rcu_nocb_mask, rcu_nocb_mask, cpumask);
  1231		}
  1232	
  1233		if (!cpumask_available(rcu_nocb_mask))
  1234			return;
  1235	
  1236		if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
  1237			pr_info("\tNote: kernel parameter 'rcu_nocbs=', 'nohz_full', or 'isolcpus=' contains nonexistent CPUs.\n");
  1238			cpumask_and(rcu_nocb_mask, cpu_possible_mask,
  1239				    rcu_nocb_mask);
  1240		}
  1241		if (cpumask_empty(rcu_nocb_mask))
  1242			pr_info("\tOffload RCU callbacks from CPUs: (none).\n");
  1243		else
  1244			pr_info("\tOffload RCU callbacks from CPUs: %*pbl.\n",
  1245				cpumask_pr_args(rcu_nocb_mask));
  1246		if (rcu_nocb_poll)
  1247			pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
  1248	
  1249		for_each_cpu(cpu, rcu_nocb_mask) {
  1250			rdp = per_cpu_ptr(&rcu_data, cpu);
  1251			if (rcu_segcblist_empty(&rdp->cblist))
  1252				rcu_segcblist_init(&rdp->cblist);
  1253			rcu_segcblist_offload(&rdp->cblist, true);
  1254			rcu_segcblist_set_flags(&rdp->cblist, SEGCBLIST_KTHREAD_CB | SEGCBLIST_KTHREAD_GP);
  1255			rcu_segcblist_clear_flags(&rdp->cblist, SEGCBLIST_RCU_CORE);
  1256		}
  1257		rcu_organize_nocb_kthreads();
  1258	}
  1259	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz()
  2022-08-18  1:19   ` kernel test robot
@ 2022-08-18  1:36       ` Leizhen
  0 siblings, 0 replies; 10+ messages in thread
From: Leizhen (ThunderTown) @ 2022-08-18  1:36 UTC (permalink / raw)
  To: kernel test robot, Paul E . McKenney, Frederic Weisbecker,
	Neeraj Upadhyay, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes, rcu,
	linux-kernel
  Cc: llvm, kbuild-all



On 2022/8/18 9:19, kernel test robot wrote:
> Hi Zhen,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on paulmck-rcu/dev]
> [also build test ERROR on linus/master v6.0-rc1 next-20220817]
> [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/Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
> config: hexagon-randconfig-r041-20220818 (https://download.01.org/0day-ci/archive/20220818/202208180940.Jks0rOXz-lkp@intel.com/config)
> compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project aed5e3bea138ce581d682158eb61c27b3cfdd6ec)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/intel-lab-lkp/linux/commit/a1d5079765918764de3ff6e3e63fa2db7f7c14df
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
>         git checkout a1d5079765918764de3ff6e3e63fa2db7f7c14df
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash kernel/
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from kernel/rcu/tree.c:4801:
>>> kernel/rcu/tree_nocb.h:1216:10: error: assigning to 'struct cpumask *' from 'const struct cpumask *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
>            cpumask = cpu_possible_mask;
>                    ^ ~~~~~~~~~~~~~~~~~
>    1 error generated.

I fixed it yesterday and post v4. Please check for v4.

> 
> 
> vim +1216 kernel/rcu/tree_nocb.h
> 
>   1208	
>   1209	void __init rcu_init_nohz(void)
>   1210	{
>   1211		int cpu;
>   1212		struct rcu_data *rdp;
>   1213		struct cpumask *cpumask = NULL;
>   1214	
>   1215	#if defined(CONFIG_RCU_NOCB_CPU_DEFAULT_ALL)
>> 1216		cpumask = cpu_possible_mask;
>   1217	#elif defined(CONFIG_NO_HZ_FULL)
>   1218		if (tick_nohz_full_running && !cpumask_empty(tick_nohz_full_mask))
>   1219			cpumask = tick_nohz_full_mask;
>   1220	#endif
>   1221	
>   1222		if (cpumask) {
>   1223			if (!cpumask_available(rcu_nocb_mask)) {
>   1224				if (!zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL)) {
>   1225					pr_info("rcu_nocb_mask allocation failed, callback offloading disabled.\n");
>   1226					return;
>   1227				}
>   1228			}
>   1229	
>   1230			cpumask_or(rcu_nocb_mask, rcu_nocb_mask, cpumask);
>   1231		}
>   1232	
>   1233		if (!cpumask_available(rcu_nocb_mask))
>   1234			return;
>   1235	
>   1236		if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
>   1237			pr_info("\tNote: kernel parameter 'rcu_nocbs=', 'nohz_full', or 'isolcpus=' contains nonexistent CPUs.\n");
>   1238			cpumask_and(rcu_nocb_mask, cpu_possible_mask,
>   1239				    rcu_nocb_mask);
>   1240		}
>   1241		if (cpumask_empty(rcu_nocb_mask))
>   1242			pr_info("\tOffload RCU callbacks from CPUs: (none).\n");
>   1243		else
>   1244			pr_info("\tOffload RCU callbacks from CPUs: %*pbl.\n",
>   1245				cpumask_pr_args(rcu_nocb_mask));
>   1246		if (rcu_nocb_poll)
>   1247			pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
>   1248	
>   1249		for_each_cpu(cpu, rcu_nocb_mask) {
>   1250			rdp = per_cpu_ptr(&rcu_data, cpu);
>   1251			if (rcu_segcblist_empty(&rdp->cblist))
>   1252				rcu_segcblist_init(&rdp->cblist);
>   1253			rcu_segcblist_offload(&rdp->cblist, true);
>   1254			rcu_segcblist_set_flags(&rdp->cblist, SEGCBLIST_KTHREAD_CB | SEGCBLIST_KTHREAD_GP);
>   1255			rcu_segcblist_clear_flags(&rdp->cblist, SEGCBLIST_RCU_CORE);
>   1256		}
>   1257		rcu_organize_nocb_kthreads();
>   1258	}
>   1259	
> 

-- 
Regards,
  Zhen Lei

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

* Re: [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz()
@ 2022-08-18  1:36       ` Leizhen
  0 siblings, 0 replies; 10+ messages in thread
From: Leizhen @ 2022-08-18  1:36 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4437 bytes --]



On 2022/8/18 9:19, kernel test robot wrote:
> Hi Zhen,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on paulmck-rcu/dev]
> [also build test ERROR on linus/master v6.0-rc1 next-20220817]
> [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/Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
> config: hexagon-randconfig-r041-20220818 (https://download.01.org/0day-ci/archive/20220818/202208180940.Jks0rOXz-lkp(a)intel.com/config)
> compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project aed5e3bea138ce581d682158eb61c27b3cfdd6ec)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/intel-lab-lkp/linux/commit/a1d5079765918764de3ff6e3e63fa2db7f7c14df
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Zhen-Lei/rcu-nocb-Delete-local-variable-need_rcu_nocb_mask-in-rcu_init_nohz/20220816-205131
>         git checkout a1d5079765918764de3ff6e3e63fa2db7f7c14df
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash kernel/
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from kernel/rcu/tree.c:4801:
>>> kernel/rcu/tree_nocb.h:1216:10: error: assigning to 'struct cpumask *' from 'const struct cpumask *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
>            cpumask = cpu_possible_mask;
>                    ^ ~~~~~~~~~~~~~~~~~
>    1 error generated.

I fixed it yesterday and post v4. Please check for v4.

> 
> 
> vim +1216 kernel/rcu/tree_nocb.h
> 
>   1208	
>   1209	void __init rcu_init_nohz(void)
>   1210	{
>   1211		int cpu;
>   1212		struct rcu_data *rdp;
>   1213		struct cpumask *cpumask = NULL;
>   1214	
>   1215	#if defined(CONFIG_RCU_NOCB_CPU_DEFAULT_ALL)
>> 1216		cpumask = cpu_possible_mask;
>   1217	#elif defined(CONFIG_NO_HZ_FULL)
>   1218		if (tick_nohz_full_running && !cpumask_empty(tick_nohz_full_mask))
>   1219			cpumask = tick_nohz_full_mask;
>   1220	#endif
>   1221	
>   1222		if (cpumask) {
>   1223			if (!cpumask_available(rcu_nocb_mask)) {
>   1224				if (!zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL)) {
>   1225					pr_info("rcu_nocb_mask allocation failed, callback offloading disabled.\n");
>   1226					return;
>   1227				}
>   1228			}
>   1229	
>   1230			cpumask_or(rcu_nocb_mask, rcu_nocb_mask, cpumask);
>   1231		}
>   1232	
>   1233		if (!cpumask_available(rcu_nocb_mask))
>   1234			return;
>   1235	
>   1236		if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
>   1237			pr_info("\tNote: kernel parameter 'rcu_nocbs=', 'nohz_full', or 'isolcpus=' contains nonexistent CPUs.\n");
>   1238			cpumask_and(rcu_nocb_mask, cpu_possible_mask,
>   1239				    rcu_nocb_mask);
>   1240		}
>   1241		if (cpumask_empty(rcu_nocb_mask))
>   1242			pr_info("\tOffload RCU callbacks from CPUs: (none).\n");
>   1243		else
>   1244			pr_info("\tOffload RCU callbacks from CPUs: %*pbl.\n",
>   1245				cpumask_pr_args(rcu_nocb_mask));
>   1246		if (rcu_nocb_poll)
>   1247			pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
>   1248	
>   1249		for_each_cpu(cpu, rcu_nocb_mask) {
>   1250			rdp = per_cpu_ptr(&rcu_data, cpu);
>   1251			if (rcu_segcblist_empty(&rdp->cblist))
>   1252				rcu_segcblist_init(&rdp->cblist);
>   1253			rcu_segcblist_offload(&rdp->cblist, true);
>   1254			rcu_segcblist_set_flags(&rdp->cblist, SEGCBLIST_KTHREAD_CB | SEGCBLIST_KTHREAD_GP);
>   1255			rcu_segcblist_clear_flags(&rdp->cblist, SEGCBLIST_RCU_CORE);
>   1256		}
>   1257		rcu_organize_nocb_kthreads();
>   1258	}
>   1259	
> 

-- 
Regards,
  Zhen Lei

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

end of thread, other threads:[~2022-08-18  1:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-16 12:48 [PATCH v3 0/2] rcu/nocb: Delete local variable 'need_rcu_nocb_mask' in rcu_init_nohz() Zhen Lei
2022-08-16 12:48 ` [PATCH v3 1/2] rcu: Eliminate rcu_state.nocb_is_setup Zhen Lei
2022-08-16 12:48 ` [PATCH v3 2/2] rcu: Simplify the code logic of rcu_init_nohz() Zhen Lei
2022-08-16 19:55   ` kernel test robot
2022-08-17  1:22     ` Leizhen (ThunderTown)
2022-08-17  1:22       ` Leizhen
2022-08-17 22:16   ` kernel test robot
2022-08-18  1:19   ` kernel test robot
2022-08-18  1:36     ` Leizhen (ThunderTown)
2022-08-18  1:36       ` Leizhen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.