[Pkg-oss4-maintainers] Bug#694631: oss4: Review of vmix FPU usage

Ben Hutchings ben at decadent.org.uk
Mon Dec 3 21:27:05 UTC 2012


On Sun, Dec 02, 2012 at 02:16:40PM +0000, Ben Hutchings wrote:
> I asked H. Peter Anvin (one of the Linux x86 maintainers) to review the
> FPU code.  This was done on IRC so I'll summarise:
> 
> 1. oss_fp_check() has no need to use kernel_fpu_begin() and
> kernel_fpu_end().  But it should use the CPU features API (see
> arch/x86/include/asm/cpufeature.h).
> 
> 2. oss_fp_save() and oss_fp_restore() *must not* modify cr0 or cr4
> directly.  kernel_fpu_begin() and kernel_fpu_end() take care of the
> necessary CR changes.

Bonus: the FP calculations are done between oss_fp_save() and
oss_fp_restore(), so those functions must call kernel_fpu_begin() and
kernel_fpu_end() respectively, rather than each calling both
functions!

> However the WARNING in this bug shows that vmix FPU usage is
> fundamentally unsafe - it calls these functions from an IRQ handler, and
> it is not always possible to use the FPU then without corrupting the
> state of the current task.
> 
> Please disable CONFIG_OSS_VMIX_FLOAT.

An alternative might be to run the vmix code in a tasklet.

Ben.

-- 
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
                                                              - Albert Camus



More information about the Pkg-oss4-maintainers mailing list