tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2020.02.29a head: 61f7110d6b78f4c84ea5d5480185740840889af7 commit: 61f7110d6b78f4c84ea5d5480185740840889af7 [43/43] rcu-tasks: Add an RCU-tasks rude variant config: nios2-3c120_defconfig (attached as .config) compiler: nios2-linux-gcc (GCC) 7.5.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 61f7110d6b78f4c84ea5d5480185740840889af7 # save the attached .config to linux build tree GCC_VERSION=7.5.0 make.cross ARCH=nios2 If you fix the issue, kindly add following tag Reported-by: kbuild test robot All error/warnings (new ones prefixed by >>): In file included from include/linux/kernel.h:11:0, from kernel/rcu/update.c:21: kernel/rcu/tasks.h: In function 'check_holdout_task': >> kernel/rcu/tasks.h:212:18: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' if (!READ_ONCE(t->rcu_tasks_holdout) || ^ include/linux/compiler.h:285:17: note: in definition of macro '__READ_ONCE' union { typeof(x) __val; char __c[1]; } __u; \ ^ >> kernel/rcu/tasks.h:212:7: note: in expansion of macro 'READ_ONCE' if (!READ_ONCE(t->rcu_tasks_holdout) || ^~~~~~~~~ >> kernel/rcu/tasks.h:212:18: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' if (!READ_ONCE(t->rcu_tasks_holdout) || ^ include/linux/compiler.h:287:22: note: in definition of macro '__READ_ONCE' __read_once_size(&(x), __u.__c, sizeof(x)); \ ^ >> kernel/rcu/tasks.h:212:7: note: in expansion of macro 'READ_ONCE' if (!READ_ONCE(t->rcu_tasks_holdout) || ^~~~~~~~~ >> kernel/rcu/tasks.h:212:18: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' if (!READ_ONCE(t->rcu_tasks_holdout) || ^ include/linux/compiler.h:287:42: note: in definition of macro '__READ_ONCE' __read_once_size(&(x), __u.__c, sizeof(x)); \ ^ >> kernel/rcu/tasks.h:212:7: note: in expansion of macro 'READ_ONCE' if (!READ_ONCE(t->rcu_tasks_holdout) || ^~~~~~~~~ >> kernel/rcu/tasks.h:212:18: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' if (!READ_ONCE(t->rcu_tasks_holdout) || ^ include/linux/compiler.h:289:30: note: in definition of macro '__READ_ONCE' __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \ ^ >> kernel/rcu/tasks.h:212:7: note: in expansion of macro 'READ_ONCE' if (!READ_ONCE(t->rcu_tasks_holdout) || ^~~~~~~~~ >> kernel/rcu/tasks.h:212:18: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' if (!READ_ONCE(t->rcu_tasks_holdout) || ^ include/linux/compiler.h:289:50: note: in definition of macro '__READ_ONCE' __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \ ^ >> kernel/rcu/tasks.h:212:7: note: in expansion of macro 'READ_ONCE' if (!READ_ONCE(t->rcu_tasks_holdout) || ^~~~~~~~~ In file included from kernel/rcu/update.c:562:0: >> kernel/rcu/tasks.h:213:7: error: 'struct task_struct' has no member named 'rcu_tasks_nvcsw' t->rcu_tasks_nvcsw != READ_ONCE(t->nvcsw) || ^~ >> kernel/rcu/tasks.h:216:28: error: 'struct task_struct' has no member named 'rcu_tasks_idle_cpu' !is_idle_task(t) && t->rcu_tasks_idle_cpu >= 0)) { ^~ In file included from include/linux/kernel.h:11:0, from kernel/rcu/update.c:21: kernel/rcu/tasks.h:217:15: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' WRITE_ONCE(t->rcu_tasks_holdout, false); ^ include/linux/compiler.h:310:17: note: in definition of macro 'WRITE_ONCE' union { typeof(x) __val; char __c[1]; } __u = \ ^ kernel/rcu/tasks.h:217:15: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' WRITE_ONCE(t->rcu_tasks_holdout, false); ^ include/linux/compiler.h:311:30: note: in definition of macro 'WRITE_ONCE' { .__val = (__force typeof(x)) (val) }; \ ^ kernel/rcu/tasks.h:217:15: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' WRITE_ONCE(t->rcu_tasks_holdout, false); ^ include/linux/compiler.h:312:22: note: in definition of macro 'WRITE_ONCE' __write_once_size(&(x), __u.__c, sizeof(x)); \ ^ kernel/rcu/tasks.h:217:15: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' WRITE_ONCE(t->rcu_tasks_holdout, false); ^ include/linux/compiler.h:312:42: note: in definition of macro 'WRITE_ONCE' __write_once_size(&(x), __u.__c, sizeof(x)); \ ^ In file included from kernel/rcu/update.c:562:0: >> kernel/rcu/tasks.h:218:19: error: 'struct task_struct' has no member named 'rcu_tasks_holdout_list' list_del_init(&t->rcu_tasks_holdout_list); ^~ In file included from include/linux/kernel.h:15:0, from kernel/rcu/update.c:21: kernel/rcu/tasks.h:233:5: error: 'struct task_struct' has no member named 'rcu_tasks_nvcsw' t->rcu_tasks_nvcsw, t->nvcsw, t->rcu_tasks_holdout, ^ include/linux/printk.h:300:35: note: in definition of macro 'pr_alert' printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~~~ kernel/rcu/tasks.h:233:35: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' t->rcu_tasks_nvcsw, t->nvcsw, t->rcu_tasks_holdout, ^ include/linux/printk.h:300:35: note: in definition of macro 'pr_alert' printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~~~ kernel/rcu/tasks.h:234:5: error: 'struct task_struct' has no member named 'rcu_tasks_idle_cpu' t->rcu_tasks_idle_cpu, cpu); ^ include/linux/printk.h:300:35: note: in definition of macro 'pr_alert' printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~~~ In file included from kernel/rcu/update.c:562:0: kernel/rcu/tasks.h: At top level: >> kernel/rcu/tasks.h:239:38: warning: 'struct rcu_tasks' declared inside parameter list will not be visible outside of this definition or declaration static void rcu_tasks_wait_gp(struct rcu_tasks *rtp) ^~~~~~~~~ kernel/rcu/tasks.h: In function 'rcu_tasks_wait_gp': kernel/rcu/tasks.h:271:5: error: 'struct task_struct' has no member named 'rcu_tasks_nvcsw' t->rcu_tasks_nvcsw = READ_ONCE(t->nvcsw); ^~ In file included from include/linux/kernel.h:11:0, from kernel/rcu/update.c:21: kernel/rcu/tasks.h:272:16: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' WRITE_ONCE(t->rcu_tasks_holdout, true); ^ include/linux/compiler.h:310:17: note: in definition of macro 'WRITE_ONCE' union { typeof(x) __val; char __c[1]; } __u = \ ^ kernel/rcu/tasks.h:272:16: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' WRITE_ONCE(t->rcu_tasks_holdout, true); ^ include/linux/compiler.h:311:30: note: in definition of macro 'WRITE_ONCE' { .__val = (__force typeof(x)) (val) }; \ ^ kernel/rcu/tasks.h:272:16: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' WRITE_ONCE(t->rcu_tasks_holdout, true); ^ include/linux/compiler.h:312:22: note: in definition of macro 'WRITE_ONCE' __write_once_size(&(x), __u.__c, sizeof(x)); \ ^ kernel/rcu/tasks.h:272:16: error: 'struct task_struct' has no member named 'rcu_tasks_holdout' WRITE_ONCE(t->rcu_tasks_holdout, true); ^ include/linux/compiler.h:312:42: note: in definition of macro 'WRITE_ONCE' __write_once_size(&(x), __u.__c, sizeof(x)); \ ^ In file included from kernel/rcu/update.c:562:0: kernel/rcu/tasks.h:273:15: error: 'struct task_struct' has no member named 'rcu_tasks_holdout_list' list_add(&t->rcu_tasks_holdout_list, ^~ >> kernel/rcu/tasks.h:286:20: error: 'tasks_rcu_exit_srcu' undeclared (first use in this function) synchronize_srcu(&tasks_rcu_exit_srcu); ^~~~~~~~~~~~~~~~~~~ kernel/rcu/tasks.h:286:20: note: each undeclared identifier is reported only once for each function it appears in In file included from include/linux/kernel.h:11:0, from kernel/rcu/update.c:21: >> kernel/rcu/tasks.h:313:20: error: 'rcu_task_stall_timeout' undeclared (first use in this function); did you mean 'rcu_cpu_stall_reset'? rtst = READ_ONCE(rcu_task_stall_timeout); ^ include/linux/compiler.h:285:17: note: in definition of macro '__READ_ONCE' union { typeof(x) __val; char __c[1]; } __u; \ ^ kernel/rcu/tasks.h:313:10: note: in expansion of macro 'READ_ONCE' rtst = READ_ONCE(rcu_task_stall_timeout); ^~~~~~~~~ >> include/linux/kernel.h:987:51: error: 'struct task_struct' has no member named 'rcu_tasks_holdout_list' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/compiler.h:374:9: note: in definition of macro '__compiletime_assert' if (!(condition)) \ ^~~~~~~~~ include/linux/compiler.h:394:2: note: in expansion of macro '_compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^~~~~~~~~~~~~~~~~~ include/linux/kernel.h:987:2: note: in expansion of macro 'BUILD_BUG_ON_MSG' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^~~~~~~~~~~~~~~~ include/linux/kernel.h:987:20: note: in expansion of macro '__same_type' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^~~~~~~~~~~ include/linux/list.h:493:2: note: in expansion of macro 'container_of' container_of(ptr, type, member) ^~~~~~~~~~~~ include/linux/list.h:504:2: note: in expansion of macro 'list_entry' list_entry((ptr)->next, type, member) ^~~~~~~~~~ include/linux/list.h:688:13: note: in expansion of macro 'list_first_entry' for (pos = list_first_entry(head, typeof(*pos), member), \ ^~~~~~~~~~~~~~~~ >> kernel/rcu/tasks.h:319:3: note: in expansion of macro 'list_for_each_entry_safe' list_for_each_entry_safe(t, t1, &rcu_tasks_holdouts, ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from :0:0: >> include/linux/compiler_types.h:129:35: error: 'struct task_struct' has no member named 'rcu_tasks_holdout_list' #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) ^ include/linux/stddef.h:17:32: note: in expansion of macro '__compiler_offsetof' #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER) ^~~~~~~~~~~~~~~~~~~ include/linux/kernel.h:990:21: note: in expansion of macro 'offsetof' ((type *)(__mptr - offsetof(type, member))); }) ^~~~~~~~ include/linux/list.h:493:2: note: in expansion of macro 'container_of' container_of(ptr, type, member) ^~~~~~~~~~~~ include/linux/list.h:504:2: note: in expansion of macro 'list_entry' list_entry((ptr)->next, type, member) ^~~~~~~~~~ include/linux/list.h:688:13: note: in expansion of macro 'list_first_entry' for (pos = list_first_entry(head, typeof(*pos), member), \ ^~~~~~~~~~~~~~~~ >> kernel/rcu/tasks.h:319:3: note: in expansion of macro 'list_for_each_entry_safe' list_for_each_entry_safe(t, t1, &rcu_tasks_holdouts, ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from kernel/rcu/update.c:21:0: include/linux/list.h:537:18: error: 'struct task_struct' has no member named 'rcu_tasks_holdout_list' list_entry((pos)->member.next, typeof(*(pos)), member) ^ include/linux/kernel.h:986:26: note: in definition of macro 'container_of' void *__mptr = (void *)(ptr); \ ^~~ include/linux/list.h:537:2: note: in expansion of macro 'list_entry' list_entry((pos)->member.next, typeof(*(pos)), member) ^~~~~~~~~~ include/linux/list.h:689:7: note: in expansion of macro 'list_next_entry' n = list_next_entry(pos, member); \ ^~~~~~~~~~~~~~~ kernel/rcu/tasks.h:319:3: note: in expansion of macro 'list_for_each_entry_safe' list_for_each_entry_safe(t, t1, &rcu_tasks_holdouts, ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/kernel.h:11:0, from kernel/rcu/update.c:21: include/linux/list.h:537:18: error: 'struct task_struct' has no member named 'rcu_tasks_holdout_list' list_entry((pos)->member.next, typeof(*(pos)), member) ^ include/linux/compiler.h:374:9: note: in definition of macro '__compiletime_assert' if (!(condition)) \ ^~~~~~~~~ include/linux/compiler.h:394:2: note: in expansion of macro '_compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^~~~~~~~~~~~~~~~~~ include/linux/kernel.h:987:2: note: in expansion of macro 'BUILD_BUG_ON_MSG' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^~~~~~~~~~~~~~~~ include/linux/kernel.h:987:20: note: in expansion of macro '__same_type' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^~~~~~~~~~~ include/linux/list.h:493:2: note: in expansion of macro 'container_of' container_of(ptr, type, member) ^~~~~~~~~~~~ include/linux/list.h:537:2: note: in expansion of macro 'list_entry' list_entry((pos)->member.next, typeof(*(pos)), member) ^~~~~~~~~~ include/linux/list.h:689:7: note: in expansion of macro 'list_next_entry' n = list_next_entry(pos, member); \ ^~~~~~~~~~~~~~~ kernel/rcu/tasks.h:319:3: note: in expansion of macro 'list_for_each_entry_safe' list_for_each_entry_safe(t, t1, &rcu_tasks_holdouts, ^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/kernel.h:987:51: error: 'struct task_struct' has no member named 'rcu_tasks_holdout_list' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/compiler.h:374:9: note: in definition of macro '__compiletime_assert' if (!(condition)) \ ^~~~~~~~~ include/linux/compiler.h:394:2: note: in expansion of macro '_compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^~~~~~~~~~~~~~~~~~ include/linux/kernel.h:987:2: note: in expansion of macro 'BUILD_BUG_ON_MSG' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^~~~~~~~~~~~~~~~ include/linux/kernel.h:987:20: note: in expansion of macro '__same_type' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^~~~~~~~~~~ include/linux/list.h:493:2: note: in expansion of macro 'container_of' container_of(ptr, type, member) ^~~~~~~~~~~~ include/linux/list.h:537:2: note: in expansion of macro 'list_entry' list_entry((pos)->member.next, typeof(*(pos)), member) ^~~~~~~~~~ include/linux/list.h:689:7: note: in expansion of macro 'list_next_entry' n = list_next_entry(pos, member); \ ^~~~~~~~~~~~~~~ kernel/rcu/tasks.h:319:3: note: in expansion of macro 'list_for_each_entry_safe' list_for_each_entry_safe(t, t1, &rcu_tasks_holdouts, ^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/list.h:537:18: error: 'struct task_struct' has no member named 'rcu_tasks_holdout_list' list_entry((pos)->member.next, typeof(*(pos)), member) ^ include/linux/compiler.h:374:9: note: in definition of macro '__compiletime_assert' if (!(condition)) \ ^~~~~~~~~ include/linux/compiler.h:394:2: note: in expansion of macro '_compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^~~~~~~~~~~~~~~~~~ include/linux/kernel.h:987:2: note: in expansion of macro 'BUILD_BUG_ON_MSG' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^~~~~~~~~~~~~~~~ include/linux/kernel.h:988:6: note: in expansion of macro '__same_type' !__same_type(*(ptr), void), \ ^~~~~~~~~~~ include/linux/list.h:493:2: note: in expansion of macro 'container_of' container_of(ptr, type, member) vim +212 kernel/rcu/tasks.h 6b80543d90000c Paul E. McKenney 2020-03-02 205 6b80543d90000c Paul E. McKenney 2020-03-02 206 /* See if tasks are still holding out, complain if so. */ 6b80543d90000c Paul E. McKenney 2020-03-02 207 static void check_holdout_task(struct task_struct *t, 6b80543d90000c Paul E. McKenney 2020-03-02 208 bool needreport, bool *firstreport) 6b80543d90000c Paul E. McKenney 2020-03-02 209 { 6b80543d90000c Paul E. McKenney 2020-03-02 210 int cpu; 6b80543d90000c Paul E. McKenney 2020-03-02 211 6b80543d90000c Paul E. McKenney 2020-03-02 @212 if (!READ_ONCE(t->rcu_tasks_holdout) || 6b80543d90000c Paul E. McKenney 2020-03-02 @213 t->rcu_tasks_nvcsw != READ_ONCE(t->nvcsw) || 6b80543d90000c Paul E. McKenney 2020-03-02 214 !READ_ONCE(t->on_rq) || 6b80543d90000c Paul E. McKenney 2020-03-02 215 (IS_ENABLED(CONFIG_NO_HZ_FULL) && 6b80543d90000c Paul E. McKenney 2020-03-02 @216 !is_idle_task(t) && t->rcu_tasks_idle_cpu >= 0)) { 6b80543d90000c Paul E. McKenney 2020-03-02 217 WRITE_ONCE(t->rcu_tasks_holdout, false); 6b80543d90000c Paul E. McKenney 2020-03-02 @218 list_del_init(&t->rcu_tasks_holdout_list); 6b80543d90000c Paul E. McKenney 2020-03-02 219 put_task_struct(t); 6b80543d90000c Paul E. McKenney 2020-03-02 220 return; 6b80543d90000c Paul E. McKenney 2020-03-02 221 } 6b80543d90000c Paul E. McKenney 2020-03-02 222 rcu_request_urgent_qs_task(t); 6b80543d90000c Paul E. McKenney 2020-03-02 223 if (!needreport) 6b80543d90000c Paul E. McKenney 2020-03-02 224 return; 6b80543d90000c Paul E. McKenney 2020-03-02 225 if (*firstreport) { 6b80543d90000c Paul E. McKenney 2020-03-02 226 pr_err("INFO: rcu_tasks detected stalls on tasks:\n"); 6b80543d90000c Paul E. McKenney 2020-03-02 227 *firstreport = false; 6b80543d90000c Paul E. McKenney 2020-03-02 228 } 6b80543d90000c Paul E. McKenney 2020-03-02 229 cpu = task_cpu(t); 6b80543d90000c Paul E. McKenney 2020-03-02 230 pr_alert("%p: %c%c nvcsw: %lu/%lu holdout: %d idle_cpu: %d/%d\n", 6b80543d90000c Paul E. McKenney 2020-03-02 231 t, ".I"[is_idle_task(t)], 6b80543d90000c Paul E. McKenney 2020-03-02 232 "N."[cpu < 0 || !tick_nohz_full_cpu(cpu)], 6b80543d90000c Paul E. McKenney 2020-03-02 233 t->rcu_tasks_nvcsw, t->nvcsw, t->rcu_tasks_holdout, 6b80543d90000c Paul E. McKenney 2020-03-02 234 t->rcu_tasks_idle_cpu, cpu); 6b80543d90000c Paul E. McKenney 2020-03-02 235 sched_show_task(t); 6b80543d90000c Paul E. McKenney 2020-03-02 236 } 6b80543d90000c Paul E. McKenney 2020-03-02 237 61f7110d6b78f4 Paul E. McKenney 2020-03-02 238 /* Wait for one RCU-tasks grace period. */ 61f7110d6b78f4 Paul E. McKenney 2020-03-02 @239 static void rcu_tasks_wait_gp(struct rcu_tasks *rtp) 6b80543d90000c Paul E. McKenney 2020-03-02 240 { 6b80543d90000c Paul E. McKenney 2020-03-02 241 struct task_struct *g, *t; 6b80543d90000c Paul E. McKenney 2020-03-02 242 unsigned long lastreport; 6b80543d90000c Paul E. McKenney 2020-03-02 243 LIST_HEAD(rcu_tasks_holdouts); 6b80543d90000c Paul E. McKenney 2020-03-02 244 int fract; 6b80543d90000c Paul E. McKenney 2020-03-02 245 6b80543d90000c Paul E. McKenney 2020-03-02 246 /* 61f7110d6b78f4 Paul E. McKenney 2020-03-02 247 * Wait for all pre-existing t->on_rq and t->nvcsw transitions 61f7110d6b78f4 Paul E. McKenney 2020-03-02 248 * to complete. Invoking synchronize_rcu() suffices because all 61f7110d6b78f4 Paul E. McKenney 2020-03-02 249 * these transitions occur with interrupts disabled. Without this 61f7110d6b78f4 Paul E. McKenney 2020-03-02 250 * synchronize_rcu(), a read-side critical section that started 61f7110d6b78f4 Paul E. McKenney 2020-03-02 251 * before the grace period might be incorrectly seen as having 61f7110d6b78f4 Paul E. McKenney 2020-03-02 252 * started after the grace period. 6b80543d90000c Paul E. McKenney 2020-03-02 253 * 61f7110d6b78f4 Paul E. McKenney 2020-03-02 254 * This synchronize_rcu() also dispenses with the need for a 61f7110d6b78f4 Paul E. McKenney 2020-03-02 255 * memory barrier on the first store to t->rcu_tasks_holdout, 61f7110d6b78f4 Paul E. McKenney 2020-03-02 256 * as it forces the store to happen after the beginning of the 61f7110d6b78f4 Paul E. McKenney 2020-03-02 257 * grace period. 6b80543d90000c Paul E. McKenney 2020-03-02 258 */ 6b80543d90000c Paul E. McKenney 2020-03-02 259 synchronize_rcu(); 6b80543d90000c Paul E. McKenney 2020-03-02 260 6b80543d90000c Paul E. McKenney 2020-03-02 261 /* 61f7110d6b78f4 Paul E. McKenney 2020-03-02 262 * There were callbacks, so we need to wait for an RCU-tasks 61f7110d6b78f4 Paul E. McKenney 2020-03-02 263 * grace period. Start off by scanning the task list for tasks 61f7110d6b78f4 Paul E. McKenney 2020-03-02 264 * that are not already voluntarily blocked. Mark these tasks 61f7110d6b78f4 Paul E. McKenney 2020-03-02 265 * and make a list of them in rcu_tasks_holdouts. 6b80543d90000c Paul E. McKenney 2020-03-02 266 */ 6b80543d90000c Paul E. McKenney 2020-03-02 267 rcu_read_lock(); 6b80543d90000c Paul E. McKenney 2020-03-02 268 for_each_process_thread(g, t) { 61f7110d6b78f4 Paul E. McKenney 2020-03-02 269 if (t != current && READ_ONCE(t->on_rq) && !is_idle_task(t)) { 6b80543d90000c Paul E. McKenney 2020-03-02 270 get_task_struct(t); 6b80543d90000c Paul E. McKenney 2020-03-02 271 t->rcu_tasks_nvcsw = READ_ONCE(t->nvcsw); 6b80543d90000c Paul E. McKenney 2020-03-02 272 WRITE_ONCE(t->rcu_tasks_holdout, true); 6b80543d90000c Paul E. McKenney 2020-03-02 273 list_add(&t->rcu_tasks_holdout_list, 6b80543d90000c Paul E. McKenney 2020-03-02 274 &rcu_tasks_holdouts); 6b80543d90000c Paul E. McKenney 2020-03-02 275 } 6b80543d90000c Paul E. McKenney 2020-03-02 276 } 6b80543d90000c Paul E. McKenney 2020-03-02 277 rcu_read_unlock(); 6b80543d90000c Paul E. McKenney 2020-03-02 278 6b80543d90000c Paul E. McKenney 2020-03-02 279 /* 61f7110d6b78f4 Paul E. McKenney 2020-03-02 280 * Wait for tasks that are in the process of exiting. This 61f7110d6b78f4 Paul E. McKenney 2020-03-02 281 * does only part of the job, ensuring that all tasks that were 61f7110d6b78f4 Paul E. McKenney 2020-03-02 282 * previously exiting reach the point where they have disabled 61f7110d6b78f4 Paul E. McKenney 2020-03-02 283 * preemption, allowing the later synchronize_rcu() to finish 61f7110d6b78f4 Paul E. McKenney 2020-03-02 284 * the job. 6b80543d90000c Paul E. McKenney 2020-03-02 285 */ 6b80543d90000c Paul E. McKenney 2020-03-02 @286 synchronize_srcu(&tasks_rcu_exit_srcu); 6b80543d90000c Paul E. McKenney 2020-03-02 287 6b80543d90000c Paul E. McKenney 2020-03-02 288 /* 61f7110d6b78f4 Paul E. McKenney 2020-03-02 289 * Each pass through the following loop scans the list of holdout 61f7110d6b78f4 Paul E. McKenney 2020-03-02 290 * tasks, removing any that are no longer holdouts. When the list 61f7110d6b78f4 Paul E. McKenney 2020-03-02 291 * is empty, we are done. 6b80543d90000c Paul E. McKenney 2020-03-02 292 */ 6b80543d90000c Paul E. McKenney 2020-03-02 293 lastreport = jiffies; 6b80543d90000c Paul E. McKenney 2020-03-02 294 61f7110d6b78f4 Paul E. McKenney 2020-03-02 295 /* Start off with HZ/10 wait and slowly back off to 1 HZ wait. */ 6b80543d90000c Paul E. McKenney 2020-03-02 296 fract = 10; 6b80543d90000c Paul E. McKenney 2020-03-02 297 6b80543d90000c Paul E. McKenney 2020-03-02 298 for (;;) { 6b80543d90000c Paul E. McKenney 2020-03-02 299 bool firstreport; 6b80543d90000c Paul E. McKenney 2020-03-02 300 bool needreport; 6b80543d90000c Paul E. McKenney 2020-03-02 301 int rtst; 6b80543d90000c Paul E. McKenney 2020-03-02 302 struct task_struct *t1; 6b80543d90000c Paul E. McKenney 2020-03-02 303 6b80543d90000c Paul E. McKenney 2020-03-02 304 if (list_empty(&rcu_tasks_holdouts)) 6b80543d90000c Paul E. McKenney 2020-03-02 305 break; 6b80543d90000c Paul E. McKenney 2020-03-02 306 6b80543d90000c Paul E. McKenney 2020-03-02 307 /* Slowly back off waiting for holdouts */ 6b80543d90000c Paul E. McKenney 2020-03-02 308 schedule_timeout_interruptible(HZ/fract); 6b80543d90000c Paul E. McKenney 2020-03-02 309 6b80543d90000c Paul E. McKenney 2020-03-02 310 if (fract > 1) 6b80543d90000c Paul E. McKenney 2020-03-02 311 fract--; 6b80543d90000c Paul E. McKenney 2020-03-02 312 6b80543d90000c Paul E. McKenney 2020-03-02 @313 rtst = READ_ONCE(rcu_task_stall_timeout); 61f7110d6b78f4 Paul E. McKenney 2020-03-02 314 needreport = rtst > 0 && time_after(jiffies, lastreport + rtst); 6b80543d90000c Paul E. McKenney 2020-03-02 315 if (needreport) 6b80543d90000c Paul E. McKenney 2020-03-02 316 lastreport = jiffies; 6b80543d90000c Paul E. McKenney 2020-03-02 317 firstreport = true; 6b80543d90000c Paul E. McKenney 2020-03-02 318 WARN_ON(signal_pending(current)); 6b80543d90000c Paul E. McKenney 2020-03-02 @319 list_for_each_entry_safe(t, t1, &rcu_tasks_holdouts, 6b80543d90000c Paul E. McKenney 2020-03-02 320 rcu_tasks_holdout_list) { 6b80543d90000c Paul E. McKenney 2020-03-02 321 check_holdout_task(t, needreport, &firstreport); 6b80543d90000c Paul E. McKenney 2020-03-02 322 cond_resched(); 6b80543d90000c Paul E. McKenney 2020-03-02 323 } 6b80543d90000c Paul E. McKenney 2020-03-02 324 } 6b80543d90000c Paul E. McKenney 2020-03-02 325 6b80543d90000c Paul E. McKenney 2020-03-02 326 /* 61f7110d6b78f4 Paul E. McKenney 2020-03-02 327 * Because ->on_rq and ->nvcsw are not guaranteed to have a full 61f7110d6b78f4 Paul E. McKenney 2020-03-02 328 * memory barriers prior to them in the schedule() path, memory 61f7110d6b78f4 Paul E. McKenney 2020-03-02 329 * reordering on other CPUs could cause their RCU-tasks read-side 61f7110d6b78f4 Paul E. McKenney 2020-03-02 330 * critical sections to extend past the end of the grace period. 61f7110d6b78f4 Paul E. McKenney 2020-03-02 331 * However, because these ->nvcsw updates are carried out with 61f7110d6b78f4 Paul E. McKenney 2020-03-02 332 * interrupts disabled, we can use synchronize_rcu() to force the 61f7110d6b78f4 Paul E. McKenney 2020-03-02 333 * needed ordering on all such CPUs. 6b80543d90000c Paul E. McKenney 2020-03-02 334 * 61f7110d6b78f4 Paul E. McKenney 2020-03-02 335 * This synchronize_rcu() also confines all ->rcu_tasks_holdout 61f7110d6b78f4 Paul E. McKenney 2020-03-02 336 * accesses to be within the grace period, avoiding the need for 61f7110d6b78f4 Paul E. McKenney 2020-03-02 337 * memory barriers for ->rcu_tasks_holdout accesses. 6b80543d90000c Paul E. McKenney 2020-03-02 338 * 61f7110d6b78f4 Paul E. McKenney 2020-03-02 339 * In addition, this synchronize_rcu() waits for exiting tasks 61f7110d6b78f4 Paul E. McKenney 2020-03-02 340 * to complete their final preempt_disable() region of execution, 61f7110d6b78f4 Paul E. McKenney 2020-03-02 341 * cleaning up after the synchronize_srcu() above. 6b80543d90000c Paul E. McKenney 2020-03-02 342 */ 6b80543d90000c Paul E. McKenney 2020-03-02 343 synchronize_rcu(); 61f7110d6b78f4 Paul E. McKenney 2020-03-02 344 } 6b80543d90000c Paul E. McKenney 2020-03-02 345 61f7110d6b78f4 Paul E. McKenney 2020-03-02 346 void call_rcu_tasks(struct rcu_head *rhp, rcu_callback_t func); 61f7110d6b78f4 Paul E. McKenney 2020-03-02 @347 DEFINE_RCU_TASKS(rcu_tasks, rcu_tasks_wait_gp, call_rcu_tasks); 61f7110d6b78f4 Paul E. McKenney 2020-03-02 348 61f7110d6b78f4 Paul E. McKenney 2020-03-02 349 /** 61f7110d6b78f4 Paul E. McKenney 2020-03-02 350 * call_rcu_tasks() - Queue an RCU for invocation task-based grace period 61f7110d6b78f4 Paul E. McKenney 2020-03-02 351 * @rhp: structure to be used for queueing the RCU updates. 61f7110d6b78f4 Paul E. McKenney 2020-03-02 352 * @func: actual callback function to be invoked after the grace period 61f7110d6b78f4 Paul E. McKenney 2020-03-02 353 * 61f7110d6b78f4 Paul E. McKenney 2020-03-02 354 * The callback function will be invoked some time after a full grace 61f7110d6b78f4 Paul E. McKenney 2020-03-02 355 * period elapses, in other words after all currently executing RCU 61f7110d6b78f4 Paul E. McKenney 2020-03-02 356 * read-side critical sections have completed. call_rcu_tasks() assumes 61f7110d6b78f4 Paul E. McKenney 2020-03-02 357 * that the read-side critical sections end at a voluntary context 61f7110d6b78f4 Paul E. McKenney 2020-03-02 358 * switch (not a preemption!), cond_resched_rcu_qs(), entry into idle, 61f7110d6b78f4 Paul E. McKenney 2020-03-02 359 * or transition to usermode execution. As such, there are no read-side 61f7110d6b78f4 Paul E. McKenney 2020-03-02 360 * primitives analogous to rcu_read_lock() and rcu_read_unlock() because 61f7110d6b78f4 Paul E. McKenney 2020-03-02 361 * this primitive is intended to determine that all tasks have passed 61f7110d6b78f4 Paul E. McKenney 2020-03-02 362 * through a safe state, not so much for data-strcuture synchronization. 61f7110d6b78f4 Paul E. McKenney 2020-03-02 363 * 61f7110d6b78f4 Paul E. McKenney 2020-03-02 364 * See the description of call_rcu() for more detailed information on 61f7110d6b78f4 Paul E. McKenney 2020-03-02 365 * memory ordering guarantees. 61f7110d6b78f4 Paul E. McKenney 2020-03-02 366 */ 61f7110d6b78f4 Paul E. McKenney 2020-03-02 367 void call_rcu_tasks(struct rcu_head *rhp, rcu_callback_t func) 61f7110d6b78f4 Paul E. McKenney 2020-03-02 368 { 61f7110d6b78f4 Paul E. McKenney 2020-03-02 @369 call_rcu_tasks_generic(rhp, func, &rcu_tasks); 6b80543d90000c Paul E. McKenney 2020-03-02 370 } 61f7110d6b78f4 Paul E. McKenney 2020-03-02 371 EXPORT_SYMBOL_GPL(call_rcu_tasks); 61f7110d6b78f4 Paul E. McKenney 2020-03-02 372 61f7110d6b78f4 Paul E. McKenney 2020-03-02 373 /** 61f7110d6b78f4 Paul E. McKenney 2020-03-02 374 * synchronize_rcu_tasks - wait until an rcu-tasks grace period has elapsed. 61f7110d6b78f4 Paul E. McKenney 2020-03-02 375 * 61f7110d6b78f4 Paul E. McKenney 2020-03-02 376 * Control will return to the caller some time after a full rcu-tasks 61f7110d6b78f4 Paul E. McKenney 2020-03-02 377 * grace period has elapsed, in other words after all currently 61f7110d6b78f4 Paul E. McKenney 2020-03-02 378 * executing rcu-tasks read-side critical sections have elapsed. These 61f7110d6b78f4 Paul E. McKenney 2020-03-02 379 * read-side critical sections are delimited by calls to schedule(), 61f7110d6b78f4 Paul E. McKenney 2020-03-02 380 * cond_resched_tasks_rcu_qs(), idle execution, userspace execution, calls 61f7110d6b78f4 Paul E. McKenney 2020-03-02 381 * to synchronize_rcu_tasks(), and (in theory, anyway) cond_resched(). 61f7110d6b78f4 Paul E. McKenney 2020-03-02 382 * 61f7110d6b78f4 Paul E. McKenney 2020-03-02 383 * This is a very specialized primitive, intended only for a few uses in 61f7110d6b78f4 Paul E. McKenney 2020-03-02 384 * tracing and other situations requiring manipulation of function 61f7110d6b78f4 Paul E. McKenney 2020-03-02 385 * preambles and profiling hooks. The synchronize_rcu_tasks() function 61f7110d6b78f4 Paul E. McKenney 2020-03-02 386 * is not (yet) intended for heavy use from multiple CPUs. 61f7110d6b78f4 Paul E. McKenney 2020-03-02 387 * 61f7110d6b78f4 Paul E. McKenney 2020-03-02 388 * See the description of synchronize_rcu() for more detailed information 61f7110d6b78f4 Paul E. McKenney 2020-03-02 389 * on memory ordering guarantees. 61f7110d6b78f4 Paul E. McKenney 2020-03-02 390 */ 61f7110d6b78f4 Paul E. McKenney 2020-03-02 391 void synchronize_rcu_tasks(void) 61f7110d6b78f4 Paul E. McKenney 2020-03-02 392 { 61f7110d6b78f4 Paul E. McKenney 2020-03-02 @393 synchronize_rcu_tasks_generic(&rcu_tasks); 6b80543d90000c Paul E. McKenney 2020-03-02 394 } 61f7110d6b78f4 Paul E. McKenney 2020-03-02 395 EXPORT_SYMBOL_GPL(synchronize_rcu_tasks); 61f7110d6b78f4 Paul E. McKenney 2020-03-02 396 :::::: The code at line 212 was first introduced by commit :::::: 6b80543d90000c684123b05f075ac1433d99fa85 tasks-rcu: Move Tasks RCU to its own file :::::: TO: Paul E. McKenney :::::: CC: Paul E. McKenney --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org