Thanks a lot Jouko, I will try your fix.
-----Original Message-----
From: Jouko Haapaluoma [mailto:[email protected]]
Sent: Wednesday, April 25, 2018 11:55
To: Sagi Maimon <[email protected]>; [email protected]; Philippe Gerum
<[email protected]> ([email protected]) <[email protected]>
Cc: Adnan Ali <[email protected]>; Sakari Junnila <[email protected]>
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
_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai