Re: [BK-2.5] Move "used FPU status" into new non-atomic thread_info->status field.

Andi Kleen (ak@muc.de)
Mon, 10 Mar 2003 22:28:15 +0100


On Mon, Mar 10, 2003 at 12:45:02PM -0800, David S. Miller wrote:
> Turned out the 32bit ptrace unlazy FPU path shared two lines too many
> with with the 32bit signal FPU saving path and was resetting the
> used_fpu flag. Result was that the FPU state of the child could be
> reinitialized in some circumstances on ptrace accesses.
>
> So what it depended upon was the FP control register state,
> not the state of the individual FPU registers, across fork()
> right?

Yes. The IA32 ABI says the FPU registers are clobbered in a function
call. And fork is a function call. Same with the SSE registers.

Unfortunately it is much more expensive to save individual registers
(SSE and x87 stack) than to just save everything using FXSAVE.
FXSAVE uses lazy saving and saves only the x87 registers that are
actually uses.

For SSE registers it may make sense, but then FXSAVE does that already
too and you always have to handle the x87 register stack too.

I doubt it would be a good idea to not use FXSAVE on i386. The microcode
can do a better job here because it has more information. In addition
it also promises to handle future new Intel registers transparently.

x86-64 ABIs have similar semantics.

-Andi
-
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/