public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC, PATCH 2/2] qrcu: add rcutorture test
@ 2006-11-29 23:54 Oleg Nesterov
  2006-12-02 21:09 ` Oleg Nesterov
  0 siblings, 1 reply; 3+ messages in thread
From: Oleg Nesterov @ 2006-11-29 23:54 UTC (permalink / raw)
  To: Andrew Morton, Jens Axboe
  Cc: Paul E. McKenney, Alan Stern, Josh Triplett, linux-kernel

Add rcutorture test for qrcu.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- 19-rc6/kernel/__rcutorture.c	2006-11-17 19:42:31.000000000 +0300
+++ 19-rc6/kernel/rcutorture.c	2006-11-29 20:05:23.000000000 +0300
@@ -465,6 +465,73 @@ static struct rcu_torture_ops srcu_ops =
 };
 
 /*
+ * Definitions for qrcu torture testing.
+ */
+
+static struct qrcu_struct qrcu_ctl;
+
+static void qrcu_torture_init(void)
+{
+	init_qrcu_struct(&qrcu_ctl);
+	rcu_sync_torture_init();
+}
+
+static void qrcu_torture_cleanup(void)
+{
+	synchronize_qrcu(&qrcu_ctl);
+	cleanup_qrcu_struct(&qrcu_ctl);
+}
+
+static int qrcu_torture_read_lock(void)
+{
+	return qrcu_read_lock(&qrcu_ctl);
+}
+
+static void qrcu_torture_read_unlock(int idx)
+{
+	qrcu_read_unlock(&qrcu_ctl, idx);
+}
+
+static int qrcu_torture_completed(void)
+{
+	return qrcu_ctl.completed;
+}
+
+static void qrcu_torture_synchronize(void)
+{
+	synchronize_qrcu(&qrcu_ctl);
+}
+
+static int qrcu_torture_stats(char *page)
+{
+	int cnt = 0;
+	int idx = qrcu_ctl.completed & 0x1;
+
+	cnt += sprintf(&page[cnt], "%s%s per-CPU(idx=%d):",
+			torture_type, TORTURE_FLAG, idx);
+
+	cnt += sprintf(&page[cnt], " (%d,%d)",
+			atomic_read(qrcu_ctl.ctr + 0),
+			atomic_read(qrcu_ctl.ctr + 1));
+
+	cnt += sprintf(&page[cnt], "\n");
+	return cnt;
+}
+
+static struct rcu_torture_ops qrcu_ops = {
+	.init = qrcu_torture_init,
+	.cleanup = qrcu_torture_cleanup,
+	.readlock = qrcu_torture_read_lock,
+	.readdelay = srcu_read_delay,
+	.readunlock = qrcu_torture_read_unlock,
+	.completed = qrcu_torture_completed,
+	.deferredfree = rcu_sync_torture_deferred_free,
+	.sync = qrcu_torture_synchronize,
+	.stats = qrcu_torture_stats,
+	.name = "qrcu"
+};
+
+/*
  * Definitions for sched torture testing.
  */
 
@@ -503,8 +570,8 @@ static struct rcu_torture_ops sched_ops 
 };
 
 static struct rcu_torture_ops *torture_ops[] =
-	{ &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops, &srcu_ops,
-	  &sched_ops, NULL };
+	{ &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops,
+	  &srcu_ops, &qrcu_ops, &sched_ops, NULL };
 
 /*
  * RCU torture writer kthread.  Repeatedly substitutes a new structure


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC, PATCH 2/2] qrcu: add rcutorture test
  2006-11-29 23:54 [RFC, PATCH 2/2] qrcu: add rcutorture test Oleg Nesterov
@ 2006-12-02 21:09 ` Oleg Nesterov
  2006-12-07 17:17   ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: Oleg Nesterov @ 2006-12-02 21:09 UTC (permalink / raw)
  To: Andrew Morton, Jens Axboe
  Cc: Paul E. McKenney, Alan Stern, Josh Triplett, linux-kernel

(with sparse annotations from Josh)

[PATCH 2/2] qrcu: add rcutorture test

Add rcutorture test for qrcu.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Josh Triplett <josh@freedesktop.org>

