Re: CPU capabilities -- an update proposal

H. Peter Anvin (hpa@transmeta.com)
Fri, 02 Feb 2001 12:40:17 -0800


Hi there,

I like what you have done here, but there are a few things...

> diff -up --recursive --new-file linux-2.4.0-ac12.macro/include/asm-i386/bugs.h linux-2.4.0-ac12/include/asm-i386/bugs.h
> --- linux-2.4.0-ac12.macro/include/asm-i386/bugs.h Sun Jan 28 09:41:20 2001
> +++ linux-2.4.0-ac12/include/asm-i386/bugs.h Wed Jan 31 22:18:40 2001
> @@ -83,12 +83,12 @@ static void __init check_fpu(void)
> extern void __buggy_fxsr_alignment(void);
> __buggy_fxsr_alignment();
> }
> - if (cpu_has_fxsr) {
> + if (boot_has_fxsr) {
> printk(KERN_INFO "Enabling fast FPU save and restore... ");
> set_in_cr4(X86_CR4_OSFXSR);
> printk("done.\n");
> }
> - if (cpu_has_xmm) {
> + if (boot_has_xmm) {
> printk(KERN_INFO "Enabling unmasked SIMD FPU exception support... ");
> set_in_cr4(X86_CR4_OSXMMEXCPT);
> printk("done.\n");

Once you enable OSFXSR (therefore allowing user-space code to issue SSE
instructions) you *have* to save using FXSAVE, which you can only do if
*all* CPUs support FXSR. Therefore, I would say this is a buggy
change... it is not save to enable OSFXSR unless *all* the CPUs support
FXSR (they don't have to all support SSE, however, although since you
can't control which CPU you execute on, it's pretty useless if they
don't.)

This may mean the code needs to be restructured; I haven't looked at it
in detail.

-hpa

-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/