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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANN689GNtPi5d6KoGZMGP72w_HGe2Eoq_WuBjZvkm3Cwga0Z2A@mail.gmail.com>
Date:	Sat, 2 Feb 2013 19:22:40 -0800
From:	Michel Lespinasse <walken@...gle.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	David Howells <dhowells@...hat.com>, linux-kernel@...r.kernel.org,
	Rik van Riel <riel@...hat.com>,
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 0/2] extend synchro-test module to test spinlocks too

On Wed, Jan 2, 2013 at 2:39 PM, Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Sun, 30 Dec 2012 18:47:12 -0800
> Michel Lespinasse <walken@...gle.com> wrote:
>
>> I'm not sure whats' the back story with synchro-test though - they seem
>> to have been stuck in andrew's tree for a very long time now. Is there
>> any reason delaying their inclusion or is it just that nobody's been
>> pushing for them ?
>
> iirc, we decided that synchro-test wasn't valuable/important enough to
> put into mainline.  So it has been living in -mm for, umm, seven years.
>
> Let's revisit that decision.  What do you think is the case for inclusion?

Sorry for the late reply. I agree that this isn't useful on an
everyday basis, however such a test could be useful whenever some
locking discussions come up, such as with the spinlock performance
discussions when I started this thread, or the rwsem write lock
stealing right now. Also, I think we've accepted a lot more
non-core-kernel things over the last 7 years, so the bar may be lower
now.

> Here it is.  It will need a full re-review.

I think the first thing we may want to do is ask David if he has an
updated version - if he's been making changes, it would be rude to him
to check in a 7 year old version of his code.

> From: David Howells <dhowells@...hat.com>
> Subject: mutex subsystem, synchro-test module
>
> The attached patch adds a module for testing and benchmarking mutexes,
> semaphores and R/W semaphores.
>
> Using it is simple:
>
>         insmod synchro-test.ko <args>
>
> It will exit with error ENOANO after running the tests and printing the
> results to the kernel console log.
>
> The available arguments are:
>
>  (*) mx=N
>
>         Start up to N mutex thrashing threads, where N is at most 20. All will
>         try and thrash the same mutex.

Actually N is at most 64

>  (*) sm=N
>
>         Start up to N counting semaphore thrashing threads, where N is at most
>         20. All will try and thrash the same semaphore.

N is at most 64

>  (*) ism=M
>
>         Initialise the counting semaphore with M, where M is any positive
>         integer greater than zero. The default is 4.
>
>  (*) rd=N
>  (*) wr=O
>  (*) dg=P
>
>         Start up to N reader thrashing threads, O writer thrashing threads and
>         P downgrader thrashing threads, where N, O and P are at most 20
>         apiece. All will try and thrash the same read/write semaphore.

N, O and P are at most 64

>  (*) elapse=N
>
>         Run the tests for N seconds. The default is 5.
>
>  (*) load=N
>
>         Each thread delays for N uS whilst holding the lock. The dfault is 0.

default is 2 (I had actually sent a change to correct the doc here)

>  (*) interval=N
>
>         Each thread delays for N uS whilst not holding the lock. The default
>         is 0.

default is 2 (I had actually sent a change to correct the doc here)

>  (*) do_sched=1
>
>         Each thread will call schedule if required after each iteration.
>
>  (*) v=1
>
>         Print more verbose information, including a thread iteration
>         distribution list.
>
> The module should be enabled by turning on CONFIG_DEBUG_SYNCHRO_TEST to "m".
>
> [randy.dunlap@...cle.com: fix build errors, add <sched.h> header file]
> [akpm@...ux-foundation.org: remove smp_lock.h inclusion]
> [viro@...IV.linux.org.uk: kill daemonize() calls]
> [rdunlap@...otime.net: fix printk format warrnings]
> [walken@...gle.com: add spinlock test]
> [walken@...gle.com: document default load and interval values]
> Signed-off-by: David Howells <dhowells@...hat.com>
> Signed-off-by: Ingo Molnar <mingo@...e.hu>
> Signed-off-by: Adrian Bunk <bunk@...sta.de>
> Signed-off-by: Randy Dunlap <rdunlap@...otime.net>
> Signed-off-by: Michel Lespinasse <walken@...gle.com>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> ---
>
>  Documentation/synchro-test.txt |   59 +++
>  kernel/Makefile                |    1
>  kernel/synchro-test.c          |  586 +++++++++++++++++++++++++++++++
>  lib/Kconfig.debug              |   14
>  4 files changed, 660 insertions(+)

It's unclear if synchro-test.c should be in kernel/ - I think similar
tests nowadays tend to be in lib/ instead, though not always :)

> diff -puN /dev/null Documentation/synchro-test.txt
> --- /dev/null
> +++ a/Documentation/synchro-test.txt
> @@ -0,0 +1,59 @@
> +The synchro-test.ko module can be used for testing and benchmarking mutexes,
> +semaphores and R/W semaphores.
> +
> +The module is compiled by setting CONFIG_DEBUG_SYNCHRO_TEST to "m" when
> +configuring the kernel.
> +
> +Using it is simple:
> +
> +       insmod synchro-test.ko <args>
> +
> +It will exit with error ENOANO after running the tests and printing the
> +results to the kernel console log.
> +
> +The available arguments are:
> +
> + (*) mx=N
> +
> +       Start up to N mutex thrashing threads, where N is at most 20. All will
> +       try and thrash the same mutex.

max 64

> + (*) sm=N
> +
> +       Start up to N counting semaphore thrashing threads, where N is at most
> +       20. All will try and thrash the same semaphore.

max 64

> + (*) ism=M
> +
> +       Initialise the counting semaphore with M, where M is any positive
> +       integer greater than zero. The default is 4.
> +
> + (*) rd=N
> + (*) wr=O
> + (*) dg=P
> +
> +       Start up to N reader thrashing threads, O writer thrashing threads and
> +       P downgrader thrashing threads, where N, O and P are at most 20
> +       apiece. All will try and thrash the same read/write semaphore.

max 64

> + (*) elapse=N
> +
> +       Run the tests for N seconds. The default is 5.
> +
> + (*) load=N
> +
> +       Each thread delays for N uS whilst holding the lock. The default is 2.
> +
> + (*) interval=N
> +
> +       Each thread delays for N uS whilst not holding the lock. The default
> +       is 2.
> +
> + (*) do_sched=1
> +
> +       Each thread will call schedule if required after each iteration.
> +
> + (*) v=1
> +
> +       Print more verbose information, including a thread iteration
> +       distribution list.

Other than that I'm happy enough with the rest of this code :)

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