lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1516694381-20333-3-git-send-email-lianglihao@huawei.com>
Date:   Tue, 23 Jan 2018 15:59:27 +0800
From:   <lianglihao@...wei.com>
To:     <paulmck@...ux.vnet.ibm.com>
CC:     <guohanjun@...wei.com>, <heng.z@...wei.com>, <hb.chen@...wei.com>,
        <lihao.liang@...il.com>, <linux-kernel@...r.kernel.org>
Subject: [PATCH RFC 02/16] rcutorture: Add PRCU rcu_torture_ops

From: Lihao Liang <lianglihao@...wei.com>

Reviewed-by: Heng Zhang <heng.z@...wei.com>
Signed-off-by: Lihao Liang <lianglihao@...wei.com>
---
 include/linux/rcupdate.h |  1 +
 kernel/rcu/rcutorture.c  | 40 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index e1e5d002..12df9709 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -84,6 +84,7 @@ enum rcutorture_type {
 	RCU_SCHED_FLAVOR,
 	RCU_TASKS_FLAVOR,
 	SRCU_FLAVOR,
+	PRCU_FLAVOR,
 	INVALID_RCU_FLAVOR
 };
 
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index ae6e574d..7d65bf0c 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -46,6 +46,7 @@
 #include <linux/delay.h>
 #include <linux/stat.h>
 #include <linux/srcu.h>
+#include <linux/prcu.h>
 #include <linux/slab.h>
 #include <linux/trace_clock.h>
 #include <asm/byteorder.h>
@@ -768,6 +769,43 @@ static bool __maybe_unused torturing_tasks(void)
 
 #endif /* #else #ifdef CONFIG_TASKS_RCU */
 
+/*
+ * Definitions for prcu torture testing.
+ */
+
+static int prcu_torture_read_lock(void) __acquires(RCU)
+{
+	prcu_read_lock();
+	return 0;
+}
+
+static void prcu_torture_read_unlock(int idx) __releases(RCU)
+{
+	prcu_read_unlock();
+}
+
+static struct rcu_torture_ops prcu_ops = {
+	.ttype		= PRCU_FLAVOR,
+	.init		= rcu_sync_torture_init,
+	.readlock	= prcu_torture_read_lock,
+	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */
+	.readunlock	= prcu_torture_read_unlock,
+	.started	= rcu_no_completed,
+	.completed	= rcu_no_completed,
+	.deferred_free	= NULL,
+	.sync		= synchronize_prcu,
+	.exp_sync	= synchronize_prcu,
+	.get_state	= NULL,
+	.cond_sync	= NULL,
+	.call		= NULL,
+	.cb_barrier	= NULL,
+	.fqs		= NULL,
+	.stats		= NULL,
+	.irq_capable	= 1,
+	.can_boost	= 0,
+	.name		= "prcu"
+};
+
 /*
  * RCU torture priority-boost testing.  Runs one real-time thread per
  * CPU for moderate bursts, repeatedly registering RCU callbacks and
@@ -1764,7 +1802,7 @@ rcu_torture_init(void)
 	int firsterr = 0;
 	static struct rcu_torture_ops *torture_ops[] = {
 		&rcu_ops, &rcu_bh_ops, &rcu_busted_ops, &srcu_ops, &srcud_ops,
-		&sched_ops, RCUTORTURE_TASKS_OPS
+		&sched_ops, &prcu_ops, RCUTORTURE_TASKS_OPS
 	};
 
 	if (!torture_init_begin(torture_type, verbose, &torture_runnable))
-- 
2.14.1.729.g59c0ea183

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