From: Peter Zijlstra <peterz@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Uriel Guajardo <urielguajardojr@gmail.com>,
brendanhiggins@google.com, mingo@redhat.com, will@kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
kunit-dev@googlegroups.com, urielguajardo@google.com,
alan.maguire@oracle.com
Subject: Re: [PATCH v3] kunit: added lockdep support
Date: Sat, 15 Aug 2020 10:44:43 +0200 [thread overview]
Message-ID: <20200815084443.GO3982@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20200815083029.GA2430016@gmail.com>
On Sat, Aug 15, 2020 at 10:30:29AM +0200, Ingo Molnar wrote:
>
> * Uriel Guajardo <urielguajardojr@gmail.com> wrote:
>
> > From: Uriel Guajardo <urielguajardo@google.com>
> >
> > KUnit will fail tests upon observing a lockdep failure. Because lockdep
> > turns itself off after its first failure, only fail the first test and
> > warn users to not expect any future failures from lockdep.
> >
> > Similar to lib/locking-selftest [1], we check if the status of
> > debug_locks has changed after the execution of a test case. However, we
> > do not reset lockdep afterwards.
> >
> > Like the locking selftests, we also fix possible preemption count
> > corruption from lock bugs.
>
> > --- a/lib/kunit/Makefile
> > +++ b/lib/kunit/Makefile
>
> > +void kunit_check_lockdep(struct kunit *test, struct kunit_lockdep *lockdep) {
> > + int saved_preempt_count = lockdep->preempt_count;
> > + bool saved_debug_locks = lockdep->debug_locks;
> > +
> > + if (DEBUG_LOCKS_WARN_ON(preempt_count() != 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 (saved_debug_locks && !debug_locks) {
> > + kunit_set_failure(test);
> > + kunit_warn(test, "Dynamic analysis tool failure from LOCKDEP.");
> > + kunit_warn(test, "Further tests will have LOCKDEP disabled.");
> > + }
>
>
> So this basically duplicates what the boot-time locking self-tests do,
> in a poor fashion?
No, it makes sure that any kunit based self-test fails when it messes up
it's locking.
next prev parent reply other threads:[~2020-08-15 21:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-14 20:55 [PATCH v3] kunit: added lockdep support Uriel Guajardo
2020-08-14 20:58 ` Peter Zijlstra
2020-08-14 21:00 ` Uriel Guajardo
2020-08-15 8:30 ` Ingo Molnar
2020-08-15 8:44 ` Peter Zijlstra [this message]
2020-08-15 9:17 ` Ingo Molnar
2020-08-17 21:00 ` Uriel Guajardo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200815084443.GO3982@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=alan.maguire@oracle.com \
--cc=brendanhiggins@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=urielguajardo@google.com \
--cc=urielguajardojr@gmail.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox