Skip to contentSkip to conversation

Make rcutorture be a module

PATCH Applied Paul E. McKenney 2 participants 2 messages Nov 13, 2005 – Nov 15, 2005

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make rcutorture be a module

Hello!

Make rcutorture be a module, as it currently is in mainline. Also add a definite success/failure indication and a test for architecture-specific memory barriers (in their interaction with RCU).

Signed-off-by <[email protected]>

---

 Documentation/RCU/proc.txt    |   88 -------
 Documentation/RCU/torture.txt |  127 ++++++++++
 fs/proc/proc_misc.c           |   37 ---
 include/linux/rcupdate.h      |    1 
 kernel/Kconfig.preempt        |    9 
 kernel/Makefile               |    1 
 kernel/rcupdate.c             |  308 +------------------------
 kernel/rcutorture.c           |  512 ++++++++++++++++++++++++++++++++++++++++++
 lib/Kconfig.debug             |   21 +
 mm/mmap.c                     |    2 
 10 files changed, 683 insertions(+), 423 deletions(-)
Documentation/RCU/proc.txt +0 -88
diff -urpNa -X dontdiff linux-2.6.14-rt10/Documentation/RCU/proc.txt linux-2.6.14-rt10-rcutorture/Documentation/RCU/proc.txt
@@ -117,91 +117,3 @@ o	"rtfe2=": The number of attempts to fl
 o	"rtfe3=": The number of attempts to flip the counters that failed
 	due to some task still being in an RCU read-side critical section
 	starting from before the last successful counter flip.
-
-
-CONFIG_RCU_TORTURE_TEST
-
-The CONFIG_RCU_TORTURE_TEST config option is available for all RCU
-implementations.  It makes three /proc entries available, namely: rcutw,
-rcutr, and rcuts.
-
-
-/proc/rcutw
-
-Reading this entry starts a new torture test, or ends an earlier one
-if one is already in progress (in other words, there can be only one
-writer at a time).  This sleeps uninterruptibly, so be sure to run
-it in the background.  One could argue that it would be good to have
-multiple writers, but Linux uses RCU heavily enough that you will get
-write-side contention whether you want it or not.  If you want additional
-write-side contention, repeatedly create and destroy several large file
-trees in parallel.  Or use some other RCU-protected update.
-
-
-/proc/rcutr
-
-Reading this entry starts a new torture reader, which runs until sent
-a signal (e.g., control-C).  If testing an RCU implementation with
-preemptible read-side critical sections, make sure to spawn at least
-two /proc/rcutr instances for each CPU.
-
-
-/proc/rcuts
-
-Displays the current state of the torture test:
-
-	ggp = 20961
-	rtc: c04496f4 ver: 8734 tfle: 0 rta: 8734 rtaf: 0 rtf: 8715
-	Reader Pipe:  88024120 63914 0 0 0 0 0 0 0 0 0
-	Reader Batch:  88024097 63937 0 0 0 0 0 0 0 0
-	Free-Block Circulation:  8733 8731 8729 8727 8725 8723 8721 8719 8717 8715 0
-
-The entries are as follows:
-
-o	"ggp": The number of counter flips (or batches) since boot.
-
-o	"rtc": The hexadecimal address of the structure currently visible
-	to readers.
-
-o	"ver": The number of times since boot that the rcutw writer task
-	has changed the structure visible to readers.
-
-o	"tfle": If non-zero, indicates that the "torture freelist"
-	containing structure to be placed into the "rtc" area is empty.
-	This condition is important, since it can fool you into thinking
-	that RCU is working when it is not.  :-/
-
-o	"rta": Number of structures allocated from the torture freelist.
-
-o	"rtaf": Number of allocations from the torture freelist that have
-	failed due to the list being empty.
-
-o	"rtf": Number of frees into the torture freelist.
-
-o	"Reader Pipe": Histogram of "ages" of structures seen by readers.
-	If any entries past the first two are non-zero, RCU is broken.
-	And /proc/rcuts prints "!!!" to make sure you notice.  The age
-	of a newly allocated structure is zero, it becomes one when
-	removed from reader visibility, and is incremented once per
-	grace period subsequently -- and is freed after passing through
-	(RCU_TORTURE_PIPE_LEN-2) grace periods.
-
-	The output displayed above was taken from a correctly working
-	RCU.  If you want to see what it looks like when broken, break
-	it yourself.  ;-)
-
-o	"Reader Batch": Another histogram of "ages" of structures seen
-	by readers, but in terms of counter flips (or batches) rather
-	than in terms of grace periods.  The legal number of non-zero
-	entries is again two.  The reason for this separate view is
-	that it is easier to get the third entry to show up in the
-	"Reader Batch" list than in the "Reader Pipe" list.
-
-o	"Free-Block Circulation": Shows the number of torture structures
-	that have reached a given point in the pipeline.  The first element
-	should closely correspond to the number of structures allocated,
-	the second to the number that have been removed from reader view,
-	and all but the last remaining to the corresponding number of
-	passes through a grace period.  The last entry should be zero,
-	as it is only incremented if a torture structure's counter
-	somehow gets incremented farther than it should.
Documentation/RCU/torture.txt +127 -0

127 lines not on this page · raw message

fs/proc/proc_misc.c +0 -37
diff -urpNa -X dontdiff linux-2.6.14-rt10/fs/proc/proc_misc.c linux-2.6.14-rt10-rcutorture/fs/proc/proc_misc.c
@@ -655,38 +655,6 @@ int rcu_read_proc_ctrs(char *page, char 
 }
 #endif /* #ifdef CONFIG_RCU_STATS */
 
