From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751273AbeAWIIs (ORCPT ); Tue, 23 Jan 2018 03:08:48 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:38669 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751211AbeAWIIp (ORCPT ); Tue, 23 Jan 2018 03:08:45 -0500 From: To: CC: , , , , Subject: [PATCH RFC 02/16] rcutorture: Add PRCU rcu_torture_ops Date: Tue, 23 Jan 2018 15:59:27 +0800 Message-ID: <1516694381-20333-3-git-send-email-lianglihao@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1516694381-20333-1-git-send-email-lianglihao@huawei.com> References: <1516694381-20333-1-git-send-email-lianglihao@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lihao Liang Reviewed-by: Heng Zhang Signed-off-by: Lihao Liang --- 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 #include #include +#include #include #include #include @@ -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