From: Erich Focht <efocht@ess.nec.de>
To: mark.gross@intel.com
Cc: "linux-kernel" <linux-kernel@vger.kernel.org>,
Robert Love <rml@tech9.net>, Daniel Jacobowitz <dan@debian.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: PATCH Multithreaded core dump support for the 2.5.14 (and 15) kernel.
Date: Fri, 17 May 2002 14:26:00 +0200 [thread overview]
Message-ID: <200205171426.00502.efocht@ess.nec.de> (raw)
> The original question was:
> Couldn't the TCore patch deadlock in elf_core_dump on a semiphore held by a
> sleeping process that gets placed onto the phantom runque?
>
> So far I can't tell the problem is real or not, but I'm worried :(
>
> I haven't hit any such deadlocks in my stress testing, such as it is. In my
> review of the code I don't see any obviouse problems dispite the fact that
> the mmap_sem is explicitly grabbed by elf_core_dump.
>
> --mgross
Here are two different examples:
- some ps [1] does __down_read(mm->mmap_sem).
- meanwhile one of the soon crashing threads [2] does sys_mmap(),
calls __down_write(current->mmap_sem), gets on the wait queue
because the semaphore is currently used by ps.
- another thread [3] crashes and wants to dump core, sends [2] to
the phantom rq, calls __down_read(current->mmap_sem) and waits.
- [1] finishes the job, calls __up_read(mm->mmap_sem), activates
[2] on the phantom rq, exits.
deadlock
Or:
- thread [2] does sys_mmap(), calls __down_write(current->mmap_sem),
gets the semaphore.
- thread [2] is preempted, taken off the cpu
- meanwhile thread [3] crashes, etc...
I think the problem only occurs if one of the related threads calls
__down_write() for one of the semaphores we need to get inside
elf_core_dump (which are these?). So maybe we could do two things:
- remeber the task which _has_ the write lock (add a "task_t sem_writer;"
variable to the semaphore structure)
- inside elf_core_dump use a special version of __down_read() which
checks whether any related thread is enqueued and waiting for this
semaphore or whether sem_writer points to a member of the own thread
group. The phantom rq lock should be held. This new __down_read()
could wait until only related threads are enqueued and waiting and just
deal as if the semaphore is free (temporarilly set the value to zero),
and add its original value at the end, when calling __up_read().
Just some thoughts... any opinions?
Regards,
Erich
--
Dr. Erich Focht <efocht@ess.nec.de>
NEC European Supercomputer Systems, European HPC Technology Center
next reply other threads:[~2002-05-17 12:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-17 12:26 Erich Focht [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-05-20 15:44 PATCH Multithreaded core dump support for the 2.5.14 (and 15) kernel Gross, Mark
[not found] <59885C5E3098D511AD690002A5072D3C057B485B@orsmsx111.jf.intel.com.suse.lists.linux.kernel>
[not found] ` <20020515120722.A17644@in.ibm.com.suse.lists.linux.kernel>
[not found] ` <20020515140448.C37@toy.ucw.cz.suse.lists.linux.kernel>
[not found] ` <200205152353.g4FNrew30146@unix-os.sc.intel.com.suse.lists.linux.kernel>
2002-05-16 12:54 ` Andi Kleen
2002-05-16 14:13 ` Mark Gross
2002-05-16 17:27 ` Andi Kleen
2002-05-16 17:36 ` Daniel Jacobowitz
2002-05-16 18:08 ` Mark Gross
2002-05-16 21:32 ` Alan Cox
2002-05-16 21:24 ` Robert Love
2002-05-16 18:40 ` Mark Gross
2002-05-14 16:38 Gross, Mark
2002-05-15 6:37 ` Vamsi Krishna S .
2002-05-15 14:04 ` Pavel Machek
2002-05-15 20:53 ` Mark Gross
2002-05-16 10:11 ` Pavel Machek
2002-05-13 19:17 Mark Gross
2002-05-14 15:35 ` Erich Focht
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=200205171426.00502.efocht@ess.nec.de \
--to=efocht@ess.nec.de \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=dan@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.gross@intel.com \
--cc=rml@tech9.net \
/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