From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH] FPU LWP 6/8: create lazy and non-lazy FPU restore functions Date: Thu, 05 May 2011 08:13:42 +0100 Message-ID: <4DC26A46020000780003FC3E@vpn.id2.novell.com> References: <4DC062ED.3070802@amd.com> <4DC117D6020000780003F9CB@vpn.id2.novell.com> <4DC17FF3.5080706@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <4DC17FF3.5080706@amd.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Wei Huang Cc: "xen-devel@lists.xensource.com" , KeirFraser List-Id: xen-devel@lists.xenproject.org >>> On 04.05.11 at 18:33, Wei Huang wrote: > Checking whether there is a non-lazy state to save is architectural=20 > specific and very messy. For instance, we need to read LWP_CBADDR to=20 > confirm LWP's dirty state. This MSR is AMD specific and we don't want = to=20 > add it here. Plus reading data from LWP_CBADDR MSR might be as = expensive=20 > as clts/stts. >=20 > My previous email showed that the overhead with LWP is around 1%-2% = of=20 > __context_switch(). For non lwp-capable CPU, this overhead should be=20 > much smaller (only clts and stts) because xfeature_mask[LWP] is 0. I wasn't talking about determining whether LWP state is dirty, but much rather about LWP not being in use at all. > Yes, clts() and stts() don't have to called every time. How about this = one? >=20 > /* Restore FPU state whenever VCPU is schduled in. */ > void vcpu_restore_fpu_eager(struct vcpu *v) > { > ASSERT(!is_idle_vcpu(v)); >=20 >=20 > /* save the nonlazy extended state which is not tracked by CR0.TS = bit */ > if ( xsave_enabled(v) ) > { > /* Avoid recursion */ > clts(); > fpu_xrstor(v, XSTATE_NONLAZY); > stts(); > } That's certainly better, but I'd still like to see the xsave_enabled() check to be replaced by some form of lwp_enabled() or lazy_xsave_needed() or some such (which will at once exclude all pv guests until you care to add support for them). Jan