From: Johannes Berg <johannes@sipsolutions.net>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Alasdair G Kergon <agk@redhat.com>, Milan Broz <mbroz@redhat.com>,
Ingo Molnar <mingo@elte.hu>,
Torsten Kaiser <just.for.lkml@googlemail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: 2.6.24-rc2-mm1: kcryptd vs lockdep
Date: Wed, 21 Nov 2007 17:06:13 +0100 [thread overview]
Message-ID: <1195661173.12000.46.camel@johannes.berg> (raw)
In-Reply-To: <20071121155842.GA864@tv-sign.ru>
[-- Attachment #1: Type: text/plain, Size: 1684 bytes --]
Hi,
> > Ok, then I have question: Is the following pseudocode correct
> > (and problem is in lock validation which checks something
> > already initialized for another queue) or reusing work_struct
> > is not permitted from inside called work function ?
> >
> > (Note comment in code "It is permissible to free the struct
> > work_struct from inside the function that is called from it".)
> >
> > struct work_struct work;
> > struct workqueue_struct *a, *b;
> >
> > do_b(*work)
> > {
> > /* do something else */
> > }
> >
> > do_a(*work)
> > {
> > /* do something */
> > INIT_WORK(&work, do_b);
> > queue_work(b, &work);
> > }
> >
> >
> > INIT_WORK(&work, do_a);
> > queue_work(a, &work);
>
> (just in case, in that particular case PREPARE_WORK() should be used)
>
> INIT_WORK(w) can be used if we know that "w" is not pending, and nobody
> else can write to this work (say, queue_work(w) or cancel_work_sync(w)).
> So currently the code above should work correctly.
>
> However, I'd say it is not correct, INIT_WORK() can throw out some debug
> info for example, or the implementation could be changed.
>
> I'm not sure about CONFIG_LOCKDEP (Johannes cc'ed). INIT_WORK() does
> lockdep_init_map(->lockdep_map) but run_workqueue() has a local copy,
> looks ok.
We explicitly need to use a copy of the lockdep_map for "locking" the
work struct as per the quoted comment. So as far as I can tell, what
INIT_WORK() is doing here is changing an at that point unused copy of
the lockdep map so I think it should be fine. Not sure about the other
fine points nor why you'd want this though :)
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2007-11-21 16:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071120234605.GG23667@elte.hu>
2007-11-21 15:58 ` Oleg Nesterov
2007-11-21 16:06 ` Johannes Berg [this message]
2007-11-24 10:53 ` [PATCH] debug_check_no_locks_freed: fix in_range() checks Oleg Nesterov
2007-11-24 12:18 ` Torsten Kaiser
2007-11-24 12:25 ` Oleg Nesterov
2007-11-24 12:35 ` Alasdair G Kergon
2007-11-24 12:22 ` Ingo Molnar
2007-11-19 7:23 2.6.24-rc2-mm1: kcryptd vs lockdep Torsten Kaiser
2007-11-19 7:56 ` Ingo Molnar
2007-11-19 19:34 ` Torsten Kaiser
2007-11-19 21:00 ` Milan Broz
2007-11-20 6:55 ` Torsten Kaiser
2007-11-20 14:40 ` Milan Broz
2007-11-20 23:36 ` Alasdair G Kergon
2007-11-23 10:21 ` Torsten Kaiser
2007-11-23 22:42 ` Torsten Kaiser
2007-11-24 3:49 ` Alasdair G Kergon
2007-11-24 4:03 ` Alasdair G Kergon
2007-11-24 6:38 ` Herbert Xu
2007-11-24 4:57 ` Torsten Kaiser
2007-11-24 4:13 ` Alasdair G Kergon
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=1195661173.12000.46.camel@johannes.berg \
--to=johannes@sipsolutions.net \
--cc=agk@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=just.for.lkml@googlemail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbroz@redhat.com \
--cc=mingo@elte.hu \
--cc=oleg@tv-sign.ru \
/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
all inboxes | Powered by JetHome®