Re: [RFC 0/3] Basic support for LWP

From: Stephane Eranian
Date: Thu Oct 07 2010 - 11:13:04 EST


On Thu, Oct 7, 2010 at 3:59 PM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
> On 10/07/2010 03:46 AM, Stephane Eranian wrote:
>>
>> As for the patch itself, I am not an expert at xsave/xrstor, but it seems to
>> me you could decouple LWP from FPU. I think ÂBrian had the same comment.
>> I suspect this can be done and it will certainly look cleaner.
>>
>
> Well, once you're using XSAVE you're not decoupled from the FPU. ÂWorse,
> if you're using XSAVE and not honoring CR0.TS you have a major design flaw.
>
I looked at the LWP documentation and it says:

"LWP does not support the âlazyâ state save and restore that is
possible for floating point and SSE state. It does not interact with
the CR0.TS bit. Operating systems that support LWP must always do an
XSAVE to preserve the old threadâs LWP context and an XRSTOR to set up
the new LWP context. The OS can continue to do a lazy switch of the FP
and SSE state by ensuring that the corresponding bits in EDX:EAX are
clear when it executes the XSAVE and XRSTOR to handle the LWP
context."

They imply that you can still do lazy FP/SSE save/restore even though
CR0.TS does not monitor LWP access.

If LWP is used the kernel needs to call xsave/xrstor on ctxsw. It can
do this lazily by checking LWP_CBADDR.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/