From: Jongman Heo <jongman.heo@samsung.com>
To: Josh Boyer <jwboyer@gmail.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
"x86@kernel.org" <x86@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Re: [PATCH v2 3/3] i387: support lazy restore of FPU state
Date: Tue, 21 Feb 2012 02:00:18 +0000 (GMT) [thread overview]
Message-ID: <12130999.96471329789614858.JavaMail.weblogic@epml01> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 4352 bytes --]
> Sender : Josh Boyer<jwboyer@gmail.com>
> Date : 2012-02-21 10:50 (GMT+09:00)
> Title : Re: [PATCH v2 3/3] i387: support lazy restore of FPU state
>
> > On Mon, Feb 20, 2012 at 2:48 PM, Linus Torvalds
> > wrote:
> >
> > From: Linus Torvalds
> > Date: Sun, 19 Feb 2012 13:27:00 -0800
> > Subject: [PATCH v2 3/3] i387: support lazy restore of FPU state
> >
> > This makes us recognize when we try to restore FPU state that matches
> > what we already have in the FPU on this CPU, and avoids the restore
> > entirely if so.
> >
> > To do this, we add two new data fields:
> >
> > - a percpu 'fpu_owner_task' variable that gets written any time we
> > update the "has_fpu" field, and thus acts as a kind of back-pointer
> > to the task that owns the CPU. The exception is when we save the FPU
> > state as part of a context switch - if the save can keep the FPU
> > state around, we leave the 'fpu_owner_task' variable pointing at the
> > task whose FP state still remains on the CPU.
> >
> > - a per-thread 'last_cpu' field, that indicates which CPU that thread
> > used its FPU on last. We update this on every context switch
> > (writing an invalid CPU number if the last context switch didn't
> > leave the FPU in a lazily usable state), so we know that *that*
> > thread has done nothing else with the FPU since.
> >
> > These two fields together can be used when next switching back to the
> > task to see if the CPU still matches: if 'fpu_owner_task' matches the
> > task we are switching to, we know that no other task (or kernel FPU
> > usage) touched the FPU on this CPU in the meantime, and if the current
> > CPU number matches the 'last_cpu' field, we know that this thread did no
> > other FP work on any other CPU, so the FPU state on the CPU must match
> > what was saved on last context switch.
> >
> > In that case, we can avoid the 'f[x]rstor' entirely, and just clear the
> > CR0.TS bit.
> >
> > Signed-off-by: Linus Torvalds
>
> I haven't tried really figuring this out yet, but building the Fedora kernel
> on x86_64 with your latest tree results in:
>
> ERROR: "fpu_owner_task" [lib/raid6/raid6_pq.ko] undefined!
> ERROR: "fpu_owner_task" [arch/x86/kvm/kvm.ko] undefined!
> ERROR: "fpu_owner_task" [arch/x86/crypto/sha1-ssse3.ko] undefined!
> ERROR: "fpu_owner_task" [arch/x86/crypto/serpent-sse2-x86_64.ko] undefined!
> ERROR: "fpu_owner_task" [arch/x86/crypto/ghash-clmulni-intel.ko] undefined!
> make[1]: *** [__modpost] Error 1
> make: *** [modules] Error 2
> + exit 1
>
> Since this patch went in as 7e16838d94b566a1, I'm guessing it's at least
> related.
>
> I'm building again with more verbose output but I thought I'd send this out
> quickly.
>
> josh
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
Similar here, with 32bit x86 build.
[snip]
LD net/built-in.o
LD vmlinux.o
MODPOST vmlinux.o
GEN .version
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
LD init/built-in.o
LD .tmp_vmlinux1
arch/x86/built-in.o: In function `__thread_clear_has_fpu':
/usr/src/linux/arch/x86/include/asm/i387.h:300: undefined reference to `fpu_owner_task'
arch/x86/built-in.o: In function `__thread_set_has_fpu':
/usr/src/linux/arch/x86/include/asm/i387.h:307: undefined reference to `fpu_owner_task'
arch/x86/built-in.o: In function `fpu_lazy_restore':
/usr/src/linux/arch/x86/include/asm/i387.h:354: undefined reference to `fpu_owner_task'
arch/x86/built-in.o: In function `__thread_set_has_fpu':
/usr/src/linux/arch/x86/include/asm/i387.h:307: undefined reference to `fpu_owner_task'
arch/x86/built-in.o: In function `__thread_clear_has_fpu':
/usr/src/linux/arch/x86/include/asm/i387.h:300: undefined reference to `fpu_owner_task'
arch/x86/built-in.o:/usr/src/linux/arch/x86/include/asm/i387.h:300: more undefined references to `fpu_owner_task' follow
make: *** [.tmp_vmlinux1] Error
In case you need my .config, please let me know~.
Jongman Heo.
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next reply other threads:[~2012-02-21 2:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-21 2:00 Jongman Heo [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-02-21 2:23 Re: [PATCH v2 3/3] i387: support lazy restore of FPU state Jongman Heo
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=12130999.96471329789614858.JavaMail.weblogic@epml01 \
--to=jongman.heo@samsung.com \
--cc=hpa@zytor.com \
--cc=jwboyer@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--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 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.