-#ifdef CONFIG_RCU_TORTURE_TEST
-int rcu_read_proc_torture_writer(char *page, char **start, off_t off,
-			         int count, int *eof, void *data)
-{
-	int len;
-	extern int rcu_read_proc_torture_writer_data(char *page);
-
-	len = rcu_read_proc_torture_writer_data(page);
-	return proc_calc_metrics(page, start, off, count, eof, len);
-}
-
-int rcu_read_proc_torture_reader(char *page, char **start, off_t off,
-			         int count, int *eof, void *data)
-{
-	int len;
-	extern int rcu_read_proc_torture_reader_data(char *page);
-
-	len = rcu_read_proc_torture_reader_data(page);
-	return proc_calc_metrics(page, start, off, count, eof, len);
-}
-
-int rcu_read_proc_torture_stats(char *page, char **start, off_t off,
-			        int count, int *eof, void *data)
-{
-	int len;
-	extern int rcu_read_proc_torture_stats_data(char *page);
-
-	len = rcu_read_proc_torture_stats_data(page);
-	return proc_calc_metrics(page, start, off, count, eof, len);
-}
-#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
-
 void __init proc_misc_init(void)
 {
 	struct proc_dir_entry *entry;
@@ -715,11 +683,6 @@ void __init proc_misc_init(void)
 		{"rcuptrs",	rcu_read_proc_ptrs},
 		{"rcuctrs",	rcu_read_proc_ctrs},
 #endif /* #ifdef CONFIG_RCU_STATS */
-#ifdef CONFIG_RCU_TORTURE_TEST
-		{"rcutw",	rcu_read_proc_torture_writer},
-		{"rcutr",	rcu_read_proc_torture_reader},
-		{"rcuts",	rcu_read_proc_torture_stats},
-#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
 		{NULL,}
 	};
 	for (p = simple_ones; p->name; p++)
include/linux/rcupdate.h +1 -0
diff -urpNa -X dontdiff linux-2.6.14-rt10/include/linux/rcupdate.h linux-2.6.14-rt10-rcutorture/include/linux/rcupdate.h
@@ -300,6 +300,7 @@ extern void synchronize_sched(void);
 extern void rcu_init(void);
 extern void rcu_check_callbacks(int cpu, int user);
 extern void rcu_restart_cpu(int cpu);
+extern long rcu_batches_completed(void);
 
 /* Exported interfaces */
 extern void FASTCALL(call_rcu(struct rcu_head *head, 
kernel/Kconfig.preempt +0 -9
diff -urpNa -X dontdiff linux-2.6.14-rt10/kernel/Kconfig.preempt linux-2.6.14-rt10-rcutorture/kernel/Kconfig.preempt
@@ -163,12 +163,3 @@ config RCU_STATS
 	  Say Y here if you want to see RCU stats in /proc
 	  Say N if you are unsure.
 
-config RCU_TORTURE_TEST
-	bool "/proc torture tests for RCU"
-	default y
-	help
-	  This option provides /proc files that run torture tests on
-	  the preemptible realtime RCU implementation.
-
-	  Say Y here if you want to be able to run RCU torture tests.
-	  Say N if you are unsure.
kernel/Makefile +1 -0
diff -urpNa -X dontdiff linux-2.6.14-rt10/kernel/Makefile linux-2.6.14-rt10-rcutorture/kernel/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_DETECT_SOFTLOCKUP) += softl
 obj-$(CONFIG_GENERIC_HARDIRQS) += irq/
 obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
 obj-$(CONFIG_SECCOMP) += seccomp.o
+obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o
 
 ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y)
 # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
kernel/rcupdate.c +20 -288

353 lines not on this page · raw message

kernel/rcutorture.c +512 -0

512 lines not on this page · raw message

lib/Kconfig.debug +21 -0
diff -urpNa -X dontdiff linux-2.6.14-rt10/lib/Kconfig.debug linux-2.6.14-rt10-rcutorture/lib/Kconfig.debug
@@ -378,8 +378,29 @@ config USE_FRAME_POINTER
 	  on some architectures or you use external debuggers.
 	  If you don't debug the kernel, you can say N.
 
+config DEBUG_VM
+	bool "Debug VM"
+	depends on DEBUG_KERNEL
+	help
+	  Enable this to debug the virtual-memory system.
+
+	  If unsure, say N.
+
 config FRAME_POINTER
 	bool
 	depends on USE_FRAME_POINTER || MCOUNT
 	default y
 
+config RCU_TORTURE_TEST
+	tristate "torture tests for RCU"
+	depends on DEBUG_KERNEL
+	default n
+	help
+	  This option provides a kernel module that runs torture tests
+	  on the RCU infrastructure.  The kernel module may be built
+	  after the fact on the running kernel to be tested, if desired.
+
+	  Say Y here if you want RCU torture tests to start automatically
+	  at boot time (you probably don't).
+	  Say M if you want the RCU torture tests to build as a module.
+	  Say N if you are unsure.
mm/mmap.c +1 -1
diff -urpNa -X dontdiff linux-2.6.14-rt10/mm/mmap.c linux-2.6.14-rt10-rcutorture/mm/mmap.c
@@ -1821,7 +1821,7 @@ asmlinkage long sys_munmap(unsigned long
 
 static inline void verify_mm_writelocked(struct mm_struct *mm)
 {
-#ifdef CONFIG_DEBUG_KERNEL
+#ifdef CONFIG_DEBUG_VM
 # ifdef CONFIG_PREEMPT_RT
 	if (unlikely(!rt_rwsem_is_locked(&mm->mmap_sem))) {
 		WARN_ON(1);
Applied
#1 lore raw
Quoted 7 lines · Paul E. McKenney

Hello!

Make rcutorture be a module, as it currently is in mainline. Also add a definite success/failure indication and a test for architecture-specific memory barriers (in their interaction with RCU).

Signed-off-by <[email protected]>

thanks, applied.

Ingo