Hi Paul On Tue, Mar 22, 2022 at 5:50 AM Paul E. McKenney <paulmck@xxxxxxxxxx> wrote: > > On Tue, Mar 22, 2022 at 05:19:28AM +0800, Zhouyi Zhou wrote: > > Hi Paul, > > > > On Mon, Mar 21, 2022 at 11:57 PM Paul E. McKenney <paulmck@xxxxxxxxxx> wrote: > > > > > > On Mon, Mar 21, 2022 at 11:46:28PM +0800, Zhouyi Zhou wrote: > > > > Hi Paul and Willy > > > > > > > > I can reproduce the bug. Following is what I do: > > > > 1.1 git clone https://kernel.source.codeaurora.cn/pub/scm/linux/kernel/git/torvalds/linux.git > > > > 1.2 cd linux > > > > 1.3 cp http://154.223.142.244/20220321/config-20220321 to .config > > > > 1.4 make vmlinux -j 16 > > > > 1.5 kvm -smp 4 -net none -serial file:/tmp/console.log -m 512 > > > > -kernel vmlinux -append "console=ttyS0" > > > > 1.6 the /tmp/console.log is uploaded to > > > > http://154.223.142.244/20220321/console.log > > > > > > > > 2.1 wget https://kernel.source.codeaurora.cn/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-5.17-rc6.tar.gz > > > > 2.2 - 2.6 the result is similar. > > > > > > > > I am very interested in this topic. > > > > Could you please give me about a week to make a full understand of the > > > > meaning of the warning, and try the fixes one by one, and > > > > find out what happens? > > > > > > Works for me! The eventual fix likely involves some version of Valentin > > > Schneider's patchset that provides APIs that allow RCU to detect the > > > current preemption state. Which can change at runtime. A prototype of > > > this patch is on -rcu here: > > > > > > 2436ee0b4cea ("EXP preempt/dynamic: Introduce preempt mode accessors") > > > > > > It is entirely possible that the fix might need to go to mainline sooner > > > rather than later. > > I tried to apply 2436ee0b4cea to 5.17.0-rc6, but this does not work, > > and I will try other fixes above in the coming days. > > WARNING: CPU: 0 PID: 1 at kernel/rcu/tasks.h:1696 > > rcu_tasks_verify_self_tests+0x29/0x30 > > Modules linked in: > > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.17.0-rc6 #3 > > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS > > 1.13.0-1ubuntu1.1 04/01/2014 > > RIP: 0010:rcu_tasks_verify_self_tests+0x29/0x30 > > Code: 90 55 31 c0 48 89 e5 53 48 c7 c3 80 ef 0c 82 80 7b 18 00 0f 84 > > 39 a1 63 00 48 83 c3 20 48 81 fb e0 ef 0c 82 75 e9 85 c0 74 02 <0f> 0b > > 5b 5d c3 66 90 31 c0 80 3d 1b 6f ca 01 00 55 48 89 e5 75 10 > > RSP: 0000:ffff888003173e98 EFLAGS: 00010286 > > In addition to v5.17-rc6, could you please also try reproducing this > problem on the -rcu tree's "dev" branch? Unfortunately, the problem remains in -rcu tree's "master" branch and -rcu tree's "dev' branch: 1) console.log for linux-rcu: http://154.223.142.244/20220321/linux-rcu-console.log 2) console.log for linux-rcu(dev): http://154.223.142.244/20220321/linux-rcu-dev-console.log ( Linux version 5.17.0-rc1-00158-g45abaed6ed05) Could you please tell me if I have made any mistakes above? > > And yes, there may well be additional dependencies from earlier on the > -rcu branch on the one hand and conflicting commits following v5.17-rc1 > in mainline on the other. Not necessarily a simple backport, sad to say. I still have a lot to learn in RCU ;-) > > > by the way, Paul, could you please take a look at following: > > 1664static void rcu_tasks_initiate_self_tests(void) > > 1665{ > > 1666 pr_info("Running RCU-tasks wait API self tests\n"); > > 1667#ifdef CONFIG_TASKS_RCU > > 1668 synchronize_rcu_tasks(); > > 1669 call_rcu_tasks(&tests[0].rh, test_rcu_tasks_callback); > > 1670#endif > > shouldn't synchronize_rcu_tasks() be called after > > call_rcu_tasks(&tests[0].rh, test_rcu_tasks_callback) > > There is much for me to learn in RCU, but my intuition let me ask your > > help to take a little look at this. > > The order should not matter. However, if synchronize_rcu_tasks() is to > be used before the scheduler is initialized, then there would need to > be a single-CPU check. (This is not currently guaranteed, so as far as > I know, there is no need to add such a check.) Thanks for your answer ;-) I think I should learn more about this in the coming days. > > Thanx, Paul > Kind Regard Thanks Zhouyi