[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84v7wf49uo.fsf@jogness.linutronix.de>
Date: Fri, 22 Nov 2024 15:39:03 +0106
From: John Ogness <john.ogness@...utronix.de>
To: David Gow <davidgow@...gle.com>
Cc: Petr Mladek <pmladek@...e.com>, Sergey Senozhatsky
<senozhatsky@...omium.org>, Steven Rostedt <rostedt@...dmis.org>, Brendan
Higgins <brendanhiggins@...gle.com>, Rae Moar <rmoar@...gle.com>,
linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
linux-kernel@...r.kernel.org, Thomas Weißschuh
<thomas.weissschuh@...utronix.de>, Masahiro Yamada <masahiroy@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>, Andrew Morton
<akpm@...ux-foundation.org>, Yoann Congal <yoann.congal@...le.fr>, Alice
Ryhl <aliceryhl@...gle.com>, Randy Dunlap <rdunlap@...radead.org>, Roman
Gushchin <roman.gushchin@...ux.dev>, Jens Axboe <axboe@...nel.dk>, Mark
Rutland <mark.rutland@....com>, Jann Horn <jannh@...gle.com>
Subject: Re: [PATCH printk v1] printk: ringbuffer: Add KUnit test
Hi David,
On 2024-11-22, David Gow <davidgow@...gle.com> wrote:
> It's a little unusual for a KUnit test -- particularly since it is
> time-based and uses lots of threads. This isn't a problem, but it's
> definitely a good thing that it's marked as slow. Additionally, KUnit
> doesn't track any extra threads spawned, so it requires a bit more
> care.
>
> There are a couple of issues (e.g., it crashes on non-SMP systems, a
> potential race, etc) and some minor suggestions below. In short, it'd
> be a good idea to move some of the initialisation and checks into the
> main test function, rather than the helper threads.
>
> Equally, it looks like there are a bunch of variables shared between
> kthreads — do these need to be checked with READ_ONCE()/WRITE_ONCE(),
> or made volatile, or something?
Agreed.
> In fact, I'm not sure why there's a separate start_test() and
> test_readerwriter() function -- or indeed, a separate kthread? Am I
> missing something, or could everything start_test() does be done from
> the main test function/kthread?
You are not missing anything. It is definitely awkward, mostly because
it was taken from parts of my own personal testing software. I will
implement all your suggestions. Thanks for the detailed review!
John
Powered by blists - more mailing lists