[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG30EecPEzM7hkPxagCD8GQb=JUZhatyW50KAoaHjrHoj4BiFw@mail.gmail.com>
Date: Tue, 11 Aug 2020 12:03:51 -0500
From: Uriel Guajardo <urielguajardo@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Uriel Guajardo <urielguajardojr@...il.com>,
Brendan Higgins <brendanhiggins@...gle.com>, mingo@...hat.com,
will@...nel.org,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>, kunit-dev@...glegroups.com,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kunit: added lockdep support
On Mon, Aug 10, 2020 at 4:43 PM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Mon, Aug 10, 2020 at 09:32:57PM +0000, Uriel Guajardo wrote:
> > +static inline void kunit_check_locking_bugs(struct kunit *test,
> > + unsigned long saved_preempt_count)
> > +{
> > + preempt_count_set(saved_preempt_count);
> > +#ifdef CONFIG_TRACE_IRQFLAGS
> > + if (softirq_count())
> > + current->softirqs_enabled = 0;
> > + else
> > + current->softirqs_enabled = 1;
> > +#endif
> > +#if IS_ENABLED(CONFIG_LOCKDEP)
> > + local_irq_disable();
> > + if (!debug_locks) {
> > + kunit_set_failure(test);
> > + lockdep_reset();
> > + }
> > + local_irq_enable();
> > +#endif
> > +}
>
> Unless you can guarantee this runs before SMP brinup, that
> lockdep_reset() is terminally broken.
Good point. KUnit is initialized after SMP is set up, and KUnit can
also be built as a module, so it's not a guarantee that we can make.
Is there any other way to turn lockdep back on after we detect a
failure? It would be ideal if lockdep could still run in the next test
case after a failure in a previous one.
I suppose we could only display the first failure that occurs, similar
to how lockdep does it. But it could also be useful to developers if
they saw failures in subsequent test cases, with the knowledge that
those failures may be unreliable.
Powered by blists - more mailing lists