Results 1 to 10 of 21

Thread: Patch to compile fgrlx module on Linux 3.3.rc4 with x86 32 bit arch

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Posts
    10

    Default Patch to compile fgrlx module on Linux 3.3.rc4 with x86 32 bit arch

    Hi all,
    due to this commit:

    https://github.com/torvalds/linux/co...949a703977a7f3

    the fgrlx module fails to compile on kernel 3.3-rc4 with the 32-bit x86 architecture, with this error:

    Code:
    DKMS make.log for fglrx-8.930 for kernel 3.3.0-rc4-extra-drivers (i686)
    mar 21 feb 2012, 14.36.00, CET
    AMD kernel module generator version 2.1
    [: 393: 1: unexpected operator
    [: 399: 1: unexpected operator
    doing Makefile based build for kernel 2.6.x and higher
    rm -rf *.c *.h *.o *.ko *.a .??* *.symvers
    make -C /lib/modules/3.3.0-rc4-extra-drivers/build SUBDIRS=/var/lib/dkms/fglrx/8.930/build/2.6.x modules
    make[1]: ingresso nella directory "/home/jena/experimental-kernel/linux-3.3-rc4"
      CC [M]  /var/lib/dkms/fglrx/8.930/build/2.6.x/firegl_public.o
    In file included from /var/lib/dkms/fglrx/8.930/build/2.6.x/firegl_public.c:192:0:
    /var/lib/dkms/fglrx/8.930/build/2.6.x/kcl_debug.h:202:5: warning: "_DEBUG" is not defined [-Wundef]
    /var/lib/dkms/fglrx/8.930/build/2.6.x/firegl_public.c: In function ‘KCL_fpu_begin’:
    /var/lib/dkms/fglrx/8.930/build/2.6.x/firegl_public.c:5802:28: error: ‘TS_USEDFPU’ undeclared (first use in this function)
    /var/lib/dkms/fglrx/8.930/build/2.6.x/firegl_public.c:5802:28: note: each undeclared identifier is reported only once for each function it appears in
    /var/lib/dkms/fglrx/8.930/build/2.6.x/firegl_public.c: At top level:
    /var/lib/dkms/fglrx/8.930/build/2.6.x/kcl_debug.h:162:16: warning: ‘module_log_map’ defined but not used [-Wunused-variable]
    /var/lib/dkms/fglrx/8.930/build/2.6.x/kcl_debug.h:175:19: warning: ‘module_type_map’ defined but not used [-Wunused-variable]
    make[2]: *** [/var/lib/dkms/fglrx/8.930/build/2.6.x/firegl_public.o] Errore 1
    make[1]: *** [_module_/var/lib/dkms/fglrx/8.930/build/2.6.x] Errore 2
    make[1]: uscita dalla directory "/home/jena/experimental-kernel/linux-3.3-rc4"
    make: *** [kmod_build] Errore 2
    build failed with return value 2
    This patch fixes the problem:

    Code:
    fixed fgrlx compilation error on 32-bit x86 arch with kernel 3.3-rc4 due to commit:
    https://github.com/torvalds/linux/commit/f94edacf998516ac9d849f7bc6949a703977a7f3
    
    Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
    ---
     firegl_public.c |    9 +++++++++
     1 files changed, 9 insertions(+), 0 deletions(-)
    
    diff --git a/firegl_public.c b/firegl_public.c
    index 6e0aa82..5010b91 100644
    --- a/firegl_public.c
    +++ b/firegl_public.c
    @@ -5797,6 +5797,14 @@ void ATI_API_CALL KCL_fpu_begin(void)
     #ifdef CONFIG_X86_64
         kernel_fpu_begin();
     #else
    +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
    +    struct task_struct *tsk = current;
    +    preempt_disable();
    +    if (tsk->thread.has_fpu)
    +        __save_init_fpu(tsk);
    +    else
    +        clts();
    +#else
         struct thread_info *cur_task = current_thread_info();
         preempt_disable();
         if (cur_task->status & TS_USEDFPU)
    @@ -5804,6 +5812,7 @@ void ATI_API_CALL KCL_fpu_begin(void)
         else
             clts();
     #endif
    +#endif
     }
     
     /** \brief End of using FPU
    -- 
    1.7.5.4
    Regards,
    Gennar1

  2. #2
    Join Date
    Feb 2012
    Posts
    7

    Default

    Eh, sorry. I missed that. A geometric mean makes more sense, since we want to favour lower scores (lower scores tend to indicate some bottleneck, and us users notice the bottlenecks)

  3. #3
    Join Date
    Feb 2012
    Posts
    10

    Default

    There is a further change in kernel 3.3-rc5. Also, the changes have been backported to kernel 3.2.8:

    https://lwn.net/Articles/484042/

    So this new version of the patch applies to all kernels >= 3.2.8:

    Code:
    fixed fgrlx compilation error on 32-bit x86 arch with kernel 3.3-rc4 due to commit:
    https://github.com/torvalds/linux/commit/f94edacf998516ac9d849f7bc6949a703977a7f3
    later modified (in 3.3-rc5) by commit:
    https://github.com/torvalds/linux/commit/7e16838d94b566a17b65231073d179bc04d590c8#diff-1
    and finally backported to kernel 3.2.8.
    
    Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
    ---
     firegl_public.c |    6 ++++++
     1 files changed, 6 insertions(+), 0 deletions(-)
    
    diff --git a/firegl_public.c b/firegl_public.c
    index 6e0aa82..cb9e217 100644
    --- a/firegl_public.c
    +++ b/firegl_public.c
    @@ -5797,10 +5797,16 @@ void ATI_API_CALL KCL_fpu_begin(void)
     #ifdef CONFIG_X86_64
         kernel_fpu_begin();
     #else
    +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,8)
    +    preempt_disable();
    +    if (__thread_has_fpu(current))
    +        __save_init_fpu(current);
    +#else
         struct thread_info *cur_task = current_thread_info();
         preempt_disable();
         if (cur_task->status & TS_USEDFPU)
             __save_init_fpu(cur_task->task);
    +#endif
         else
             clts();
     #endif
    -- 
    1.7.5.4

  4. #4
    Join Date
    Aug 2007
    Posts
    6,674

    Default

    Interesting patch, but how do you hande distro kernels which still report 3.2.0?

  5. #5
    Join Date
    Feb 2012
    Posts
    10

    Default

    Nice question.

    Maybe a smarter solution would be to check if TS_USEDFPU is defined or not, instead of looking at the kernel version.

    I mean something like this (beware that this patch is not tested!):

    Code:
    fixed fgrlx compilation error on 32-bit x86 arch with kernel 3.3-rc4 due to commit:
    https://github.com/torvalds/linux/commit/f94edacf998516ac9d849f7bc6949a703977a7f3
    later modified (in 3.3-rc5) by commit:
    https://github.com/torvalds/linux/commit/7e16838d94b566a17b65231073d179bc04d590c8#diff-1
    and finally backported to kernel 3.2.8.
    
    Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
    ---
     firegl_public.c |    6 ++++++
     1 files changed, 6 insertions(+), 0 deletions(-)
    
    diff --git a/firegl_public.c b/firegl_public.c
    index 6e0aa82..cb9e217 100644
    --- a/firegl_public.c
    +++ b/firegl_public.c
    @@ -5797,10 +5797,16 @@ void ATI_API_CALL KCL_fpu_begin(void)
     #ifdef CONFIG_X86_64
         kernel_fpu_begin();
     #else
    +#ifndef TS_USEDFPU
    +    preempt_disable();
    +    if (__thread_has_fpu(current))
    +        __save_init_fpu(current);
    +#else
         struct thread_info *cur_task = current_thread_info();
         preempt_disable();
         if (cur_task->status & TS_USEDFPU)
             __save_init_fpu(cur_task->task);
    +#endif
         else
             clts();
     #endif
    -- 
    1.7.5.4

  6. #6

    Default

    Sorry but how exactly do I use this patch?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •