All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] Unrecoverable FP Unavailable Exception 801
@ 2018-04-02 12:56 Sagi Maimon
  2018-04-02 14:19 ` Philippe Gerum
  2018-04-02 15:23 ` Lennart Sorensen
  0 siblings, 2 replies; 20+ messages in thread
From: Sagi Maimon @ 2018-04-02 12:56 UTC (permalink / raw)
  To: xenomai

Hi all,
I am working with: Powerpc e300 SOC.
I am using: xenomai-2.6.4 version

I am experiencing this exception on my Linux :
Unrecoverable FP Unavailable Exception 801 at c0003858
Oops: Unrecoverable FP Unavailable Exception, sig: 6 [#1]

This happens during "alignment exception" (600)

I found this link:
https://www.mail-archive.com/search?l=xenomai@xenomai.org&q=subject:%22Re%5C%3A+%5C%5BXenomai%5C%5D+FPU+problems+in+Xenomai+2.4.x%22&o=newest&f=1

As I understand heavy use of FPU by Linux application with the xenomai can Couse this problem.
I have built a Linux application that causes many "alignment exceptions", but I don't get any Unrecoverable FP Unavailable Exceptions.

Does anyone familiar with this error?
Have this problem fixed in recent xenomai/ipipe versions?
Where can I find a list of fixes made in any xenomai/ipipe version?

Thanks,


Sagi Maimon
Manager R&D Software Oscilloquartz SA.
ADVA Optical Networking
Phone: +972 9 775 0124
Mobile: +972 54 5662632
e-mail: SMaimon@advaoptical.com<mailto:SMaimon@advaoptical.com>
[ADVA_OSA_Logo]
www.oscilloquartz.com<http://www.oscilloquartz.com/>
www.advaoptical.com<http://www.advaoptical.com/>




-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 4482 bytes
Desc: image001.jpg
URL: <http://xenomai.org/pipermail/xenomai/attachments/20180402/8864aee2/attachment.jpg>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-02 12:56 [Xenomai] Unrecoverable FP Unavailable Exception 801 Sagi Maimon
@ 2018-04-02 14:19 ` Philippe Gerum
  2018-04-02 15:23 ` Lennart Sorensen
  1 sibling, 0 replies; 20+ messages in thread
From: Philippe Gerum @ 2018-04-02 14:19 UTC (permalink / raw)
  To: xenomai

On 04/02/2018 02:56 PM, Sagi Maimon wrote:
> Hi all,
> I am working with: Powerpc e300 SOC.
> I am using: xenomai-2.6.4 version

The key information is: which I-pipe version.

> 
> I am experiencing this exception on my Linux :
> Unrecoverable FP Unavailable Exception 801 at c0003858
> Oops: Unrecoverable FP Unavailable Exception, sig: 6 [#1]
> 
> This happens during "alignment exception" (600)
> 
> I found this link:
> https://www.mail-archive.com/search?l=xenomai@xenomai.org&q=subject:%22Re%5C%3A+%5C%5BXenomai%5C%5D+FPU+problems+in+Xenomai+2.4.x%22&o=newest&f=1
> 
> As I understand heavy use of FPU by Linux application with the xenomai can Couse this problem.

Reading the discussion you mentioned, it says that the bug(s) mentioned
have been fixed in 2.6.2.1, so this is unlikely to apply to 2.6.4.

> I have built a Linux application that causes many "alignment exceptions", but I don't get any Unrecoverable FP Unavailable Exceptions.
> 
> Does anyone familiar with this error?

The e300 core may also issue alignment exceptions for misaligned
single/multiple integer stores, or dcbz insn to write-through or
cache-inhibited memory.

> Have this problem fixed in recent xenomai/ipipe versions?

No fix related to this since ages.

> Where can I find a list of fixes made in any xenomai/ipipe version?
> 

Only in the git commit logs for the related I-pipe and Xenomai source trees.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-02 12:56 [Xenomai] Unrecoverable FP Unavailable Exception 801 Sagi Maimon
  2018-04-02 14:19 ` Philippe Gerum
@ 2018-04-02 15:23 ` Lennart Sorensen
  1 sibling, 0 replies; 20+ messages in thread
From: Lennart Sorensen @ 2018-04-02 15:23 UTC (permalink / raw)
  To: Sagi Maimon; +Cc: xenomai

On Mon, Apr 02, 2018 at 12:56:39PM +0000, Sagi Maimon wrote:
> Hi all,
> I am working with: Powerpc e300 SOC.
> I am using: xenomai-2.6.4 version
> 
> I am experiencing this exception on my Linux :
> Unrecoverable FP Unavailable Exception 801 at c0003858
> Oops: Unrecoverable FP Unavailable Exception, sig: 6 [#1]
> 
> This happens during "alignment exception" (600)
> 
> I found this link:
> https://www.mail-archive.com/search?l=xenomai@xenomai.org&q=subject:%22Re%5C%3A+%5C%5BXenomai%5C%5D+FPU+problems+in+Xenomai+2.4.x%22&o=newest&f=1
> 
> As I understand heavy use of FPU by Linux application with the xenomai can Couse this problem.
> I have built a Linux application that causes many "alignment exceptions", but I don't get any Unrecoverable FP Unavailable Exceptions.
> 
> Does anyone familiar with this error?
> Have this problem fixed in recent xenomai/ipipe versions?
> Where can I find a list of fixes made in any xenomai/ipipe version?

As far as I recall (it has been a few years), the powerpc does not allow
unalligned 64 bit floating point accesses.  So your data better be
aligned properly.

-- 
Len Sorensen


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-25 16:49                   ` Philippe Gerum
  2018-04-24 18:54                     ` Steven Seeger
@ 2018-04-30  3:21                     ` Steven Seeger
  1 sibling, 0 replies; 20+ messages in thread
From: Steven Seeger @ 2018-04-30  3:21 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: Adnan Ali, Sakari Junnila, xenomai

Hello all. I've created what Philippe thinks is a good patch for this issue as 
well as looked at other cases of clobbered bits in the MSR as it relates to 
vsx, spe, and altivec. I have checked in a patch on our interim 4.14 IPIPE 
work which is not yet public. It looks trivial to backport this to 4.9. I am a 
new maintainer even though I've been a thorn in Philippe's side for well over 
a decade. Once he takes a minute from his busy life to grant me access to push 
a change for 4.9 I will do so.

In the meantime, for anyone who would like to see this issue patched on 4.9.51 
against the latest ipipe-core-4.9.51-powerpc-3.patch this should work:

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index ed47cc3..866983a 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -172,6 +172,7 @@ void giveup_fpu(struct task_struct *tsk)
 	msr_check_and_set(MSR_FP);
 	__giveup_fpu(tsk);
 	msr_check_and_clear(MSR_FP);
+    flags &= MSR_FP;
 	hard_cond_local_irq_restore(flags);
 }
 EXPORT_SYMBOL(giveup_fpu);
@@ -204,6 +205,11 @@ void flush_fp_to_thread(struct task_struct *tsk)
 			 */
 			BUG_ON(tsk != current);
 			giveup_fpu(tsk);
+
+			/* giveup_fpu clears the MSR_FP bit from MSR
+			 * unconditionally
+			 */
+			flags &= ~MSR_FP;
 		}
 		hard_preempt_enable(flags);
 	}
@@ -219,6 +225,7 @@ void enable_kernel_fp(void)
 	flags = hard_cond_local_irq_save();
 
 	cpumsr = msr_check_and_set(MSR_FP);
+	flags |= MSR_FP; /* must exit this routine with MSR_FP bit set */
 
 	if (current->thread.regs && (current->thread.regs->msr & MSR_FP)) {
 		check_if_tm_restore_required(current);
@@ -285,6 +292,7 @@ void enable_kernel_altivec(void)
 
 	flags = hard_cond_local_irq_save();
 	cpumsr = msr_check_and_set(MSR_VEC);
+	flags |= MSR_VEC; /* must exit this routine with MSR_VEC set in MSR */
 
 	if (current->thread.regs && (current->thread.regs->msr & MSR_VEC)) {
 		check_if_tm_restore_required(current);
@@ -317,6 +325,10 @@ void flush_altivec_to_thread(struct task_struct *tsk)
 		if (tsk->thread.regs->msr & MSR_VEC) {
 			BUG_ON(tsk != current);
 			giveup_altivec(tsk);
+			/* giveup_altivec() clears MSR_VEC
+			 * unconditionally from MSR
+			 */
+			flags &= ~MSR_VEC;
 		}
 		hard_preempt_enable(flags);
 	}
@@ -405,6 +417,10 @@ void flush_vsx_to_thread(struct task_struct *tsk)
 		if (tsk->thread.regs->msr & (MSR_VSX|MSR_VEC|MSR_FP)) {
 			BUG_ON(tsk != current);
 			giveup_vsx(tsk);
+			/* giveup_vsx() clears MSR_FP,VEC,VSX unconditionally
+			 * so clear them in flags
+			 */
+			flags &= ~(MSR_FP|MSR_VEC|MSR_VSX);
 		}
 		hard_preempt_enable(flags);
 	}
@@ -436,6 +452,7 @@ void giveup_spe(struct task_struct *tsk)
 	msr_check_and_set(MSR_SPE);
 	__giveup_spe(tsk);
 	msr_check_and_clear(MSR_SPE);
+    flags &= MSR_SPE;
 	hard_cond_local_irq_restore(flags);
 }
 EXPORT_SYMBOL(giveup_spe);
@@ -448,7 +465,8 @@ void enable_kernel_spe(void)
 
 	flags = hard_cond_local_irq_save();
 	msr_check_and_set(MSR_SPE);
-
+	/* must exit this routine with MSR_SPE set in MSR */
+	flags |= MSR_SPE;
 	if (current->thread.regs && (current->thread.regs->msr & MSR_SPE)) {
 		check_if_tm_restore_required(current);
 		__giveup_spe(current);
@@ -467,6 +485,10 @@ void flush_spe_to_thread(struct task_struct *tsk)
 			BUG_ON(tsk != current);
 			tsk->thread.spefscr = mfspr(SPRN_SPEFSCR);
 			giveup_spe(tsk);
+			/* giveup_spe clears MSR_SPE from MSR, so must clear
+			 * it here to exit rouitine properly
+			 */
+			flags &= MSR_SPE;
 		}
 		hard_preempt_enable(flags);
 	}
@@ -531,6 +553,7 @@ void giveup_all(struct task_struct *tsk)
 #endif
 
 	msr_check_and_clear(msr_all_available);
+    flags &= ~msr_all_available;
 	hard_cond_local_irq_restore(flags);
 }
 EXPORT_SYMBOL(giveup_all);
@@ -563,6 +586,7 @@ void restore_math(struct pt_regs *regs)
 	}
 
 	msr_check_and_clear(msr_all_available);
+    flags &= ~msr_all_available;
 	hard_cond_local_irq_restore(flags);
 
 	regs->msr = msr;
@@ -1225,6 +1249,8 @@ struct task_struct *__switch_to(struct task_struct 
*prev,
 
 	/* Save FPU, Altivec, VSX and SPE state */
 	giveup_all(prev);
+    /* giveup_all clears msr_all_available bits unconditionally */
+	flags &= ~msr_all_available;
 
 	__switch_to_tm(prev, new);
 





^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Xenomai]  Unrecoverable FP Unavailable Exception 801
  2018-04-25  8:54                 ` Jouko Haapaluoma
  2018-04-25 10:03                   ` Sagi Maimon
@ 2018-04-25 16:49                   ` Philippe Gerum
  2018-04-24 18:54                     ` Steven Seeger
  2018-04-30  3:21                     ` Steven Seeger
  1 sibling, 2 replies; 20+ messages in thread
From: Philippe Gerum @ 2018-04-25 16:49 UTC (permalink / raw)
  To: Jouko Haapaluoma, Sagi Maimon, xenomai
  Cc: Adnan Ali, Sakari Junnila, Seeger,
	Steven D. (GSFC-444.0)[Embedded Flight Systems, Inc]

On 04/25/2018 10:54 AM, Jouko Haapaluoma wrote:
> On Mon, Apr 02, 2018 at 12:56:39PM +0000, Sagi Maimon wrote:
>> Hi all,
>> I am working with: Powerpc e300 SOC.
>> I am using: xenomai-2.6.4 version
>>
>> I am experiencing this exception on my Linux :
>> Unrecoverable FP Unavailable Exception 801 at c0003858
>> Oops: Unrecoverable FP Unavailable Exception, sig: 6 [#1]
>>
>> This happens during "alignment exception" (600)
> 
> Hello
> 
> We have also seen this issue recently with Xenomai 2.6.4 and i-pipe 3.1.10-powerpc-2.13-06.
> 
> We have been investigating this and Adnan found that the issue seems to be in arch/powerpc/kernel/process.c: enable_kernel_fp().
> 
> In this function the irqs are disabled and enabled by calling local_irq_save_hw_cond() and local_irq_restore_hw_cond(). In between the FP bit is enabled and written to MSR in giveup_fpu(). However, the local_irq_restore_hw_cond() restores the previous MSR which does not have the FP bit enabled and this leads to the exception 801.
> 
> We have briefly tested that the exception 801 does not occur with the following patch:
> 
> --- a/arch/powerpc/kernel/process.c	2018-04-24 15:54:10.164558970 +0300
> +++ b/arch/powerpc/kernel/process_new.c	2018-04-24 15:53:30.635567659 +0300
> @@ -114,6 +114,11 @@ void enable_kernel_fp(void)
>  #else
>  	giveup_fpu(last_task_used_math);
>  #endif /* CONFIG_SMP */
> +	/*
> +	 * giveup_fpu sets the FP bit in MSR, toggling it off would cause
> +	 * unavailable FP kernel panic. So, keep it on if it was set.
> +	 */
> +	flags |= (mfmsr() & MSR_FP);
>  	local_irq_restore_hw_cond(flags);
>  }
>  EXPORT_SYMBOL(enable_kernel_fp);
> 
> It seems that the implementation is quite similar also in the current I-pipe branch ipipe-4.9.y (only the FP bit is set by msr_check_and_set() and not in giveup_fpu). Therefore the problem seems to exist also in the latest i-pipe.
> 
> Is our fix correct or have we missed something?
> 

The fix makes a lot of sense, thanks. This bug slipped under the radar
for years likely because enabling the ppc fpu in kernel context mainly
happens when fixing up alignment issues, which rt apps tend to avoid in
the first place for performance reason by only using aligned memory
accesses (synchronous exceptions are not that cheap latency-wise).

Regarding the ipipe-4.9.y series, there are several other spots touching
the msr in this file which may be affected the same way (vsx, altivec,
spe, anything that involves calling msr_check_and_set/clear_msr() under
hard masking basically).

Adding a dedicated irq_restore helper which does not touch any other bit
aside of MSR_EE would make sense there. The BOOK-E version of
irq_save/restore specifically uses the wrtee* instructions not to touch
those bits, so we may assume this would be semantically correct to do
the same for BOOK3-S.

PS: CCing Steven who took over the maintenance of the ppc pipeline from
kernel 4.14 and on.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-25  8:54                 ` Jouko Haapaluoma
@ 2018-04-25 10:03                   ` Sagi Maimon
  2018-04-25 16:49                   ` Philippe Gerum
  1 sibling, 0 replies; 20+ messages in thread
From: Sagi Maimon @ 2018-04-25 10:03 UTC (permalink / raw)
  To: Jouko Haapaluoma, xenomai,
	Philippe Gerum <rpm@xenomai.org> (rpm@xenomai.org)
  Cc: Adnan Ali, Sakari Junnila

Thanks a lot Jouko, I will try your fix.

-----Original Message-----
From: Jouko Haapaluoma [mailto:jouko.haapaluoma@wapice.com] 
Sent: Wednesday, April 25, 2018 11:55
To: Sagi Maimon <SMaimon@advaoptical.com>; xenomai@xenomai.org; Philippe Gerum <rpm@xenomai.org> (rpm@xenomai.org) <rpm@xenomai.org>
Cc: Adnan Ali <adnan.ali@wapice.com>; Sakari Junnila <sakari.junnila@wapice.com>
Subject: RE: [Xenomai] Unrecoverable FP Unavailable Exception 801

On Mon, Apr 02, 2018 at 12:56:39PM +0000, Sagi Maimon wrote:
> Hi all,
> I am working with: Powerpc e300 SOC.
> I am using: xenomai-2.6.4 version
> 
> I am experiencing this exception on my Linux :
> Unrecoverable FP Unavailable Exception 801 at c0003858
> Oops: Unrecoverable FP Unavailable Exception, sig: 6 [#1]
> 
> This happens during "alignment exception" (600)

Hello

We have also seen this issue recently with Xenomai 2.6.4 and i-pipe 3.1.10-powerpc-2.13-06.

We have been investigating this and Adnan found that the issue seems to be in arch/powerpc/kernel/process.c: enable_kernel_fp().

In this function the irqs are disabled and enabled by calling local_irq_save_hw_cond() and local_irq_restore_hw_cond(). In between the FP bit is enabled and written to MSR in giveup_fpu(). However, the local_irq_restore_hw_cond() restores the previous MSR which does not have the FP bit enabled and this leads to the exception 801.

We have briefly tested that the exception 801 does not occur with the following patch:

--- a/arch/powerpc/kernel/process.c	2018-04-24 15:54:10.164558970 +0300
+++ b/arch/powerpc/kernel/process_new.c	2018-04-24 15:53:30.635567659 +0300
@@ -114,6 +114,11 @@ void enable_kernel_fp(void)  #else
 	giveup_fpu(last_task_used_math);
 #endif /* CONFIG_SMP */
+	/*
+	 * giveup_fpu sets the FP bit in MSR, toggling it off would cause
+	 * unavailable FP kernel panic. So, keep it on if it was set.
+	 */
+	flags |= (mfmsr() & MSR_FP);
 	local_irq_restore_hw_cond(flags);
 }
 EXPORT_SYMBOL(enable_kernel_fp);

It seems that the implementation is quite similar also in the current I-pipe branch ipipe-4.9.y (only the FP bit is set by msr_check_and_set() and not in giveup_fpu). Therefore the problem seems to exist also in the latest i-pipe.

Is our fix correct or have we missed something?

BR,
Jouko Haapaluoma
Wapice Ltd
Finland


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-04 17:16               ` Steven Seeger
@ 2018-04-25  8:54                 ` Jouko Haapaluoma
  2018-04-25 10:03                   ` Sagi Maimon
  2018-04-25 16:49                   ` Philippe Gerum
  0 siblings, 2 replies; 20+ messages in thread
From: Jouko Haapaluoma @ 2018-04-25  8:54 UTC (permalink / raw)
  To: Sagi Maimon, xenomai,
	Philippe Gerum <rpm@xenomai.org> (rpm@xenomai.org)
  Cc: Adnan Ali, Sakari Junnila

On Mon, Apr 02, 2018 at 12:56:39PM +0000, Sagi Maimon wrote:
> Hi all,
> I am working with: Powerpc e300 SOC.
> I am using: xenomai-2.6.4 version
> 
> I am experiencing this exception on my Linux :
> Unrecoverable FP Unavailable Exception 801 at c0003858
> Oops: Unrecoverable FP Unavailable Exception, sig: 6 [#1]
> 
> This happens during "alignment exception" (600)

Hello

We have also seen this issue recently with Xenomai 2.6.4 and i-pipe 3.1.10-powerpc-2.13-06.

We have been investigating this and Adnan found that the issue seems to be in arch/powerpc/kernel/process.c: enable_kernel_fp().

In this function the irqs are disabled and enabled by calling local_irq_save_hw_cond() and local_irq_restore_hw_cond(). In between the FP bit is enabled and written to MSR in giveup_fpu(). However, the local_irq_restore_hw_cond() restores the previous MSR which does not have the FP bit enabled and this leads to the exception 801.

We have briefly tested that the exception 801 does not occur with the following patch:

--- a/arch/powerpc/kernel/process.c	2018-04-24 15:54:10.164558970 +0300
+++ b/arch/powerpc/kernel/process_new.c	2018-04-24 15:53:30.635567659 +0300
@@ -114,6 +114,11 @@ void enable_kernel_fp(void)
 #else
 	giveup_fpu(last_task_used_math);
 #endif /* CONFIG_SMP */
+	/*
+	 * giveup_fpu sets the FP bit in MSR, toggling it off would cause
+	 * unavailable FP kernel panic. So, keep it on if it was set.
+	 */
+	flags |= (mfmsr() & MSR_FP);
 	local_irq_restore_hw_cond(flags);
 }
 EXPORT_SYMBOL(enable_kernel_fp);

It seems that the implementation is quite similar also in the current I-pipe branch ipipe-4.9.y (only the FP bit is set by msr_check_and_set() and not in giveup_fpu). Therefore the problem seems to exist also in the latest i-pipe.

Is our fix correct or have we missed something?

BR,
Jouko Haapaluoma
Wapice Ltd
Finland


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-25 16:49                   ` Philippe Gerum
@ 2018-04-24 18:54                     ` Steven Seeger
  2018-04-30  3:21                     ` Steven Seeger
  1 sibling, 0 replies; 20+ messages in thread
From: Steven Seeger @ 2018-04-24 18:54 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: Adnan Ali, Sakari Junnila, xenomai

On Wednesday, April 25, 2018 12:49:53 PM EDT Philippe Gerum wrote:
> The fix makes a lot of sense, thanks. This bug slipped under the radar
> for years likely because enabling the ppc fpu in kernel context mainly
> happens when fixing up alignment issues, which rt apps tend to avoid in
> the first place for performance reason by only using aligned memory
> accesses (synchronous exceptions are not that cheap latency-wise).
> 
> Regarding the ipipe-4.9.y series, there are several other spots touching
> the msr in this file which may be affected the same way (vsx, altivec,
> spe, anything that involves calling msr_check_and_set/clear_msr() under
> hard masking basically).
> 
> Adding a dedicated irq_restore helper which does not touch any other bit
> aside of MSR_EE would make sense there. The BOOK-E version of
> irq_save/restore specifically uses the wrtee* instructions not to touch
> those bits, so we may assume this would be semantically correct to do
> the same for BOOK3-S.
> 
> PS: CCing Steven who took over the maintenance of the ppc pipeline from
> kernel 4.14 and on.

Hi guys. Thanks for pointing this out, Jouko. I've looked over this briefly 
and agree this is a pretty wide-spread problem. I will take a stab at it 
tomorrow.

Regards,
Steven





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-04 15:42             ` Sagi Maimon
@ 2018-04-04 17:16               ` Steven Seeger
  2018-04-25  8:54                 ` Jouko Haapaluoma
  0 siblings, 1 reply; 20+ messages in thread
From: Steven Seeger @ 2018-04-04 17:16 UTC (permalink / raw)
  To: Sagi Maimon; +Cc: xenomai

On Wednesday, April 4, 2018 11:42:08 AM EDT Sagi Maimon wrote:
> Thanks for your reply.
> You are right, but unfortunately in my ssytem it happens on the Linux side:
> The Linux kernel code that fixes the alignment during align exception (600)
> works most of the time, but sometimes during the alignment fix 
> "Unrecoverable FP Unavailable Exception" occurs. My suspicion is that the
> xenomai still holds the FPU, but I not familiar enough with the xenomi
> code.
> 
> Any how I still trying to make it occur on the xenomai side.

Narrow it down to a simple few lines that cause the error, and put it in a 
shadowed xenomai thread and see if the error still occurs. This will help 
eliminate the possibility of any xenomai/linux interaction. Of course, you can 
just put all your energy into testing with an upgraded kernel and xenomai, 
too.

Steven





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-04 15:25           ` Steven Seeger
@ 2018-04-04 15:42             ` Sagi Maimon
  2018-04-04 17:16               ` Steven Seeger
  0 siblings, 1 reply; 20+ messages in thread
From: Sagi Maimon @ 2018-04-04 15:42 UTC (permalink / raw)
  To: steven.seeger; +Cc: xenomai

Thanks for your reply.
You are right, but unfortunately in my ssytem it happens on the Linux side:
The Linux kernel code that fixes the alignment during align exception (600) works most of the time, but sometimes during the alignment fix  "Unrecoverable FP Unavailable Exception" occurs.
My suspicion is that the xenomai still holds the FPU, but I not familiar enough with the xenomi code.

Any how I still trying to make it occur on the xenomai side.

-----Original Message-----
From: Steven Seeger [mailto:steven.seeger@nasa.gov] 
Sent: Wednesday, April 04, 2018 18:25
To: Sagi Maimon <SMaimon@advaoptical.com>
Cc: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>; xenomai@xenomai.org
Subject: Re: [Xenomai] Unrecoverable FP Unavailable Exception 801

On Wednesday, April 4, 2018 8:57:31 AM EDT Sagi Maimon wrote:
> HI,
> I did it only from Linux side.
> I can try doing it from xenomai side too.
> Please explain how would it help to investigate the problem?
>

If the problem does not occur in a regular linux thread, but only occurs in a xenomai-scheduled thread, then it drastically narrows down where the problem might be. Plus, you get a further test if you upgrade yuor kernel and ipipe patch.

Steven





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-04 12:57         ` Sagi Maimon
  2018-04-04 14:45           ` Lennart Sorensen
@ 2018-04-04 15:25           ` Steven Seeger
  2018-04-04 15:42             ` Sagi Maimon
  1 sibling, 1 reply; 20+ messages in thread
From: Steven Seeger @ 2018-04-04 15:25 UTC (permalink / raw)
  To: Sagi Maimon; +Cc: xenomai

On Wednesday, April 4, 2018 8:57:31 AM EDT Sagi Maimon wrote:
> HI,
> I did it only from Linux side.
> I can try doing it from xenomai side too.
> Please explain how would it help to investigate the problem?
>

If the problem does not occur in a regular linux thread, but only occurs in a 
xenomai-scheduled thread, then it drastically narrows down where the problem 
might be. Plus, you get a further test if you upgrade yuor kernel and ipipe 
patch.

Steven





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-04 14:45           ` Lennart Sorensen
@ 2018-04-04 14:53             ` Sagi Maimon
  0 siblings, 0 replies; 20+ messages in thread
From: Sagi Maimon @ 2018-04-04 14:53 UTC (permalink / raw)
  To: Lennart Sorensen
  Cc: Seeger, Steven D. (GSFC-582.0)[Embedded Flight Systems, Inc], xenomai

It is powerpc e300c3 MPC8308.
You are correct the alignment fix is only on the Linux side, you can find it under arch/powerpc/kernel/align.c
The code that fixes the alignment during align exception (600) works most of the time, but sometimes during the alignment fix  "Unrecoverable FP Unavailable Exception" occurs.
My suspicion is that the xenomai still holds the FPU, but I not familiar enough with the xenomi code.
 

-----Original Message-----
From: Lennart Sorensen [mailto:lsorense@csclub.uwaterloo.ca] 
Sent: Wednesday, April 04, 2018 17:46
To: Sagi Maimon <SMaimon@advaoptical.com>
Cc: Seeger, Steven D. (GSFC-582.0)[Embedded Flight Systems, Inc] <steven.seeger@nasa.gov>; xenomai@xenomai.org
Subject: Re: [Xenomai] Unrecoverable FP Unavailable Exception 801

On Wed, Apr 04, 2018 at 12:57:31PM +0000, Sagi Maimon wrote:
> HI,
> I did it only from Linux side.
> I can try doing it from xenomai side too.
> Please explain how would it help to investigate the problem?

As far as I recall the kernel alignment fixup is only allowed from linux mode since it uses linux kernel code.  The realtime side as far as I recall can't use it.  So if my memory is correct, any code running in the xenomai realtime part must do everything right and not trigger those exceptions.

What CPU is this?  What does /proc/cpuinfo say it is?

--
Len Sorensen


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-04 12:57         ` Sagi Maimon
@ 2018-04-04 14:45           ` Lennart Sorensen
  2018-04-04 14:53             ` Sagi Maimon
  2018-04-04 15:25           ` Steven Seeger
  1 sibling, 1 reply; 20+ messages in thread
From: Lennart Sorensen @ 2018-04-04 14:45 UTC (permalink / raw)
  To: Sagi Maimon
  Cc: Seeger, Steven D. (GSFC-582.0)[Embedded Flight Systems, Inc], xenomai

On Wed, Apr 04, 2018 at 12:57:31PM +0000, Sagi Maimon wrote:
> HI,
> I did it only from Linux side.
> I can try doing it from xenomai side too.
> Please explain how would it help to investigate the problem?

As far as I recall the kernel alignment fixup is only allowed from linux
mode since it uses linux kernel code.  The realtime side as far as I
recall can't use it.  So if my memory is correct, any code running
in the xenomai realtime part must do everything right and not trigger
those exceptions.

What CPU is this?  What does /proc/cpuinfo say it is?

-- 
Len Sorensen


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-04 12:55       ` Seeger, Steven D. (GSFC-582.0)[Embedded Flight Systems, Inc]
@ 2018-04-04 12:57         ` Sagi Maimon
  2018-04-04 14:45           ` Lennart Sorensen
  2018-04-04 15:25           ` Steven Seeger
  0 siblings, 2 replies; 20+ messages in thread
From: Sagi Maimon @ 2018-04-04 12:57 UTC (permalink / raw)
  To: Seeger, Steven D. (GSFC-582.0)[Embedded Flight Systems, Inc],
	Lennart Sorensen
  Cc: xenomai

HI,
I did it only from Linux side.
I can try doing it from xenomai side too.
Please explain how would it help to investigate the problem?

Thanks,
Sagi

-----Original Message-----
From: Seeger, Steven D. (GSFC-582.0)[Embedded Flight Systems, Inc] [mailto:steven.seeger@nasa.gov] 
Sent: Wednesday, April 04, 2018 15:55
To: Sagi Maimon <SMaimon@advaoptical.com>; Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Cc: xenomai@xenomai.org
Subject: RE: [Xenomai] Unrecoverable FP Unavailable Exception 801

Can you trigger alignment exception both from a regular Linux user thread and a xenomai user thread? 
________________________________________
From: Sagi Maimon [SMaimon@advaoptical.com]
Sent: Wednesday, April 04, 2018 6:17 AM
To: Lennart Sorensen; Seeger, Steven D. (GSFC-582.0)[Embedded Flight Systems, Inc]
Cc: xenomai@xenomai.org
Subject: RE: [Xenomai] Unrecoverable FP Unavailable Exception 801

As far as I know The system doesn't use kernel threads that use the FPU (but it is a huge system, so I hard to be sure) What I know for sure, is that some processes on user space use double variables in user space.
I have also wrote some user space application that triggers the "Alignment Exception (600)", just for testing.


-----Original Message-----
From: Xenomai [mailto:xenomai-bounces@xenomai.org] On Behalf Of Lennart Sorensen
Sent: Tuesday, April 03, 2018 21:32
To: Steven Seeger <steven.seeger@nasa.gov>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] Unrecoverable FP Unavailable Exception 801

On Tue, Apr 03, 2018 at 09:57:52AM -0400, Steven Seeger wrote:
> I'm a little curious about the fact that the address this occurred at 
> is 0xc0003858, which suggests it's kernel code. As Philippe asked, 
> what version of the ipipe are you using? Also, what is your exact CPU?
> The e300c2 does not have an FPU, so this would be quite a configuration problem.

Did I miss e300c2 being mentioned?  If so, that would be a problem.

> Are you using any kernel threads that use the FPU?

I would hope not.  Doing that is painful.

--
Len Sorensen

_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-04 10:17     ` Sagi Maimon
@ 2018-04-04 12:55       ` Seeger, Steven D. (GSFC-582.0)[Embedded Flight Systems, Inc]
  2018-04-04 12:57         ` Sagi Maimon
  0 siblings, 1 reply; 20+ messages in thread
From: Seeger, Steven D. (GSFC-582.0)[Embedded Flight Systems, Inc] @ 2018-04-04 12:55 UTC (permalink / raw)
  To: Sagi Maimon, Lennart Sorensen; +Cc: xenomai

Can you trigger alignment exception both from a regular Linux user thread and a xenomai user thread? 
________________________________________
From: Sagi Maimon [SMaimon@advaoptical.com]
Sent: Wednesday, April 04, 2018 6:17 AM
To: Lennart Sorensen; Seeger, Steven D. (GSFC-582.0)[Embedded Flight Systems, Inc]
Cc: xenomai@xenomai.org
Subject: RE: [Xenomai] Unrecoverable FP Unavailable Exception 801

As far as I know The system doesn't use kernel threads that use the FPU (but it is a huge system, so I hard to be sure)
What I know for sure, is that some processes on user space use double variables in user space.
I have also wrote some user space application that triggers the "Alignment Exception (600)", just for testing.


-----Original Message-----
From: Xenomai [mailto:xenomai-bounces@xenomai.org] On Behalf Of Lennart Sorensen
Sent: Tuesday, April 03, 2018 21:32
To: Steven Seeger <steven.seeger@nasa.gov>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] Unrecoverable FP Unavailable Exception 801

On Tue, Apr 03, 2018 at 09:57:52AM -0400, Steven Seeger wrote:
> I'm a little curious about the fact that the address this occurred at
> is 0xc0003858, which suggests it's kernel code. As Philippe asked,
> what version of the ipipe are you using? Also, what is your exact CPU?
> The e300c2 does not have an FPU, so this would be quite a configuration problem.

Did I miss e300c2 being mentioned?  If so, that would be a problem.

> Are you using any kernel threads that use the FPU?

I would hope not.  Doing that is painful.

--
Len Sorensen

_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-03 18:31   ` Lennart Sorensen
  2018-04-03 18:34     ` Steven Seeger
@ 2018-04-04 10:17     ` Sagi Maimon
  2018-04-04 12:55       ` Seeger, Steven D. (GSFC-582.0)[Embedded Flight Systems, Inc]
  1 sibling, 1 reply; 20+ messages in thread
From: Sagi Maimon @ 2018-04-04 10:17 UTC (permalink / raw)
  To: Lennart Sorensen, Steven Seeger; +Cc: xenomai

As far as I know The system doesn't use kernel threads that use the FPU (but it is a huge system, so I hard to be sure)
What I know for sure, is that some processes on user space use double variables in user space.
I have also wrote some user space application that triggers the "Alignment Exception (600)", just for testing.
 

-----Original Message-----
From: Xenomai [mailto:xenomai-bounces@xenomai.org] On Behalf Of Lennart Sorensen
Sent: Tuesday, April 03, 2018 21:32
To: Steven Seeger <steven.seeger@nasa.gov>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] Unrecoverable FP Unavailable Exception 801

On Tue, Apr 03, 2018 at 09:57:52AM -0400, Steven Seeger wrote:
> I'm a little curious about the fact that the address this occurred at 
> is 0xc0003858, which suggests it's kernel code. As Philippe asked, 
> what version of the ipipe are you using? Also, what is your exact CPU? 
> The e300c2 does not have an FPU, so this would be quite a configuration problem.

Did I miss e300c2 being mentioned?  If so, that would be a problem.

> Are you using any kernel threads that use the FPU?

I would hope not.  Doing that is painful.

--
Len Sorensen

_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-03 18:34     ` Steven Seeger
@ 2018-04-04 10:10       ` Sagi Maimon
  0 siblings, 0 replies; 20+ messages in thread
From: Sagi Maimon @ 2018-04-04 10:10 UTC (permalink / raw)
  To: steven.seeger, Lennart Sorensen; +Cc: xenomai

Correct :-)


-----Original Message-----
From: Xenomai [mailto:xenomai-bounces@xenomai.org] On Behalf Of Steven Seeger
Sent: Tuesday, April 03, 2018 21:34
To: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] Unrecoverable FP Unavailable Exception 801

On Tuesday, April 3, 2018 2:31:38 PM EDT Lennart Sorensen wrote:
> On Tue, Apr 03, 2018 at 09:57:52AM -0400, Steven Seeger wrote:
> > I'm a little curious about the fact that the address this occurred 
> > at is 0xc0003858, which suggests it's kernel code. As Philippe 
> > asked, what version of the ipipe are you using? Also, what is your 
> > exact CPU? The
> > e300c2 does not have an FPU, so this would be quite a configuration 
> > problem.
> 
> Did I miss e300c2 being mentioned?  If so, that would be a problem.

He did not mention the e300c2 but I just wanted to clarify. From a private email, it sounds like Sagi is working on a legacy product from before his time at the company that has periodically had this problem and required their customers to reboot it.

This brings back many "fond" memories of Gilles helping me chase down a similar bug on the Geode about ten years ago.

Sagi is using some extremely old stuff, so if he has the capability to put a fix in and recompile he might as well update the kernel if possible.

Steven




_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-03 18:31   ` Lennart Sorensen
@ 2018-04-03 18:34     ` Steven Seeger
  2018-04-04 10:10       ` Sagi Maimon
  2018-04-04 10:17     ` Sagi Maimon
  1 sibling, 1 reply; 20+ messages in thread
From: Steven Seeger @ 2018-04-03 18:34 UTC (permalink / raw)
  To: Lennart Sorensen; +Cc: xenomai

On Tuesday, April 3, 2018 2:31:38 PM EDT Lennart Sorensen wrote:
> On Tue, Apr 03, 2018 at 09:57:52AM -0400, Steven Seeger wrote:
> > I'm a little curious about the fact that the address this occurred at is
> > 0xc0003858, which suggests it's kernel code. As Philippe asked, what
> > version of the ipipe are you using? Also, what is your exact CPU? The
> > e300c2 does not have an FPU, so this would be quite a configuration
> > problem.
> 
> Did I miss e300c2 being mentioned?  If so, that would be a problem.

He did not mention the e300c2 but I just wanted to clarify. From a private 
email, it sounds like Sagi is working on a legacy product from before his time 
at the company that has periodically had this problem and required their 
customers to reboot it.

This brings back many "fond" memories of Gilles helping me chase down a 
similar bug on the Geode about ten years ago.

Sagi is using some extremely old stuff, so if he has the capability to put a 
fix in and recompile he might as well update the kernel if possible.

Steven





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
  2018-04-03 13:57 ` Steven Seeger
@ 2018-04-03 18:31   ` Lennart Sorensen
  2018-04-03 18:34     ` Steven Seeger
  2018-04-04 10:17     ` Sagi Maimon
  0 siblings, 2 replies; 20+ messages in thread
From: Lennart Sorensen @ 2018-04-03 18:31 UTC (permalink / raw)
  To: Steven Seeger; +Cc: xenomai

On Tue, Apr 03, 2018 at 09:57:52AM -0400, Steven Seeger wrote:
> I'm a little curious about the fact that the address this occurred at is 
> 0xc0003858, which suggests it's kernel code. As Philippe asked, what version 
> of the ipipe are you using? Also, what is your exact CPU? The e300c2 does not 
> have an FPU, so this would be quite a configuration problem.

Did I miss e300c2 being mentioned?  If so, that would be a problem.

> Are you using any kernel threads that use the FPU?

I would hope not.  Doing that is painful.

-- 
Len Sorensen


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Xenomai] Unrecoverable FP Unavailable Exception 801
       [not found] <mailman.27.1522680894.4366.xenomai@xenomai.org>
@ 2018-04-03 13:57 ` Steven Seeger
  2018-04-03 18:31   ` Lennart Sorensen
  0 siblings, 1 reply; 20+ messages in thread
From: Steven Seeger @ 2018-04-03 13:57 UTC (permalink / raw)
  To: xenomai

On Monday, April 2, 2018 10:54:54 AM EDT Sagi Maimon <SMaimon@advaoptical.com> 
wrote:

> Hi all,
> I am working with: Powerpc e300 SOC.
> I am using: xenomai-2.6.4 version
> 
> I am experiencing this exception on my Linux :
> Unrecoverable FP Unavailable Exception 801 at c0003858
> Oops: Unrecoverable FP Unavailable Exception, sig: 6 [#1]
> 
> This happens during "alignment exception" (600)

I'm a little curious about the fact that the address this occurred at is 
0xc0003858, which suggests it's kernel code. As Philippe asked, what version 
of the ipipe are you using? Also, what is your exact CPU? The e300c2 does not 
have an FPU, so this would be quite a configuration problem.

Are you using any kernel threads that use the FPU?

Steven





^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2018-04-30  3:21 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-02 12:56 [Xenomai] Unrecoverable FP Unavailable Exception 801 Sagi Maimon
2018-04-02 14:19 ` Philippe Gerum
2018-04-02 15:23 ` Lennart Sorensen
     [not found] <mailman.27.1522680894.4366.xenomai@xenomai.org>
2018-04-03 13:57 ` Steven Seeger
2018-04-03 18:31   ` Lennart Sorensen
2018-04-03 18:34     ` Steven Seeger
2018-04-04 10:10       ` Sagi Maimon
2018-04-04 10:17     ` Sagi Maimon
2018-04-04 12:55       ` Seeger, Steven D. (GSFC-582.0)[Embedded Flight Systems, Inc]
2018-04-04 12:57         ` Sagi Maimon
2018-04-04 14:45           ` Lennart Sorensen
2018-04-04 14:53             ` Sagi Maimon
2018-04-04 15:25           ` Steven Seeger
2018-04-04 15:42             ` Sagi Maimon
2018-04-04 17:16               ` Steven Seeger
2018-04-25  8:54                 ` Jouko Haapaluoma
2018-04-25 10:03                   ` Sagi Maimon
2018-04-25 16:49                   ` Philippe Gerum
2018-04-24 18:54                     ` Steven Seeger
2018-04-30  3:21                     ` Steven Seeger

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.