[PATCH] cobalt/x86: fix condition in eager fpu code for kernels < 4.14

Mauro Salvini mauro.salvini at smigroup.net
Mon Jan 7 10:50:54 CET 2019


On Sat, 2018-12-22 at 12:42 +0100, Jan Kiszka via Xenomai wrote:
> On 21.12.18 14:44, Henning Schild via Xenomai wrote:
> > From: Henning Schild <henning.schild at siemens.com>
> > 
> > We should mark the current task as not owning the fpu anymore if it
> > does
> > actually own the fpu, not if the fpu itself is active.
> > 
> > Fixes cb52e6c7438fa
> > 
> > Reported-by: Mauro Salvini <mauro.salvini at smigroup.net>
> > Signed-off-by: Henning Schild <henning.schild at siemens.com>
> > ---
> >   kernel/cobalt/arch/x86/thread.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/cobalt/arch/x86/thread.c
> > b/kernel/cobalt/arch/x86/thread.c
> > index a09560075..0c6054338 100644
> > --- a/kernel/cobalt/arch/x86/thread.c
> > +++ b/kernel/cobalt/arch/x86/thread.c
> > @@ -475,7 +475,7 @@ void xnarch_leave_root(struct xnthread *root)
> >   	switch_fpu_finish(&current->thread.fpu,
> > smp_processor_id());
> >   #else
> >   	/* mark current thread as not owning the FPU anymore */
> > -	if (&current->thread.fpu.fpstate_active)
> > +	if (&current->thread.fpu.fpregs_active)
> 
> Well, if you had used fpregs_active() here, you would have resolved
> also the 
> second bug of that line (which I only spotted now):
> "if (&something)" is always true...

Hi,

I'm trying this fix, I'll report results.

Regards
Mauro

> 
> Jan
> 
> >   		fpregs_deactivate(&current->thread.fpu);
> >   #endif
> >   }
> > 
> 
> 



More information about the Xenomai mailing list