--- 19-rc6/include/linux/srcu.h~2_test	2006-11-30 04:32:42.000000000 +0300
+++ 19-rc6/include/linux/srcu.h	2006-12-03 00:03:18.000000000 +0300
@@ -64,8 +64,8 @@ struct qrcu_struct {
 };
 
 int init_qrcu_struct(struct qrcu_struct *qp);
-int qrcu_read_lock(struct qrcu_struct *qp);
-void qrcu_read_unlock(struct qrcu_struct *qp, int idx);
+int qrcu_read_lock(struct qrcu_struct *qp) __acquires(qp);
+void qrcu_read_unlock(struct qrcu_struct *qp, int idx) __releases(qp);
 void synchronize_qrcu(struct qrcu_struct *qp);
 
 /**
--- 19-rc6/kernel/rcutorture.c~2_test	2006-10-22 18:24:03.000000000 +0400
+++ 19-rc6/kernel/rcutorture.c	2006-12-03 00:03:18.000000000 +0300
@@ -465,6 +465,73 @@ static struct rcu_torture_ops srcu_ops =
 };
 
 /*
+ * Definitions for qrcu torture testing.
+ */
+
+static struct qrcu_struct qrcu_ctl;
+
+static void qrcu_torture_init(void)
+{
+	init_qrcu_struct(&qrcu_ctl);
+	rcu_sync_torture_init();
+}
+
+static void qrcu_torture_cleanup(void)
+{
+	synchronize_qrcu(&qrcu_ctl);
+	cleanup_qrcu_struct(&qrcu_ctl);
+}
+
+static int qrcu_torture_read_lock(void) __acquires(&qrcu_ctl)
+{
+	return qrcu_read_lock(&qrcu_ctl);
+}
+
+static void qrcu_torture_read_unlock(int idx) __releases(&qrcu_ctl)
+{
+	qrcu_read_unlock(&qrcu_ctl, idx);
+}
+
+static int qrcu_torture_completed(void)
+{
+	return qrcu_ctl.completed;
+}
+
+static void qrcu_torture_synchronize(void)
+{
+	synchronize_qrcu(&qrcu_ctl);
+}
+
+static int qrcu_torture_stats(char *page)
+{
+	int cnt = 0;
+	int idx = qrcu_ctl.completed & 0x1;
+
+	cnt += sprintf(&page[cnt], "%s%s per-CPU(idx=%d):",
+			torture_type, TORTURE_FLAG, idx);
+
+	cnt += sprintf(&page[cnt], " (%d,%d)",
+			atomic_read(qrcu_ctl.ctr + 0),
+			atomic_read(qrcu_ctl.ctr + 1));
+
+	cnt += sprintf(&page[cnt], "\n");
+	return cnt;
+}
+
+static struct rcu_torture_ops qrcu_ops = {
+	.init = qrcu_torture_init,
+	.cleanup = qrcu_torture_cleanup,
+	.readlock = qrcu_torture_read_lock,
+	.readdelay = srcu_read_delay,
+	.readunlock = qrcu_torture_read_unlock,
+	.completed = qrcu_torture_completed,
+	.deferredfree = rcu_sync_torture_deferred_free,
+	.sync = qrcu_torture_synchronize,
+	.stats = qrcu_torture_stats,
+	.name = "qrcu"
+};
+
+/*
  * Definitions for sched torture testing.
  */
 
@@ -503,8 +570,8 @@ static struct rcu_torture_ops sched_ops 
 };
 
 static struct rcu_torture_ops *torture_ops[] =
-	{ &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops, &srcu_ops,
-	  &sched_ops, NULL };
+	{ &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops,
+	  &srcu_ops, &qrcu_ops, &sched_ops, NULL };
 
 /*
  * RCU torture writer kthread.  Repeatedly substitutes a new structure


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC, PATCH 2/2] qrcu: add rcutorture test
  2006-12-02 21:09 ` Oleg Nesterov
@ 2006-12-07 17:17   ` Paul E. McKenney
  0 siblings, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2006-12-07 17:17 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Jens Axboe, Alan Stern, Josh Triplett,
	linux-kernel

On Sun, Dec 03, 2006 at 12:09:38AM +0300, Oleg Nesterov wrote:
> (with sparse annotations from Josh)
> 
> [PATCH 2/2] qrcu: add rcutorture test
> 
> Add rcutorture test for qrcu.

Works for me!

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> Signed-off-by: Josh Triplett <josh@freedesktop.org>
> 
> --- 19-rc6/include/linux/srcu.h~2_test	2006-11-30 04:32:42.000000000 +0300
> +++ 19-rc6/include/linux/srcu.h	2006-12-03 00:03:18.000000000 +0300
> @@ -64,8 +64,8 @@ struct qrcu_struct {
>  };
> 
>  int init_qrcu_struct(struct qrcu_struct *qp);
> -int qrcu_read_lock(struct qrcu_struct *qp);
> -void qrcu_read_unlock(struct qrcu_struct *qp, int idx);
> +int qrcu_read_lock(struct qrcu_struct *qp) __acquires(qp);
> +void qrcu_read_unlock(struct qrcu_struct *qp, int idx) __releases(qp);
>  void synchronize_qrcu(struct qrcu_struct *qp);
> 
>  /**
> --- 19-rc6/kernel/rcutorture.c~2_test	2006-10-22 18:24:03.000000000 +0400
> +++ 19-rc6/kernel/rcutorture.c	2006-12-03 00:03:18.000000000 +0300
> @@ -465,6 +465,73 @@ static struct rcu_torture_ops srcu_ops =
>  };
> 
>  /*
> + * Definitions for qrcu torture testing.
> + */
> +
> +static struct qrcu_struct qrcu_ctl;
> +
> +static void qrcu_torture_init(void)
> +{
> +	init_qrcu_struct(&qrcu_ctl);
> +	rcu_sync_torture_init();
> +}
> +
> +static void qrcu_torture_cleanup(void)
> +{
> +	synchronize_qrcu(&qrcu_ctl);
> +	cleanup_qrcu_struct(&qrcu_ctl);
> +}
> +
> +static int qrcu_torture_read_lock(void) __acquires(&qrcu_ctl)
> +{
> +	return qrcu_read_lock(&qrcu_ctl);
> +}
> +
> +static void qrcu_torture_read_unlock(int idx) __releases(&qrcu_ctl)
> +{
> +	qrcu_read_unlock(&qrcu_ctl, idx);
> +}
> +
> +static int qrcu_torture_completed(void)
> +{
> +	return qrcu_ctl.completed;
> +}
> +
> +static void qrcu_torture_synchronize(void)
> +{
> +	synchronize_qrcu(&qrcu_ctl);
> +}
> +
> +static int qrcu_torture_stats(char *page)
> +{
> +	int cnt = 0;
> +	int idx = qrcu_ctl.completed & 0x1;
> +
> +	cnt += sprintf(&page[cnt], "%s%s per-CPU(idx=%d):",
> +			torture_type, TORTURE_FLAG, idx);
> +
> +	cnt += sprintf(&page[cnt], " (%d,%d)",
> +			atomic_read(qrcu_ctl.ctr + 0),
> +			atomic_read(qrcu_ctl.ctr + 1));
> +
> +	cnt += sprintf(&page[cnt], "\n");
> +	return cnt;
> +}
> +
> +static struct rcu_torture_ops qrcu_ops = {
> +	.init = qrcu_torture_init,
> +	.cleanup = qrcu_torture_cleanup,
> +	.readlock = qrcu_torture_read_lock,
> +	.readdelay = srcu_read_delay,
> +	.readunlock = qrcu_torture_read_unlock,
> +	.completed = qrcu_torture_completed,
> +	.deferredfree = rcu_sync_torture_deferred_free,
> +	.sync = qrcu_torture_synchronize,
> +	.stats = qrcu_torture_stats,
> +	.name = "qrcu"
> +};
> +
> +/*
>   * Definitions for sched torture testing.
>   */
> 
> @@ -503,8 +570,8 @@ static struct rcu_torture_ops sched_ops
>  };
> 
>  static struct rcu_torture_ops *torture_ops[] =
> -	{ &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops, &srcu_ops,
> -	  &sched_ops, NULL };
> +	{ &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops,
> +	  &srcu_ops, &qrcu_ops, &sched_ops, NULL };
> 
>  /*
>   * RCU torture writer kthread.  Repeatedly substitutes a new structure
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-12-07 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-29 23:54 [RFC, PATCH 2/2] qrcu: add rcutorture test Oleg Nesterov
2006-12-02 21:09 ` Oleg Nesterov
2006-12-07 17:17   ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox