fpudna: fpcurthread == curthread 2 times

Peter Wemm peter at wemm.org
Mon Jul 25 19:06:46 GMT 2005


On Sunday 10 April 2005 08:39 pm, Kris Kennaway wrote:
> Got this on an SMP package machine running 5.4-RC2:
>
> fpudna: fpcurthread == curthread 1 times
> fpudna: fpcurthread == curthread 2 times
>
> int
> fpudna()
> {
>         struct pcb *pcb;
>         register_t s;
>
>         if (PCPU_GET(fpcurthread) == curthread) {
>                 printf("fpudna: fpcurthread == curthread %d times\n",
>                     ++err_count);
>                 stop_emulating();
>                 return (1);
>         }
>
> Debugging message accidentally left in, or bug?
>
> Kris

If any folks are reliably seeing these messages, please try a tweak to 
amd64/amd64/fpu.c.  The lines near the top that are "__asm()"... please 
change them all to "__asm __volatile()"

This is the code that I'd like changed:
#define fldcw(addr)             __asm("fldcw %0" : : "m" (*(addr)))
#define fnclex()                __asm("fnclex")
#define fninit()                __asm("fninit")
#define fnstcw(addr)            __asm __volatile("fnstcw %0" : 
"=m" (*(addr)))
#define fnstsw(addr)            __asm __volatile("fnstsw %0" : 
"=m" (*(addr)))
#define fxrstor(addr)           __asm("fxrstor %0" : : "m" (*(addr)))
#define fxsave(addr)            __asm __volatile("fxsave %0" : 
"=m" (*(addr)))
#define ldmxcsr(r)              __asm __volatile("ldmxcsr %0" : : 
"m" (r))
#define start_emulating()       __asm("smsw %%ax; orb %0,%%al; lmsw 
%%ax" \
                                      : : "n" (CR0_TS) : "ax")
#define stop_emulating()        __asm("clts")

If this tweak has any effect (either better or worse), please let me 
know.  I'm wondering if there are some reordering effects going on 
here.

It is just a wild shot in the dark.  It won't hurt anything though and 
is safe to try.  Most likely it is a wild goose chase, but it could be 
worth a try.

What would be worth knowing is:  1) if the patch stops messages for 
people who see them regularly or repeatably, and/or 2) if the messages 
keep happening even with the patch applied.  The latter case indicates 
that it is a wild goose chase.

-- 
Peter Wemm - peter at wemm.org; peter at FreeBSD.org; peter at yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5


More information about the freebsd-amd64 mailing list