Skip to content

Commit 98123ae

Browse files
zhouzhouyi-hubchantra
authored andcommitted
powerpc: protect cpu offlining by RCU offline lock
During the cpu offlining, the sub functions of xive_teardown_cpu will call __lock_acquire when CONFIG_LOCKDEP=y. The latter function will travel RCU protected list, so "WARNING: suspicious RCU usage" will be triggered. Try to protect cpu offlining by RCU offline lock. Tested on PPC VM of Open Source Lab of Oregon State University. (Each round of tests takes about 19 hours to finish) Test results show that although "WARNING: suspicious RCU usage" has gone, but there are more "BUG: soft lockup" reports than the original kernel (10 vs 6), so I add a [RFC] to my subject line. Signed-off-by: Zhouyi Zhou <[email protected]>
1 parent 6445a5a commit 98123ae

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

arch/powerpc/platforms/pseries/hotplug-cpu.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,14 @@ static void pseries_cpu_offline_self(void)
6464

6565
local_irq_disable();
6666
idle_task_exit();
67+
68+
/* Because the cpu is now offline, let rcu know that */
69+
rcu_state_ofl_lock();
6770
if (xive_enabled())
6871
xive_teardown_cpu();
6972
else
7073
xics_teardown_cpu();
71-
74+
rcu_state_ofl_unlock();
7275
unregister_slb_shadow(hwcpu);
7376
rtas_stop_self();
7477

include/linux/rcupdate.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,5 +1055,6 @@ rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f)
10551055
/* kernel/ksysfs.c definitions */
10561056
extern int rcu_expedited;
10571057
extern int rcu_normal;
1058-
1058+
void rcu_state_ofl_lock(void);
1059+
void rcu_state_ofl_unlock(void);
10591060
#endif /* __LINUX_RCUPDATE_H */

kernel/rcu/tree.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4815,6 +4815,16 @@ void __init rcu_init(void)
48154815
(void)start_poll_synchronize_rcu_expedited();
48164816
}
48174817

4818+
void rcu_state_ofl_lock(void)
4819+
{
4820+
arch_spin_lock(&rcu_state.ofl_lock);
4821+
}
4822+
4823+
void rcu_state_ofl_unlock(void)
4824+
{
4825+
arch_spin_unlock(&rcu_state.ofl_lock);
4826+
}
4827+
48184828
#include "tree_stall.h"
48194829
#include "tree_exp.h"
48204830
#include "tree_nocb.h"

0 commit comments

Comments
 (0)