* [PATCH] cobalt/x86: fix condition in eager fpu code for kernels < 4.14
@ 2018-12-21 13:44 Henning Schild
2018-12-22 11:42 ` Jan Kiszka
2019-01-07 13:04 ` [PATCHv2] " Henning Schild
0 siblings, 2 replies; 8+ messages in thread
From: Henning Schild @ 2018-12-21 13:44 UTC (permalink / raw)
To: xenomai
From: Henning Schild <henning.schild@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@smigroup.net>
Signed-off-by: Henning Schild <henning.schild@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(¤t->thread.fpu, smp_processor_id());
#else
/* mark current thread as not owning the FPU anymore */
- if (¤t->thread.fpu.fpstate_active)
+ if (¤t->thread.fpu.fpregs_active)
fpregs_deactivate(¤t->thread.fpu);
#endif
}
--
2.19.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] cobalt/x86: fix condition in eager fpu code for kernels < 4.14
2018-12-21 13:44 [PATCH] cobalt/x86: fix condition in eager fpu code for kernels < 4.14 Henning Schild
@ 2018-12-22 11:42 ` Jan Kiszka
2019-01-07 9:50 ` Mauro Salvini
2019-01-07 13:04 ` [PATCHv2] " Henning Schild
1 sibling, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2018-12-22 11:42 UTC (permalink / raw)
To: Henning Schild, xenomai
On 21.12.18 14:44, Henning Schild via Xenomai wrote:
> From: Henning Schild <henning.schild@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@smigroup.net>
> Signed-off-by: Henning Schild <henning.schild@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(¤t->thread.fpu, smp_processor_id());
> #else
> /* mark current thread as not owning the FPU anymore */
> - if (¤t->thread.fpu.fpstate_active)
> + if (¤t->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...
Jan
> fpregs_deactivate(¤t->thread.fpu);
> #endif
> }
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] cobalt/x86: fix condition in eager fpu code for kernels < 4.14
2018-12-22 11:42 ` Jan Kiszka
@ 2019-01-07 9:50 ` Mauro Salvini
0 siblings, 0 replies; 8+ messages in thread
From: Mauro Salvini @ 2019-01-07 9:50 UTC (permalink / raw)
To: Jan Kiszka, Henning Schild, xenomai
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@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@smigroup.net>
> > Signed-off-by: Henning Schild <henning.schild@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(¤t->thread.fpu,
> > smp_processor_id());
> > #else
> > /* mark current thread as not owning the FPU anymore */
> > - if (¤t->thread.fpu.fpstate_active)
> > + if (¤t->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(¤t->thread.fpu);
> > #endif
> > }
> >
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCHv2] cobalt/x86: fix condition in eager fpu code for kernels < 4.14
2018-12-21 13:44 [PATCH] cobalt/x86: fix condition in eager fpu code for kernels < 4.14 Henning Schild
2018-12-22 11:42 ` Jan Kiszka
@ 2019-01-07 13:04 ` Henning Schild
2019-01-08 14:17 ` Mauro Salvini
2019-01-09 14:22 ` Jan Kiszka
1 sibling, 2 replies; 8+ messages in thread
From: Henning Schild @ 2019-01-07 13:04 UTC (permalink / raw)
To: xenomai
From: Henning Schild <henning.schild@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@smigroup.net>
Signed-off-by: Henning Schild <henning.schild@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..ba807ac1e 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(¤t->thread.fpu, smp_processor_id());
#else
/* mark current thread as not owning the FPU anymore */
- if (¤t->thread.fpu.fpstate_active)
+ if (fpregs_active())
fpregs_deactivate(¤t->thread.fpu);
#endif
}
--
2.19.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCHv2] cobalt/x86: fix condition in eager fpu code for kernels < 4.14
2019-01-07 13:04 ` [PATCHv2] " Henning Schild
@ 2019-01-08 14:17 ` Mauro Salvini
2019-01-08 17:51 ` Henning Schild
2019-01-09 14:22 ` Jan Kiszka
1 sibling, 1 reply; 8+ messages in thread
From: Mauro Salvini @ 2019-01-08 14:17 UTC (permalink / raw)
To: Henning Schild, xenomai
On Mon, 2019-01-07 at 14:04 +0100, Henning Schild wrote:
> From: Henning Schild <henning.schild@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@smigroup.net>
> Signed-off-by: Henning Schild <henning.schild@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..ba807ac1e 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(¤t->thread.fpu, smp_processor_id());
> #else
> /* mark current thread as not owning the FPU anymore */
> - if (¤t->thread.fpu.fpstate_active)
> + if (fpregs_active())
> fpregs_deactivate(¤t->thread.fpu);
> #endif
> }
Hi all,
I tried to launch xeno-test several times under same previous
conditions and I confirm that this patch fixes the bug.
A side note: would not #include in
kernel/cobalt/arch/x86/thread.c lines 47,48 and 54 be redundant with
same includes in kernel/cobalt/arch/x86/include/asm/xenomai/thread.h
(that is indirectly included in thread.c)?
Thanks, regards
Mauro
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCHv2] cobalt/x86: fix condition in eager fpu code for kernels < 4.14
2019-01-08 14:17 ` Mauro Salvini
@ 2019-01-08 17:51 ` Henning Schild
2019-01-09 7:11 ` Mauro Salvini
0 siblings, 1 reply; 8+ messages in thread
From: Henning Schild @ 2019-01-08 17:51 UTC (permalink / raw)
To: Mauro Salvini; +Cc: xenomai
Am Tue, 8 Jan 2019 15:17:11 +0100
schrieb Mauro Salvini <mauro.salvini@smigroup.net>:
> On Mon, 2019-01-07 at 14:04 +0100, Henning Schild wrote:
> > From: Henning Schild <henning.schild@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@smigroup.net>
> > Signed-off-by: Henning Schild <henning.schild@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..ba807ac1e 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(¤t->thread.fpu,
> > smp_processor_id()); #else
> > /* mark current thread as not owning the FPU anymore */
> > - if (¤t->thread.fpu.fpstate_active)
> > + if (fpregs_active())
> > fpregs_deactivate(¤t->thread.fpu);
> > #endif
> > }
>
> Hi all,
>
> I tried to launch xeno-test several times under same previous
> conditions and I confirm that this patch fixes the bug.
Good to hear, thanks!
> A side note: would not #include in
> kernel/cobalt/arch/x86/thread.c lines 47,48 and 54 be redundant with
> same includes in kernel/cobalt/arch/x86/include/asm/xenomai/thread.h
> (that is indirectly included in thread.c)?
The latter does not have those includes. It is still very possible
that there are a few too many but that is what you have inclusion guards
for. And the code you are looking at 47,48 and 54 is all to support
legacy/old kernels. You are in the IPIPE_X86_FPU_EAGER case.
Henning
> Thanks, regards
> Mauro
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCHv2] cobalt/x86: fix condition in eager fpu code for kernels < 4.14
2019-01-08 17:51 ` Henning Schild
@ 2019-01-09 7:11 ` Mauro Salvini
0 siblings, 0 replies; 8+ messages in thread
From: Mauro Salvini @ 2019-01-09 7:11 UTC (permalink / raw)
To: Henning Schild; +Cc: xenomai
On Tue, 2019-01-08 at 18:51 +0100, Henning Schild wrote:
> Am Tue, 8 Jan 2019 15:17:11 +0100
> schrieb Mauro Salvini <mauro.salvini@smigroup.net>:
>
> > On Mon, 2019-01-07 at 14:04 +0100, Henning Schild wrote:
> > > From: Henning Schild <henning.schild@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@smigroup.net>
> > > Signed-off-by: Henning Schild <henning.schild@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..ba807ac1e 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(¤t->thread.fpu,
> > > smp_processor_id()); #else
> > > /* mark current thread as not owning the FPU anymore */
> > > - if (¤t->thread.fpu.fpstate_active)
> > > + if (fpregs_active())
> > > fpregs_deactivate(¤t->thread.fpu);
> > > #endif
> > > }
> >
> > Hi all,
> >
> > I tried to launch xeno-test several times under same previous
> > conditions and I confirm that this patch fixes the bug.
>
> Good to hear, thanks!
>
> > A side note: would not #include in
> > kernel/cobalt/arch/x86/thread.c lines 47,48 and 54 be redundant
> > with
> > same includes in
> > kernel/cobalt/arch/x86/include/asm/xenomai/thread.h
> > (that is indirectly included in thread.c)?
>
> The latter does not have those includes. It is still very possible
> that there are a few too many but that is what you have inclusion
> guards
> for. And the code you are looking at 47,48 and 54 is all to support
> legacy/old kernels. You are in the IPIPE_X86_FPU_EAGER case.
Yes, sorry, I wanted to write
kernel/cobalt/arch/x86/include/asm/xenomai/wrappers.h
Anyway no problem to have them in both files.
Regards
Mauro
>
> Henning
>
> > Thanks, regards
> > Mauro
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCHv2] cobalt/x86: fix condition in eager fpu code for kernels < 4.14
2019-01-07 13:04 ` [PATCHv2] " Henning Schild
2019-01-08 14:17 ` Mauro Salvini
@ 2019-01-09 14:22 ` Jan Kiszka
1 sibling, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2019-01-09 14:22 UTC (permalink / raw)
To: Henning Schild, xenomai
On 07.01.19 21:04, Henning Schild via Xenomai wrote:
> From: Henning Schild <henning.schild@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@smigroup.net>
> Signed-off-by: Henning Schild <henning.schild@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..ba807ac1e 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(¤t->thread.fpu, smp_processor_id());
> #else
> /* mark current thread as not owning the FPU anymore */
> - if (¤t->thread.fpu.fpstate_active)
> + if (fpregs_active())
> fpregs_deactivate(¤t->thread.fpu);
> #endif
> }
>
Thanks, applied it next.
Jan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-01-09 14:22 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-21 13:44 [PATCH] cobalt/x86: fix condition in eager fpu code for kernels < 4.14 Henning Schild
2018-12-22 11:42 ` Jan Kiszka
2019-01-07 9:50 ` Mauro Salvini
2019-01-07 13:04 ` [PATCHv2] " Henning Schild
2019-01-08 14:17 ` Mauro Salvini
2019-01-08 17:51 ` Henning Schild
2019-01-09 7:11 ` Mauro Salvini
2019-01-09 14:22 ` Jan Kiszka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.