Hello,

The patch would not apply cleanly(rejected Hunk) against 2.4.5
w/linux2.6.26.3 or svn 4368 w/linux2.6.26.7.

I edited pod_32.h to try and incorporate the changes listed in the patch.

Building with both Xenomai/Linux combinations gives the following errors.
include/asm/xenomai/bits/pod_32.h: In function 'xnarch_init_fpu':
include/asm/xenomai/bits/pod_32.h:220: error: 'x86_fpu_state' undeclared
(first use in this function)
include/asm/xenomai/bits/pod_32.h:220: error: (Each undeclared identifier is
reported only once
include/asm/xenomai/bits/pod_32.h:220: error: for each function it appears
in.)
include/asm/xenomai/bits/pod_32.h:220: error: 'fpup' undeclared (first use
in this function)
include/asm/xenomai/bits/pod_32.h:229: error: dereferencing pointer to
incomplete type
include/asm/xenomai/bits/pod_32.h:229: error: dereferencing pointer to
incomplete type
include/asm/xenomai/bits/pod_32.h:229: error: dereferencing pointer to
incomplete type
include/asm/xenomai/bits/pod_32.h:229: error: dereferencing pointer to
incomplete type
include/asm/xenomai/bits/pod_32.h:229: error: dereferencing pointer to
incomplete type
include/asm/xenomai/bits/pod_32.h:229: error: dereferencing pointer to
incomplete type
include/asm/xenomai/bits/pod_32.h:230: error: dereferencing pointer to
incomplete type
include/asm/xenomai/bits/pod_32.h:233: error: dereferencing pointer to
incomplete type
include/asm/xenomai/bits/pod_32.h:238: error: dereferencing pointer to
incomplete type
include/asm/xenomai/bits/pod_32.h:238: error: memory input 0 is not directly
addressable


My init_fpu function looks like this, which I believe corresponds to your
patch.

       struct task_struct *task = tcb->user_task;
       x86_fpu_state *fpup = tcb->fpup;

       /* Initialize the FPU for a task. This must be run on behalf of the
       task. */

       if (cpu_has_fxsr) {
               struct i837_fxsave_struct *fx = &fpup->fxsave;

               memset(fx, 0, sizeof(*fx));
               fx->cwd = 0x37f;
               if (cpu_has_xmm) {
                       unsigned long __mxcsr = 0x1f80UL & 0xffbfUL;
                       fx->mxcsr = __mxcsr;
               }

               clts();

               __asm__ __volatile__("fxrstor %0": /* no output */
:"m"(*fx));
       } else {
               struct i387_fsave_struct *fp = &fpup->fsave;

               memset(fp, 0, sizeof(*fp));
               fp->cwd = 0xffff037fu;
               fp->swd = 0xffff0000u;
               fp->twd = 0xffffffffu;
               fp->fos = 0xffff0000u;

               clts();

               __asm__ __volatile__("frstor %0": /* no output */ :"m"(*fp));
       }
        if (task) {
        /* Real-time shadow FPU initialization: tell Linux that this
           thread initialized its FPU hardware. The fpu usage bit is
           necessary for xnarch_save_fpu to save the FPU state at next
           switch. */
        xnarch_set_fpu_init(task);
        wrap_set_fpu_used(task);
    }

Please let me know, if I did anything incorrectly, or if the patch was not
completely posted.


Thanks for your work,

Mark


On Sat, Nov 8, 2008 at 8:56 AM, Gilles Chanteperdrix <
[EMAIL PROTECTED]> wrote:

> Gilles Chanteperdrix wrote:
> > Mark Saiia wrote:
> >> Hello,
> >>
> >> The switchtest output is as follows.  This was run on 2.4.5 with
> 2.6.26.3
> >> AMD Geode LX800 board.
> >> In order to get it to run, I had to remove modprobe xeno_native from my
> >> start-up script.  I don't know if that is an expected requirement prior
> to
> >> running the test.
> >>
> >> == Testing FPU check routines...
> >> r0: 1 != 2
> >> r1: 1 != 2
> >> r2: 1 != 2
> >> r3: 1 != 2
> >> r4: 1 != 2
> >> r5: 1 != 2
> >> r6: 1 != 2
> >> r7: 1 != 2
> >> == FPU check routines: OK.
> >> == Threads: sleeper_ufps-0 rtk-1 rtk-2 rtk_fp-3 rtk_fp-4 rtk_fp_ufpp-5
> >> rtk_fp_ufpp-6 rtup-7 rtup-8 rtup_ufpp-9 rtup_ufpp-10 rtus-11 rtus-12
> >> rtus_ufps-13 rtus_ufps-14 rtuo-15 rtuo-16 rtuo_ufpp-17 rtuo_ufpp-18
> >> rtuo_ufps-19 rtuo_ufps-20 rtuo_ufpp_ufps-21 rtuo_ufpp_ufps-22
> >> RTT|  00:00:01
> >> RTH|ctx switches|-------total
> >> RTD|       17250|       17250
> >> RTD|       17250|       34500
> >> RTD|       17250|       51750
> >> RTD|       17250|       69000
> >> RTD|       17273|       86273
> >> RTD|       17273|      103546
> >> RTD|       17273|      120819
> >> RTD|       17250|      138069
> >> RTD|       17250|      155319
> >> RTD|       17273|      172592
> >> RTD|       17250|      189842
> >> RTD|       17250|      207092
> >> RTD|       17273|      224365
> >> RTD|       17273|      241638
> >> RTD|       17273|      258911
> >> RTD|       17250|      276161
> >> RTD|       17250|      293411
> >> RTD|       17250|      310661
> >> RTD|       17273|      327934
> >> RTD|       17273|      345207
> >> RTD|       17250|      362457
> >>
> >> Thanks in advance for any help.
> >>
> >> Mark Saiia
> >
> >
> > Hi,
> >
> > It seems you do not get the same error with switchtest as you get with
> > your test program. I had a look at linux fpu handling, and it seems to
> > be very different from Xenomai fpu handling. I need to dig a little bit
> > more, but will send you a patch soon.
>
> Here comes the promised patch.
>
> Index: include/asm-x86/bits/pod_32.h
> ===================================================================
> --- include/asm-x86/bits/pod_32.h       (revision 4355)
> +++ include/asm-x86/bits/pod_32.h       (working copy)
> @@ -194,16 +194,37 @@ static inline void xnarch_init_thread(xn
>  static inline void xnarch_init_fpu(xnarchtcb_t * tcb)
>  {
>        struct task_struct *task = tcb->user_task;
> +       x86_fpu_state *fpup = tcb->fpup;
>        /* Initialize the FPU for a task. This must be run on behalf of the
>           task. */
>
> -       __asm__ __volatile__("clts; fninit");
> +       if (cpu_has_fxsr) {
> +               struct i837_fxsave_struct *fx = &fpup->fxsave;
>
> -       if (cpu_has_xmm) {
> -               unsigned long __mxcsr = 0x1f80UL & 0xffbfUL;
> -               __asm__ __volatile__("ldmxcsr %0"::"m"(__mxcsr));
> -       }
> +               memset(fx, 0, sizeof(*fx));
> +               fx->cwd = 0x37f;
> +               if (cpu_has_xmm) {
> +                       unsigned long __mxcsr = 0x1f80UL & 0xffbfUL;
> +                       fx->mxcsr = __mxcsr;
> +               }
> +
> +               clts();
> +
> +               __asm__ __volatile__("fxrstor %0": /* no output */
> :"m"(*fx));
> +       } else {
> +               struct i387_fsave_struct *fp = &fpup->fsave;
> +
> +               memset(fp, 0, sizeof(*fp));
> +               fp->cwd = 0xffff037fu;
> +               fp->swd = 0xffff0000u;
> +               fp->twd = 0xffffffffu;
> +               fp->fos = 0xffff0000u;
> +
> +               clts();
>
> +               __asm__ __volatile__("frstor %0": /* no output */
> :"m"(*fp));
> +       }
> +
>        if (task) {
>                /* Real-time shadow FPU initialization: tell Linux that this
>                   thread initialized its FPU hardware. The fpu usage bit is
>
>
>
> --
>                                             Gilles.
>
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to