From: Andy Walls <awalls@md.metrocast.net>
To: linux-kernel@vger.kernel.org
Cc: nicolas.mailhot@laposte.net, Tejun Heo <tj@kernel.org>,
Jarod Wilson <jarod@redhat.com>, Ingo Molnar <mingo@redhat.com>,
Mauro Carvalho Chehab <mchehab@redhat.com>,
Hans Verkuil <hverkuil@xs4all.nl>
Subject: [PATCH] kthread_worker: Initialize dynamically allocated spinlock properly for lockdep
Date: Sun, 19 Dec 2010 07:49:35 -0500 [thread overview]
Message-ID: <1292762975.2403.29.camel@localhost> (raw)
init_kthread_worker(), via KTHREAD_WORKER_INIT(), used an
initializer for static spin_lock objects, SPIN_LOCK_UNLOCKED, on
a dynamically allocated kthread_worker object's internal spinlock_t.
This causes lockdep to gripe:
INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
To keep lockdep happy, use spin_lock_init() for dynamically
allocated kthread_worker objects' internal spinlock_t.
Reported-by: Nicolas <nicolas.mailhot@laposte.net>
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Cc: Tejun Heo <tj@kernel.org>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 685ea65..e65d0b1 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -83,7 +83,13 @@ struct kthread_work {
static inline void init_kthread_worker(struct kthread_worker *worker)
{
- *worker = (struct kthread_worker)KTHREAD_WORKER_INIT(*worker);
+ /*
+ * Lockdep complains if a dynamically allocated worker's spinlock_t
+ * is initialzed using SPIN_LOCK_UNLOCKED.
+ */
+ spin_lock_init(&worker->lock);
+ INIT_LIST_HEAD(&worker->work_list);
+ worker->task = NULL;
}
static inline void init_kthread_work(struct kthread_work *work,
next reply other threads:[~2010-12-19 13:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-19 12:49 Andy Walls [this message]
2010-12-20 7:07 ` [PATCH] kthread_worker: Initialize dynamically allocated spinlock properly for lockdep Yong Zhang
2010-12-20 9:28 ` Yong Zhang
2010-12-20 16:21 ` Tejun Heo
2010-12-21 1:54 ` Yong Zhang
2010-12-21 4:40 ` [V2 PATCH] kthread_work: Make lockdep happy Yong Zhang
2010-12-21 12:59 ` Tejun Heo
2010-12-21 13:25 ` Nicolas Mailhot
2010-12-21 16:07 ` Andy Walls
2010-12-22 0:39 ` Andy Walls
2010-12-22 3:12 ` Yong Zhang
2010-12-22 3:23 ` [V3 " Yong Zhang
2010-12-22 9:33 ` Tejun Heo
2010-12-20 17:16 ` [PATCH] kthread_worker: Initialize dynamically allocated spinlock properly for lockdep Andy Walls
2010-12-21 2:02 ` Yong Zhang
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=1292762975.2403.29.camel@localhost \
--to=awalls@md.metrocast.net \
--cc=hverkuil@xs4all.nl \
--cc=jarod@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@redhat.com \
--cc=mingo@redhat.com \
--cc=nicolas.mailhot@laposte.net \
--cc=tj@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