Page 1 of 3 123 LastLast
Results 1 to 10 of 21

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

  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,673

    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?

  7. #7
    Join Date
    Feb 2012
    Posts
    10

    Default

    The patch must be applied to the file firegl_public.c .
    On my Ubuntu 11.10 system, it is installed in /usr/src/fglrx-8.950 (the patch was originally developed on fglrx-8.930 but is still required on the new fglrx-8.950).

    Select all the patch text and copy/paste it into a new text file (you can use the third version of the patch, it works well on all kernel versions). Save it on your home directory and name it, for example, fglrx.patch .
    Then you have to run something like this:

    Code:
    cd /usr/src/fglrx-8.950
    sudo patch -p1 < ~/fglrx.patch
    Now you can install the new kernel. On Ubuntu, you can use .deb packages to install new kernels, and the fglrx module is built automatically by the install script.

    The patch is required to build the fgrlx module against all 3.2 kernels >= 3.2.8 and all 3.3 kernels >= 3.3-rc4 with the x86 32 bit architecture. The 64 bit kernels are not affected by the problem.
    Last edited by Gennar1; 03-10-2012 at 09:43 PM.

  8. #8

    Default

    Thanks, that worked.

  9. #9
    Join Date
    Mar 2012
    Posts
    1

    Default

    Hello, I have a x64 and can't compile

    uname -r: 3.2.10-1.fc16.x86_64 (I try with others kernels and the same result):


    Code:
    Detected configuration:
    Architecture: x86_64 (64-bit)
    X Server: X.Org 6.9 or later 64-bit
    loki_setup: directory: (null)
    DKMS part of installation failed.  Please refer to /usr/share/ati/fglrx-install.log for details
    Removing temporary directory: fglrx-install.S5pNDk
    [drekion@drekion-laptop Descargas]$ cat /usr/share/ati/fglrx-install.log Detected a previous installation, /usr/share/ati/amd-uninstall.sh
    Dryrun uninstall succeeded continuing with installation.
    Uninstalling any previously installed drivers.
    Forcing uninstall of AMD Catalyst(TM) Proprietary Driver.
    No integrity verification is done.
    restore of system environment completed
    Errors during DKMS module removal
    Uninstall fglrx driver complete.
    For detailed log of uninstall, please see /etc/ati/fglrx-uninstall.log
    System must be rebooted to avoid system instability and potential data loss.
    /usr/share/ati/amd-uninstall.sh completed with 0
    
    Creating symlink /var/lib/dkms/fglrx/8.95/source ->
                     /usr/src/fglrx-8.95
    
    DKMS: add completed.
    
    Kernel preparation unnecessary for this kernel.  Skipping...
    
    Building module:
    cleaning build area....
    cd /var/lib/dkms/fglrx/8.95/build; sh make.sh --nohints --uname_r=3.2.10-1.fc16.x86_64 --norootcheck....(bad exit status: 1)
    [Error] Kernel Module : Failed to build fglrx-8.95 with DKMS
    [Error] Kernel Module : Removing fglrx-8.95 from DKMS
    
    ------------------------------
    Deleting module version: 8.95
    completely from the DKMS tree.
    ------------------------------
    Done.
    [Reboot] Kernel Module : dracut
    can help me?

  10. #10
    Join Date
    Feb 2012
    Posts
    10

    Default

    Quote Originally Posted by dreKion View Post
    Hello, I have a x64 and can't compile
    uname -r: 3.2.10-1.fc16.x86_64 (I try with others kernels and the same result):
    can help me?
    Sorry, I can't. For sure it's not related to the problem discussed in this topic, as 64 bit systems are not affected. Also, I compiled the latest fglrx against 3.2.10 without problems. Probably you have a new version of Xorg that is not supported yet by the fgrlx module. Look into /usr/share/ati/fglrx-install.log for details about your problem.

Posting Permissions

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