Skip to contentSkip to conversation

Fix bug in RCU torture test

PATCH In review Srivatsa Vaddagiri 3 participants 3 messages Dec 5, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix bug in RCU torture test

While doing some test of RCU torture module, I hit a OOPS in rcu_do_batch, which was trying to processes callback of a module that was just removed. This is because we weren't waiting long enough for all callbacks to fire.

Patch below fixes that.

---

 linux-2.6.15-rc5-mm1-root/kernel/rcutorture.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)
kernel/rcutorture.c renamed from kernel/rcutorture.c~rcutorture_fix +1 -2
diff -puN kernel/rcutorture.c~rcutorture_fix kernel/rcutorture.c
@@ -408,9 +408,8 @@ rcu_torture_cleanup(void)
 	stats_task = NULL;
 
 	/* Wait for all RCU callbacks to fire.  */
+	rcu_barrier();
 
-	for (i = 0; i < RCU_TORTURE_PIPE_LEN; i++)
-		synchronize_rcu();
 	rcu_torture_stats_print();  /* -After- the stats thread is stopped! */
 	printk(KERN_ALERT TORTURE_FLAG
 	       "--- End of test: %s\n",

_

Signature · 5 lines
Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560017
#1 lore raw

kernel/rcutorture.c rcu_torture_cleanup(void) · line 411

Quoted 12 lines · Srivatsa Vaddagiri

While doing some test of RCU torture module, I hit a OOPS in rcu_do_batch, which was trying to processes callback of a module that was just removed. This is because we weren't waiting long enough for all callbacks to fire.

diff -puN kernel/rcutorture.c~rcutorture_fix kernel/rcutorture.c

kernel/rcutorture.c renamed from kernel/rcutorture.c~rcutorture_fix +1 -0
@@ -408,9 +408,8 @@ rcu_torture_cleanup(void)
 	stats_task = NULL;
 
 	/* Wait for all RCU callbacks to fire.  */
+	rcu_barrier();

Andrew,

This patch is dependent on the rcu_barrier patch buried in reiser4 patchset. It makes sense to merge that patch without waiting for reiser4 since rcutorture is already in mainline.
I will send an updated documentation patch describing why and how modules using RCU should use rcu_barrier().

Thanks
Dipankar

Acked-by on v1 1/1
#2 lore raw
In reply to Srivatsa Vaddagiri
Quoted 5 lines · Srivatsa Vaddagiri

While doing some test of RCU torture module, I hit a OOPS in rcu_do_batch, which was trying to processes callback of a module that was just removed. This is because we weren't waiting long enough for all callbacks to fire.

Patch below fixes that.

Good catch -- I had forgotten about rcu_barrier().

Thanx, Paul

Quoted 35 lines

---

 linux-2.6.15-rc5-mm1-root/kernel/rcutorture.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)

diff -puN kernel/rcutorture.c~rcutorture_fix kernel/rcutorture.c

kernel/rcutorture.c renamed from kernel/rcutorture.c~rcutorture_fix +1 -2
@@ -408,9 +408,8 @@ rcu_torture_cleanup(void)
 	stats_task = NULL;
 
 	/* Wait for all RCU callbacks to fire.  */
+	rcu_barrier();
 
-	for (i = 0; i < RCU_TORTURE_PIPE_LEN; i++)
-		synchronize_rcu();
 	rcu_torture_stats_print();  /* -After- the stats thread is stopped! */
 	printk(KERN_ALERT TORTURE_FLAG
 	       "--- End of test: %s\n",

_

Signature · 5 lines
Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560017