From: Catalin Marinas <catalin.marinas@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "frank.rowand@am.sony.com" <frank.rowand@am.sony.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] PREEMPT_RT_FULL: ARM context switch needs IRQs enabled
Date: Fri, 16 Dec 2011 15:23:34 +0000 [thread overview]
Message-ID: <20111216152334.GD6342@arm.com> (raw)
In-Reply-To: <1324039793.18942.80.camel@twins>
On Fri, Dec 16, 2011 at 12:49:53PM +0000, Peter Zijlstra wrote:
> On Fri, 2011-12-16 at 11:43 +0000, Catalin Marinas wrote:
> > From 26d87e955f089fd246bee29bb388f22da1297e0c Mon Sep 17 00:00:00 2001
> > From: Catalin Marinas <catalin.marinas@arm.com>
> > Date: Fri, 16 Dec 2011 11:32:26 +0000
> > Subject: [PATCH] sched, mm: Use activate_mm() instead of switch_mm()
> >
> > The ARM port tries to remove __ARCH_WANT_INTERRUPTS_ON_CTXSW. Since the
> > actual pgd switching requires interrupts to be enabled on ARM (for
> > latency on ARMv5 and earlier and IPIs on ARMv6+), the solution is to
> > defer the pgd switching to a post context switch hook that is run with
> > interrupts enabled. There are however two additional direct calls to
> > switch_mm() without the additional post-switch hook and ARM would fail
> > to set the new pgd.
> >
> > This patch changes the switch_mm() call with activate_mm() which ensures
> > that the required pgd has been set. The activate_mm() function must be
> > called with interrupts enabled.
> >
> > Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> > Cc: Ingo Molnar <mingo@elte.hu>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > ---
> > kernel/sched.c | 2 +-
> > mm/mmu_context.c | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/sched.c b/kernel/sched.c
> > index 7b46a39..3976157 100644
> > --- a/kernel/sched.c
> > +++ b/kernel/sched.c
> > @@ -6310,7 +6310,7 @@ void idle_task_exit(void)
> > BUG_ON(cpu_online(smp_processor_id()));
> >
> > if (mm != &init_mm)
> > - switch_mm(mm, &init_mm, current);
> > + activate_mm(mm, &init_mm);
> > mmdrop(mm);
> > }
> >
> > diff --git a/mm/mmu_context.c b/mm/mmu_context.c
> > index cf332bc..4e44ac4 100644
> > --- a/mm/mmu_context.c
> > +++ b/mm/mmu_context.c
> > @@ -32,7 +32,7 @@ void use_mm(struct mm_struct *mm)
> > tsk->active_mm = mm;
> > }
> > tsk->mm = mm;
> > - switch_mm(active_mm, mm, tsk);
> > + activate_mm(active_mm, mm);
> > task_unlock(tsk);
> >
> > if (active_mm != mm)
> >
>
> alpha, cris, microblaze, powerpc appear to actually use that task
> argument of switch_mm(), so I'm not convinced this is actually correct.
We use it on ARM as well but in both cases above the task was current.
However, I can see that the activate_mm() implementation on other
architectures doesn't just call switch_mm(current), so the two may not
be functionally equivalent.
An alternative would be to only defer the pgd switching on ARM if
irqs_disabled() and leave the generic code untouched (well, apart from
the post-switch hook).
--
Catalin
next prev parent reply other threads:[~2011-12-16 15:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-16 3:20 Frank Rowand
2011-12-16 9:54 ` Peter Zijlstra
2011-12-16 11:13 ` Catalin Marinas
2011-12-16 11:43 ` Catalin Marinas
2011-12-16 12:49 ` Peter Zijlstra
2011-12-16 15:23 ` Catalin Marinas [this message]
2011-12-16 21:43 ` Steven Rostedt
2011-12-16 11:01 ` Catalin Marinas
2011-12-16 23:23 ` Frank Rowand
2011-12-19 10:02 ` Catalin Marinas
2011-12-20 1:49 ` Frank Rowand
2011-12-20 12:25 ` Catalin Marinas
[not found] ` <CAHkRjk5AbCGzPtb5qeWL4CpK=KrBzL_QgD55tzS36dGRjn-rQA@mail.gmail.com>
2011-12-20 20:09 ` Frank Rowand
2011-12-16 20:56 ` Frank Rowand
2011-12-16 21:36 ` Catalin Marinas
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=20111216152334.GD6342@arm.com \
--to=catalin.marinas@arm.com \
--cc=frank.rowand@am.sony.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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
Powered by JetHome