From: Ingo Molnar <mingo@kernel.org>
To: lkp@lists.01.org
Subject: Re: [x86/asm/entry] BUG: unable to handle kernel paging request
Date: Tue, 10 Mar 2015 08:51:22 +0100 [thread overview]
Message-ID: <20150310075122.GA19571@gmail.com> (raw)
In-Reply-To: <CA+55aFxHfqS=GJLtcmd9NsP9qpquzd8Ow+AtOi+-hfxD=O-NDg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2767 bytes --]
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Mon, Mar 9, 2015 at 9:55 AM, Borislav Petkov <bp@alien8.de> wrote:
> > On Mon, Mar 09, 2015 at 09:49:42AM -0700, Linus Torvalds wrote:
> >>
> >> I don't remember when it was open-coded, and I never created a git
> >> archive of all the old tar-files from before BK, so it's not trivial
> >> to check ;(
> >
> > This maybe:
> >
> > http://git.kernel.org/cgit/linux/kernel/git/history/history.git/
>
> Ahh. Yes. Not a very good import (dates are generally crap etc), but
> better than nothing.
>
> It's still an ljmp to the TSS in 2.0.
>
> Looks like it got open coded in v2.1.109pre1 according to that.
>
> Around July -98 or something similar.
Yeah, and I initially thought that it was me who removed TSS switching
back then - but clearly, by the style of the new comment, the
v2.1.109pre1 change was written by you:
+/*
+ * switch_to(x,yn) should switch tasks from x to y.
+ *
+ * We fsave/fwait so that an exception goes off at the right time
+ * (as a call from the fsave or fwait in effect) rather than to
+ * the wrong process. Lazy FP saving no longer makes any sense
+ * with modern CPU's, and this simplifies a lot of things (SMP
+ * and UP become the same).
+ *
+ * NOTE! We used to use the x86 hardware context switching. The
+ * reason for not using it any more becomes apparent when you
+ * try to recover gracefully from saved state that is no longer
+ * valid (stale segment register values in particular). With the
+ * hardware task-switch, there is no way to fix up bad state in
+ * a reasonable manner.
+ *
+ * The fact that Intel documents the hardware task-switching to
+ * be slow is a fairly red herring - this code is not noticeably
+ * faster. However, there _is_ some room for improvement here,
+ * so the performance issues may eventually be a valid point.
+ * More important, however, is the fact that this allows us much
+ * more flexibility.
+ */
But ... I indeed did something in that area too, in 2.3.11pre3
(historic git 4c16d0765b0c6), I removed the TR loading from the
context switch path and removed the last remains of hardware based
task switching and made it all soft-switching:
+/*
+ * per-CPU TSS segments. Threads are completely 'soft' on Linux,
+ * no more per-task TSS's. The TSS size is kept cacheline-aligned
+ * so they are allowed to end up in the .data.cacheline_aligned
+ * section. Since TSS's are completely CPU-local, we want them
+ * on exact cacheline boundaries, to eliminate cacheline ping-pong.
+ */
+struct hard_thread_struct init_tss[NR_CPUS] __cacheline_aligned =
+ { [0 ... NR_CPUS-1] = INIT_TSS
};
Thanks,
Ingo
WARNING: multiple messages have this Message-ID (diff)
From: Ingo Molnar <mingo@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>,
Denys Vlasenko <vda.linux@googlemail.com>,
Andy Lutomirski <luto@amacapital.net>,
Fengguang Wu <fengguang.wu@intel.com>, X86 ML <x86@kernel.org>,
LKP <lkp@01.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [x86/asm/entry] BUG: unable to handle kernel paging request
Date: Tue, 10 Mar 2015 08:51:22 +0100 [thread overview]
Message-ID: <20150310075122.GA19571@gmail.com> (raw)
In-Reply-To: <CA+55aFxHfqS=GJLtcmd9NsP9qpquzd8Ow+AtOi+-hfxD=O-NDg@mail.gmail.com>
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Mon, Mar 9, 2015 at 9:55 AM, Borislav Petkov <bp@alien8.de> wrote:
> > On Mon, Mar 09, 2015 at 09:49:42AM -0700, Linus Torvalds wrote:
> >>
> >> I don't remember when it was open-coded, and I never created a git
> >> archive of all the old tar-files from before BK, so it's not trivial
> >> to check ;(
> >
> > This maybe:
> >
> > http://git.kernel.org/cgit/linux/kernel/git/history/history.git/
>
> Ahh. Yes. Not a very good import (dates are generally crap etc), but
> better than nothing.
>
> It's still an ljmp to the TSS in 2.0.
>
> Looks like it got open coded in v2.1.109pre1 according to that.
>
> Around July -98 or something similar.
Yeah, and I initially thought that it was me who removed TSS switching
back then - but clearly, by the style of the new comment, the
v2.1.109pre1 change was written by you:
+/*
+ * switch_to(x,yn) should switch tasks from x to y.
+ *
+ * We fsave/fwait so that an exception goes off at the right time
+ * (as a call from the fsave or fwait in effect) rather than to
+ * the wrong process. Lazy FP saving no longer makes any sense
+ * with modern CPU's, and this simplifies a lot of things (SMP
+ * and UP become the same).
+ *
+ * NOTE! We used to use the x86 hardware context switching. The
+ * reason for not using it any more becomes apparent when you
+ * try to recover gracefully from saved state that is no longer
+ * valid (stale segment register values in particular). With the
+ * hardware task-switch, there is no way to fix up bad state in
+ * a reasonable manner.
+ *
+ * The fact that Intel documents the hardware task-switching to
+ * be slow is a fairly red herring - this code is not noticeably
+ * faster. However, there _is_ some room for improvement here,
+ * so the performance issues may eventually be a valid point.
+ * More important, however, is the fact that this allows us much
+ * more flexibility.
+ */
But ... I indeed did something in that area too, in 2.3.11pre3
(historic git 4c16d0765b0c6), I removed the TR loading from the
context switch path and removed the last remains of hardware based
task switching and made it all soft-switching:
+/*
+ * per-CPU TSS segments. Threads are completely 'soft' on Linux,
+ * no more per-task TSS's. The TSS size is kept cacheline-aligned
+ * so they are allowed to end up in the .data.cacheline_aligned
+ * section. Since TSS's are completely CPU-local, we want them
+ * on exact cacheline boundaries, to eliminate cacheline ping-pong.
+ */
+struct hard_thread_struct init_tss[NR_CPUS] __cacheline_aligned =
+ { [0 ... NR_CPUS-1] = INIT_TSS
};
Thanks,
Ingo
next prev parent reply other threads:[~2015-03-10 7:51 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-06 23:30 [x86/asm/entry] BUG: unable to handle kernel paging request Fengguang Wu
2015-03-06 23:30 ` Fengguang Wu
2015-03-06 23:31 ` [x86/asm/entry] WARNING: CPU: 0 PID: 1 at crypto/algapi.c:341 crypto_wait_for_test() Fengguang Wu
2015-03-06 23:31 ` Fengguang Wu
2015-03-06 23:33 ` [x86/asm/entry] INFO: task swapper/0:1 blocked for more than 120 seconds Fengguang Wu
2015-03-06 23:33 ` Fengguang Wu
2015-03-07 0:33 ` [x86/asm/entry] BUG: unable to handle kernel paging request Andy Lutomirski
2015-03-07 0:33 ` Andy Lutomirski
2015-03-08 19:13 ` Denys Vlasenko
2015-03-08 19:13 ` Denys Vlasenko
2015-03-08 19:41 ` Andy Lutomirski
2015-03-08 19:41 ` Andy Lutomirski
2015-03-08 19:59 ` Denys Vlasenko
2015-03-08 19:59 ` Denys Vlasenko
2015-03-09 11:46 ` Ingo Molnar
2015-03-09 11:46 ` Ingo Molnar
2015-03-09 12:04 ` Denys Vlasenko
2015-03-09 12:04 ` Denys Vlasenko
2015-03-09 16:12 ` Linus Torvalds
2015-03-09 16:12 ` Linus Torvalds
2015-03-09 16:42 ` Ingo Molnar
2015-03-09 16:42 ` Ingo Molnar
2015-03-09 16:49 ` Linus Torvalds
2015-03-09 16:49 ` Linus Torvalds
2015-03-09 16:55 ` Borislav Petkov
2015-03-09 16:55 ` Borislav Petkov
2015-03-09 17:12 ` Linus Torvalds
2015-03-09 17:12 ` Linus Torvalds
2015-03-09 17:55 ` Dave Jones
2015-03-09 17:55 ` Dave Jones
2015-03-10 7:51 ` Ingo Molnar [this message]
2015-03-10 7:51 ` Ingo Molnar
2015-03-09 13:15 ` Andy Lutomirski
2015-03-09 13:15 ` Andy Lutomirski
2015-03-09 12:55 ` Denys Vlasenko
2015-03-09 12:55 ` Denys Vlasenko
2015-03-09 13:35 ` Andy Lutomirski
2015-03-09 13:35 ` Andy Lutomirski
2015-03-09 13:44 ` Denys Vlasenko
2015-03-09 13:44 ` Denys Vlasenko
2015-03-09 14:00 ` Andy Lutomirski
2015-03-09 14:00 ` Andy Lutomirski
2015-03-09 14:08 ` Denys Vlasenko
2015-03-09 14:08 ` Denys Vlasenko
2015-03-08 19:49 ` Denys Vlasenko
2015-03-08 19:49 ` Denys Vlasenko
2015-03-08 19:53 ` Andy Lutomirski
2015-03-08 19:53 ` Andy Lutomirski
2015-03-08 20:22 ` Denys Vlasenko
2015-03-08 20:22 ` Denys Vlasenko
2015-03-09 12:57 ` Brian Gerst
2015-03-09 12:57 ` Brian Gerst
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=20150310075122.GA19571@gmail.com \
--to=mingo@kernel.org \
--cc=lkp@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.