From: Ingo Molnar <mingo@kernel.org>
To: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Andy Lutomirski <luto@amacapital.net>,
Fengguang Wu <fengguang.wu@intel.com>, X86 ML <x86@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.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: Mon, 9 Mar 2015 17:42:50 +0100 [thread overview]
Message-ID: <20150309164249.GA24910@gmail.com> (raw)
In-Reply-To: <CAK1hOcNU+8BtCN2TR6ZBh3KTTJtFKdoTe36UfVb91AYxEmeqTg@mail.gmail.com>
* Denys Vlasenko <vda.linux@googlemail.com> wrote:
> On Mon, Mar 9, 2015 at 12:46 PM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Andy Lutomirski <luto@amacapital.net> wrote:
> >
> >> >> */
> >> >> unsigned long stack[64];
> >> >>
> >> >> Last I checked, 0x100 != 64. Also, wow, this is kind of disgusting. :)
> >> >
> >> >
> >> > Seems to be unused: I commented it out on "defconfig" build
> >> > and got no build errors.
> >>
> >> It's used. On 32-bit, NMIs don't use task gates (I don't know why),
> >
> > So task gates were a sexy hardware acceleration feature, eons ago, and
> > we used to rely on them a lot,
>
> IIRC task gates weren't used in Linux at first, [...]
AFAIK task gates were used to demo i386 context switching between
tasks, a certain famous ABABABAB... pair of tasks printing to the
console :-)
So task gates were used for context switching in Linux before it was
called Linux! :-)
Check out the first released version:
https://www.kernel.org/pub/linux/kernel/Historic/linux-0.01.tar.gz
It already does:
/*
* switch_to(n) should switch tasks to task nr n, first
* checking that n isn't the current task, in which case it does nothing.
* This also clears the TS-flag if the task we switched to has used
* tha math co-processor latest.
*/
#define switch_to(n) {\
struct {long a,b;} __tmp; \
__asm__("cmpl %%ecx,_current\n\t" \
"je 1f\n\t" \
"xchgl %%ecx,_current\n\t" \
"movw %%dx,%1\n\t" \
"ljmp %0\n\t" \
"cmpl %%ecx,%2\n\t" \
"jne 1f\n\t" \
"clts\n" \
"1:" \
::"m" (*&__tmp.a),"m" (*&__tmp.b), \
"m" (last_task_used_math),"d" _TSS(n),"c" ((long) task[n])); \
}
That LJMP is the TSS switch.
And in kernel/sched.c we did:
void sched_init(void)
{
int i;
struct desc_struct * p;
set_tss_desc(gdt+FIRST_TSS_ENTRY,&(init_task.task.tss));
:-)
Thanks,
Ingo
next prev parent reply other threads:[~2015-03-09 16:42 UTC|newest]
Thread overview: 26+ 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:31 ` [x86/asm/entry] WARNING: CPU: 0 PID: 1 at crypto/algapi.c:341 crypto_wait_for_test() 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-07 0:33 ` [x86/asm/entry] BUG: unable to handle kernel paging request Andy Lutomirski
2015-03-08 19:13 ` Denys Vlasenko
2015-03-08 19:41 ` Andy Lutomirski
2015-03-08 19:59 ` Denys Vlasenko
2015-03-09 11:46 ` Ingo Molnar
2015-03-09 12:04 ` Denys Vlasenko
2015-03-09 16:12 ` Linus Torvalds
2015-03-09 16:42 ` Ingo Molnar [this message]
2015-03-09 16:49 ` Linus Torvalds
2015-03-09 16:55 ` Borislav Petkov
2015-03-09 17:12 ` Linus Torvalds
2015-03-09 17:55 ` Dave Jones
2015-03-10 7:51 ` Ingo Molnar
2015-03-09 13:15 ` Andy Lutomirski
2015-03-09 12:55 ` Denys Vlasenko
2015-03-09 13:35 ` Andy Lutomirski
2015-03-09 13:44 ` Denys Vlasenko
2015-03-09 14:00 ` Andy Lutomirski
2015-03-09 14:08 ` Denys Vlasenko
2015-03-08 19:49 ` Denys Vlasenko
2015-03-08 19:53 ` Andy Lutomirski
2015-03-08 20:22 ` Denys Vlasenko
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=20150309164249.GA24910@gmail.com \
--to=mingo@kernel.org \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@01.org \
--cc=luto@amacapital.net \
--cc=torvalds@linux-foundation.org \
--cc=vda.linux@googlemail.com \
--cc=x86@kernel.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).