Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Sep 2014 10:44:05 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r270850 - in head/sys: i386/i386 i386/include i386/isa x86/acpica
Message-ID:  <201409051044.05853.jhb@freebsd.org>
In-Reply-To: <20140905084305.GN2737@kib.kiev.ua>
References:  <201408301748.s7UHmc6H059701@svn.freebsd.org> <3070015.668SIdAzOX@ralph.baldwin.cx> <20140905084305.GN2737@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, September 05, 2014 4:43:05 am Konstantin Belousov wrote:
> On Thu, Sep 04, 2014 at 10:50:25PM -0400, John Baldwin wrote:
> > On Tuesday, September 02, 2014 06:41:27 PM Konstantin Belousov wrote:
> > > On Tue, Sep 02, 2014 at 11:00:57AM -0400, John Baldwin wrote:
> > > > I thought about that.  I could easily make a parallel array, or perhaps
> > > > use a separate 'susppcb' structure that includes a pcb and the savefpu
> > > > union and change susppcbs to be an array of those.  Which do you prefer? 
> > > > If we want to move some state out of the PCB on amd64 into this, then a
> > > > separate struct for susppcbs might be the sanest.
> > > 
> > > Yes, separate structure seems to be a way forward.
> > 
> > Please see www.freebsd.org/~jhb/patches/susppcb.patch  Note that I moved
> > fpususpend() out into a C function on amd64 so that resumectx() could still 
> > operate on just a pcb.  This also makes savectx and resumectx more symmetric
> > and matches what I ended up doing on i386.  This is tested for suspend and
> > resume on both i386 and amd64.
> 
> The implementation of fpuresume() in C is definitely an improvement.
> 
> You only moved the fpu context to the susppcb, I think this is good for
> now, we will want to move other bits later.
> 
> Do we need to keep pcb layout for KBI compat ?  I remember that pcb
> size is asserted to properly fit into pcpu area for percpu zones.
> But why keep the layout ?  I.e. moving all padding bits to the end.

I wasn't sure.  I thought the padding was there for ABI reasons.  If we don't
need KBI compat, I would much rather consolidate all the padding at the end.

> There is one weird detail, not touched by your patch.  Amd64 resume
> path calls initializecpu(), while i386 does not.  I do not see any
> use for the call, the reload of CRX registers by trampoline/resumectx
> should already set everything to working state.  E.g., enabling XMM
> in CR4 after fpu state is restored looks strange.

I can test that.

> Overall, it looks fine.  Do you prefer to have alloc_fpusave() on i386 ?

Well, it might be nice to have XSAVE on i386.  I'm not sure if Intel has
any 32-bit only chips planned that will use AVX or MPX, etc.  If they are,
then I do think AVX on i386 would be nice to have.  Barring XSAVE I think
we can just use a static savefpu on i386 for now.

We might also consider removing support for 486sx CPUs and requiring an
on-CPU FPU for i386.  If we do that we might able to use a common fpu.c
which would be even nicer.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409051044.05853.jhb>