locktorture.c (3e5aeaf53422bdd79fecf89aa160f048114e013c) locktorture.c (ae4823e427954d30ab393888a334f9d1fd8cd597)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Module-based torture test facility for locking
4 *
5 * Copyright (C) IBM Corporation, 2014
6 *
7 * Authors: Paul E. McKenney <paulmck@linux.ibm.com>
8 * Davidlohr Bueso <dave@stgolabs.net>

--- 530 unchanged lines hidden (view full) ---

539 .readlock = NULL,
540 .read_delay = NULL,
541 .readunlock = NULL,
542 .name = "ww_mutex_lock"
543};
544
545#ifdef CONFIG_RT_MUTEXES
546static DEFINE_RT_MUTEX(torture_rtmutex);
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Module-based torture test facility for locking
4 *
5 * Copyright (C) IBM Corporation, 2014
6 *
7 * Authors: Paul E. McKenney <paulmck@linux.ibm.com>
8 * Davidlohr Bueso <dave@stgolabs.net>

--- 530 unchanged lines hidden (view full) ---

539 .readlock = NULL,
540 .read_delay = NULL,
541 .readunlock = NULL,
542 .name = "ww_mutex_lock"
543};
544
545#ifdef CONFIG_RT_MUTEXES
546static DEFINE_RT_MUTEX(torture_rtmutex);
547static struct rt_mutex torture_nested_rtmutexes[MAX_NESTED_LOCKS];
548static struct lock_class_key nested_rtmutex_keys[MAX_NESTED_LOCKS];
547
549
550static void torture_rtmutex_init(void)
551{
552 int i;
553
554 for (i = 0; i < MAX_NESTED_LOCKS; i++)
555 __rt_mutex_init(&torture_nested_rtmutexes[i], __func__,
556 &nested_rtmutex_keys[i]);
557}
558
559static int torture_rtmutex_nested_lock(int tid __maybe_unused,
560 u32 lockset)
561{
562 int i;
563
564 for (i = 0; i < nested_locks; i++)
565 if (lockset & (1 << i))
566 rt_mutex_lock(&torture_nested_rtmutexes[i]);
567 return 0;
568}
569
548static int torture_rtmutex_lock(int tid __maybe_unused)
549__acquires(torture_rtmutex)
550{
551 rt_mutex_lock(&torture_rtmutex);
552 return 0;
553}
554
555static void torture_rtmutex_delay(struct torture_random_state *trsp)

--- 24 unchanged lines hidden (view full) ---

580static void torture_rt_boost_rtmutex(struct torture_random_state *trsp)
581{
582 if (!rt_boost)
583 return;
584
585 __torture_rt_boost(trsp);
586}
587
570static int torture_rtmutex_lock(int tid __maybe_unused)
571__acquires(torture_rtmutex)
572{
573 rt_mutex_lock(&torture_rtmutex);
574 return 0;
575}
576
577static void torture_rtmutex_delay(struct torture_random_state *trsp)

--- 24 unchanged lines hidden (view full) ---

602static void torture_rt_boost_rtmutex(struct torture_random_state *trsp)
603{
604 if (!rt_boost)
605 return;
606
607 __torture_rt_boost(trsp);
608}
609
610static void torture_rtmutex_nested_unlock(int tid __maybe_unused,
611 u32 lockset)
612{
613 int i;
614
615 for (i = nested_locks - 1; i >= 0; i--)
616 if (lockset & (1 << i))
617 rt_mutex_unlock(&torture_nested_rtmutexes[i]);
618}
619
588static struct lock_torture_ops rtmutex_lock_ops = {
620static struct lock_torture_ops rtmutex_lock_ops = {
621 .init = torture_rtmutex_init,
622 .nested_lock = torture_rtmutex_nested_lock,
589 .writelock = torture_rtmutex_lock,
590 .write_delay = torture_rtmutex_delay,
591 .task_boost = torture_rt_boost_rtmutex,
592 .writeunlock = torture_rtmutex_unlock,
623 .writelock = torture_rtmutex_lock,
624 .write_delay = torture_rtmutex_delay,
625 .task_boost = torture_rt_boost_rtmutex,
626 .writeunlock = torture_rtmutex_unlock,
627 .nested_unlock = torture_rtmutex_nested_unlock,
593 .readlock = NULL,
594 .read_delay = NULL,
595 .readunlock = NULL,
596 .name = "rtmutex_lock"
597};
598#endif
599
600static DECLARE_RWSEM(torture_rwsem);

--- 582 unchanged lines hidden ---
628 .readlock = NULL,
629 .read_delay = NULL,
630 .readunlock = NULL,
631 .name = "rtmutex_lock"
632};
633#endif
634
635static DECLARE_RWSEM(torture_rwsem);

--- 582 unchanged lines hidden ---