Hi there!
I'm with a problem using LTIB 20080811, kernel 2.6.25 with compiler 4.2-125. I wrote a program that make simple calculations.
The source code follows below:
#include <stdio.h>
#include <math.h>
static float misc_calculations();
int main(int argc, const char * argv[])
{
float reference = misc_calculations();
printf("Reference: %f\n", reference);
while (1)
{
float value = misc_calculations();
if (value != reference)
printf("Value: %f\n", value);
}
}
static float misc_calculations()
{
const float float_a = .2;
const float float_b = .152;
float result = 0.0;
result = float_a – float_b;
return result;
}
When I execute two instances, the behavior is very strange.
Result:
Value: 2.411886
Value: 156705821244071112293643497228883460096.000000
Value: 15.301361
Value: -174085336471250674867240960.000000
Value: 1.250146
Value: 2.771876
Value: -2.302972
Value: 2.567792
Value: -0.519974
Value: -1.523481
Value: 0.132017
Value: 0.572767
Value: -0.011594
Value: 2.511886
Value: -1.523481
Value: 7.476519
Value: -174085336471250674867240960.000000
Value: 557824153357922598912.000000
Value: 156705821244071112293643497228883460096.000000
Value: 1.511886
Value: -2.579387
Value: 0.998819
This problem occurs when I run two process. Only one process, it's executed OK, but when you execute a top program, the errors also appear.
In kernel, I checked the definition CONFIG_FPU. I created the definition, but the result is still the same. For me, the problem is concurrency between process and the kernel is not saving the context.
I used another options as -msoft-float, -mcfv4e and -mcpu=5485.
Anyone ever had this problem?
Regards,
Leandro dos Santos
解決済! 解決策の投稿を見る。
Hi kwong!
Check the new version of LTIB (2010). In this distribution (kernel 2.6.29) this problem is solved.
I merged the kernel 2.6.29 and solved the problem in the kernel 2.6.25. If you want, I can send my patch.
Regards,
Leandro
Hi, I think I've just run into the same problem. I'm using the a slightly modified 2.6.25 kernel from Freescale on a mcf5472 processor. If I load down the processor with other tasks, my application that performs the floating point math returns inconsistent results. If I trim down the number of processes to the bare minimum, my application starts running more reliably.
I looked inside the source code for the kernel, and it looks like the "resume" block within the arch/m68k/coldfire/entry.S file is missing all of the floating point context switching code that existed in the 2.6.10 kernel.
I'm going to try re-adding that code today to see if it makes a difference. Can anyone else provide any feedback about this in the meantime?
Thanks
Hi kwong!
Check the new version of LTIB (2010). In this distribution (kernel 2.6.29) this problem is solved.
I merged the kernel 2.6.29 and solved the problem in the kernel 2.6.25. If you want, I can send my patch.
Regards,
Leandro