Re: FP emulator patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Kevin D. Kissell" wrote:
> 
> > >
> > >         if (current->used_math) {               /* Using the FPU again.
> > */
> > >                 lazy_fpu_switch(last_task_used_math);
> > >         } else {                                /* First time FPU user.
> > */
> > >                 init_fpu();
> > >                 current->used_math = 1;
> > >         }
> > >         last_task_used_math = current;
> > >
> > > Clearly the second path is logically the correct one.
> >
> > Not really.  See below.
> >
> > > BTW, do I see another bug here in do_cpu()?  It seems that before we
> call
> > > init_fpu(), we should check last_task_used_math.  If it is not NULL, we
> > should
> > > save the FP state to the last_task_used_math.  Hmm, strange ...
> >
> > Strange indeed.  And note that if the code were correct, your
> > surmise about the init_fpu() path being "logically the correct"
> > one would no longer be true - we'd be saving the FPU state of
> > the current process for no good reason.
> 
> And note further that, by forcing current->used_math to
> zero, the old code was in fact driving the signal handler
> needlessly into the broken code...
> 

By not clearing current->used_math bit, you are in fact restoring an FPU
context unnecessarily.

Jun


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux