[CRIU] [PATCH 06/22] cpu: Prepare scaffold for obtaining cpu features

Cyrill Gorcunov gorcunov at openvz.org
Wed Dec 12 09:15:04 EST 2012


On Wed, Dec 12, 2012 at 06:09:11PM +0400, Pavel Emelyanov wrote:
> > 
> >>> +bool cpu_check_feature(CpuFeature *feature)
> >>> +{
> > 
> >> Name of function is bad.
> > 
> > Would cpu_verify_feature make you happy?
> 
> No. Since this function checks some _specific_ (_hardcoded_) feature, it should
> be named respectively.

OK, i'll try to invent something more sensible. thanks.

> > 
> >>From changelog
> > 
> >      - adds ability to find some of rt-features the _cpu_ supports. In
> >        particular if xsave insn is supported we need to know how big memory
> >        slab is needed to keep complete fpu frame
> > 
> > this gives us the size of fpu frame. Moreover, since we need to call cpuid
> > anyway, we do a fast early check for features we need from cpuid results.
> > If we have bits needed on hw level, we still need to check if kernel was not booted
> > with "nofxsr", which disables fxsave instruction and prevents us from continue
> > working, if everything is fine -- we can do restore.
> 
> That's OK, but why not use _one_ way of getting this -- either cpuid or proc?
> Why both?

1) proc doesn't provide us the size of fpu frame, thus we are to use cpuid
   to figure out how many memory we will need for FPU frame in rt_sigreturn
   call

2) while cpuid may return that there is fxsave instruction supported the kernel
   may be booted with nofxsr and any attempts to restore FPU via fxrstr simply
   fail

Thus we need two sites cpuid and proc. Sounds good? Or I misunderstand your
question?

	Cyrill


More information about the CRIU mailing list