From: Suresh Siddha <suresh.b.siddha@intel.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>,
mingo@elte.hu, hpa@zytor.com, tglx@linutronix.de,
andi@firstfloor.org, hch@infradead.org,
linux-kernel@vger.kernel.org,
Arjan van de Ven <arjan@linux.intel.com>
Subject: Re: [patch 1/2] x86, fpu: split FPU state from task struct - v5
Date: Tue, 11 Mar 2008 13:19:22 -0700 [thread overview]
Message-ID: <20080311201921.GE15909@linux-os.sc.intel.com> (raw)
In-Reply-To: <20080311050644.GB4589@martell.zuzino.mipt.ru>
On Tue, Mar 11, 2008 at 08:07:34AM +0300, Alexey Dobriyan wrote:
> On Mon, Mar 10, 2008 at 03:28:04PM -0700, Suresh Siddha wrote:
> > Split the FPU save area from the task struct. This allows easy migration
> > of FPU context, and it's generally cleaner. It also allows the following
> > two optimizations:
> >
> > 1) only allocate when the application actually uses FPU, so in the first
> > lazy FPU trap. This could save memory for non-fpu using apps. Next patch
> > does this lazy allocation.
> >
> > 2) allocate the right size for the actual cpu rather than 512 bytes always.
> > Patches enabling xsave/xrstor support (coming shortly) will take advantage
> > of this.
>
> Ugh, not seeing patch, but judging from description it will make
> "choose wrong CONFIG_M* and fxsave will corrupt random FPU state" situation
> likely?
No. CONFIG_M* doesn't determine the size of the state. Feature information from
the 'cpuid' instruction will dictate the size allocated/used. Anyhow, please
wait for the xsave patches.
>
> > --- linux-2.6-x86.orig/arch/x86/kernel/process_64.c
> > +++ linux-2.6-x86/arch/x86/kernel/process_64.c
> > @@ -634,7 +634,7 @@
> >
> > /* we're going to use this soon, after a few expensive things */
> > if (next_p->fpu_counter>5)
> > - prefetch(&next->i387.fxsave);
> > + prefetch(next->xstate);
>
> Can we please give it better name, like fpu_state? It's a member of
> task_struct after all.
It need not be only FPU. We can have non-math state here aswell.
selected 'xstate' for extended state. I am all open for any reasonable name,
reflecting math, extended math(fsave/fxsave/..) and future math/
non-math extensions.
> > {
> > unsigned long oldcr0 = read_cr0();
> > - extern void __bad_fxsave_alignment(void);
> > -
> > - if (offsetof(struct task_struct, thread.i387.fxsave) & 15)
> > - __bad_fxsave_alignment();
>
> I think removal of such checks needs giving necessary alignment to cache.
> Previously it worked because of __aligned((16)) and L1_CACHE_SHIFT
> combo.
alignment is now specified as part of kmem_cache_create() and checed
in the allocation routines.
thanks,
suresh
prev parent reply other threads:[~2008-03-11 20:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-10 22:28 [patch 1/2] x86, fpu: split FPU state from task struct - v5 Suresh Siddha
2008-03-10 22:28 ` [patch 2/2] x86, fpu: lazy allocation of FPU area " Suresh Siddha
2008-03-11 9:08 ` Ingo Molnar
2008-03-11 20:57 ` Suresh Siddha
2008-03-10 22:56 ` [patch 1/2] x86, fpu: split FPU state from task struct " Andi Kleen
2008-03-11 5:07 ` Alexey Dobriyan
2008-03-11 8:35 ` Ingo Molnar
2008-03-11 10:09 ` Alexey Dobriyan
2008-03-11 10:11 ` Ingo Molnar
2008-03-11 20:22 ` Suresh Siddha
2008-03-11 20:19 ` Suresh Siddha [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=20080311201921.GE15909@linux-os.sc.intel.com \
--to=suresh.b.siddha@intel.com \
--cc=adobriyan@gmail.com \
--cc=andi@firstfloor.org \
--cc=arjan@linux.intel.com \
--cc=hch@infradead.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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