From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Guillaume Autran <gautran@mrv.com>
Cc: akpm@osdl.org, linuxppc-embedded@ozlabs.org
Subject: Re: [PATCH] ppc32: fix destroy_context() race condition
Date: Wed, 13 Jul 2005 10:09:52 +1000 [thread overview]
Message-ID: <1121213392.31924.399.camel@gaston> (raw)
In-Reply-To: <42D3D277.106@mrv.com>
On Tue, 2005-07-12 at 10:23 -0400, Guillaume Autran wrote:
> Fix for a race condition when a task gets preempted by another task
> while executing the destroy_context(...) in a FEW_CONTEXTS environment.
> mm->context == NO_CONTEXT but the context_map may indicate all contexts
> are in use.
> The solution to this problem is to disable kernel preemption while
> destroying a MMU context.
>
> Signed-off-by: Guillaume Autran <gautran@mrv.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> ---
>
> diff -Nru a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h
> --- a/include/asm-ppc/mmu_context.h 2005-06-17 15:48:29.000000000 -0400
> +++ b/include/asm-ppc/mmu_context.h 2005-07-05 08:58:46.000000000 -0400
> @@ -149,6 +149,7 @@
> */
> static inline void destroy_context(struct mm_struct *mm)
> {
> + preempt_disable();
> if (mm->context != NO_CONTEXT) {
> clear_bit(mm->context, context_map);
> mm->context = NO_CONTEXT;
> @@ -156,6 +157,7 @@
> atomic_inc(&nr_free_contexts);
> #endif
> }
> + preempt_enable();
> }
>
> static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
>
>
>
>
>
prev parent reply other threads:[~2005-07-13 0:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-12 14:23 [PATCH] ppc32: fix destroy_context() race condition Guillaume Autran
2005-07-12 16:39 ` Eugene Surovegin
2005-07-12 18:29 ` Guillaume Autran
2005-07-12 18:45 ` Eugene Surovegin
2005-07-13 0:09 ` Benjamin Herrenschmidt [this message]
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=1121213392.31924.399.camel@gaston \
--to=benh@kernel.crashing.org \
--cc=akpm@osdl.org \
--cc=gautran@mrv.com \
--cc=linuxppc-embedded@ozlabs.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;
as well as URLs for NNTP newsgroup(s).