Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 72311 - ati-drivers ebuild fglrx kernel module is compiled with SMP enabled on Linux 2.6 kernels with SMP disabled but APIC enabled.
Summary: ati-drivers ebuild fglrx kernel module is compiled with SMP enabled on Linux ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Luca Barbato
URL: http://rage3d.com/board/showthread.ph...
Whiteboard:
Keywords: Inclusion
Depends on:
Blocks:
 
Reported: 2004-11-23 21:19 UTC by Aric Cyr
Modified: 2006-06-23 08:37 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to correct make.sh so that it does not enable SMP on non-SMP systems (ati-drivers-3.14.6-nosmp.patch,418 bytes, patch)
2004-11-23 21:22 UTC, Aric Cyr
Details | Diff
Patch to correct __SMP__ in firegl_public.c with the respect to a kernel CONFIG_SMP (patch.ati-drivers-3.14.6.config-smp,376 bytes, patch)
2004-12-10 02:45 UTC, Vadym Karpenko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aric Cyr 2004-11-23 21:19:51 UTC
The make.sh script in the build_mod/ directory of the fglrx package assumes that if "fgrep -c smp /proc/kallsyms" has greater than 10 hits then the kernel is compiled for SMP.  However, with APIC enabled in a 2.6 kernel, the actual number of SMP symbols is between 15 and 20 even with SMP disabled.  This causes the module to get compiled with SMP enabled, and causes problems with visual artifacts (such as in SPECviewperf as described in the forum link above).  This could be the cause of various lock-ups people are having as well.

Reproducible: Always
Steps to Reproduce:
1. ebuild ati-drivers-3.14.6.ebuild compile
2. in the work directory, view the make.log file that make.sh generates


Actual Results:  
notice that SMP=1 even if SMP is disabled in the kernel (but APIC is enabled).

Expected Results:  
SMP should be off (SMP=0 in make.log file) if the kernel does not truly have SMP
enabled.  That is CONFIG_SMP=y in /usr/src/linux/.config.
Comment 1 Aric Cyr 2004-11-23 21:22:52 UTC
Created attachment 44618 [details, diff]
Patch to correct make.sh so that it does not enable SMP on non-SMP systems

This is a simple patch to change the number of "smp" matches needed to enable
SMP in the fglrx module from 10 to 20.	This should be enough for all current
kernels.  Systems with SMP enabled should have more than 40 smp symbols in
/proc/kallsyms.  Also since this patch only touches the /proc/kallsyms logic,
it is safe for 2.4 kernels since they do not have the /proc/kallsyms file.
Comment 2 Luca Barbato gentoo-dev 2004-11-25 03:21:39 UTC
The ebuild should use directly the 2.6 makefile and not use the bash script.
How's possible you get make.sh called?
Comment 3 Aric Cyr 2004-11-25 17:03:34 UTC
My mistake... I read the if "[ ${KV} != ${KV/2\.6} ]" comparison the wrong way, so I thought that make.sh would be run for 2.6 kernels.

However, now this makes me wonder if __SMP__ is defined correctly for SMP machines.  It seems that __SMP__ is never defined or used when building a 2.6 kernel (even if using the make.sh script).... is this an ATI script bug, or should it really not be ever defined for 2.6 kernels?
Comment 4 Vadym Karpenko 2004-12-10 02:45:47 UTC
Created attachment 45668 [details, diff]
Patch to correct __SMP__ in firegl_public.c with the respect to a kernel CONFIG_SMP
Comment 5 Vadym Karpenko 2004-12-10 02:46:25 UTC
I installed ati-drivers 3.14.6 on 2.6 smp kernel and then saw
the /var/log/XFree86.0.log

(II) fglrx(0): Kernel Module Build Time Information:
(II) fglrx(0):     Build-Kernel UTS_RELEASE:        2.6.9-gentoo-r9-smp
(II) fglrx(0):     Build-Kernel MODVERSIONS:        no
(II) fglrx(0):     Build-Kernel __SMP__:            no
(II) fglrx(0):     Build-Kernel PAGE_SIZE:          0x1000

__SMP__ option was wrong, even if /usr/src/linux/.config had a CONFIG_SMP=y.
OpenGL test application glxgears didn't work longer ther 10-15 seconds.
I changed file /var/tmp/portage/ati-drivers-3.14.6/work/lib/modules/fglrx/build_mod/firegl_public.c
to check CONFIG_SMP kernel define and then define the __SMP__ properly.
Patch is attached.
Comment 6 Aric Cyr 2004-12-10 08:41:27 UTC
Maybe this patch should also #undef __SMP__ in an #else clause?  That way it will be defined (or undefined) correctly regardless of the script.
Comment 7 Luca Barbato gentoo-dev 2005-02-05 06:09:12 UTC
is the issue still valid?
Comment 8 Karl Tomlinson 2005-02-14 18:14:46 UTC
ati-drivers-8.8.25-r3 also does not set __SMP__ on smp 2.6 kernels.
Vadym's patch corrects this.

(Also, is ati-drivers-8.8.25-r3 installs glxATI.h into /usr/include/include/GL - I think this should be /usr/include/GL)
Comment 9 Luca Barbato gentoo-dev 2005-04-28 07:56:26 UTC
fixed in the latest ebuild
Comment 10 Pat Double 2006-06-19 05:52:16 UTC
I hope adding to this bug is OK even though its old, but...

I am having this problem on an SMP kernel with x11-drivers/ati-drivers-8.25.18. 
In Xorg.0.log I get:
(II) fglrx(0): Kernel Module Version Information:
(II) fglrx(0):     Name: fglrx
(II) fglrx(0):     Version: 8.25.18
(II) fglrx(0):     Date: May 18 2006
(II) fglrx(0):     Desc: ATI FireGL DRM kernel module
(II) fglrx(0): Kernel Module version matches driver.
(II) fglrx(0): Kernel Module Build Time Information:
(II) fglrx(0):     Build-Kernel UTS_RELEASE:        2.6.16-suspend2-r6
(II) fglrx(0):     Build-Kernel MODVERSIONS:        no
(II) fglrx(0):     Build-Kernel __SMP__:            no
(II) fglrx(0):     Build-Kernel PAGE_SIZE:          0x1000

If I use the make.sh from ATI I get:

(II) fglrx(0): Kernel Module Version Information:
(II) fglrx(0):     Name: fglrx
(II) fglrx(0):     Version: 8.25.18
(II) fglrx(0):     Date: May 18 2006
(II) fglrx(0):     Desc: ATI FireGL DRM kernel module
(II) fglrx(0): Kernel Module version matches driver.
(II) fglrx(0): Kernel Module Build Time Information:
(II) fglrx(0):     Build-Kernel UTS_RELEASE:        2.6.16-suspend2-r6
(II) fglrx(0):     Build-Kernel MODVERSIONS:        yes
(II) fglrx(0):     Build-Kernel __SMP__:            yes
(II) fglrx(0):     Build-Kernel PAGE_SIZE:          0x1000

Notice MODVERSIONS and __SMP__ are both "yes" in the later case, matching my kernel. This is causing problems. Using suspend2 I have very few problems when __SMP__ is "yes", I have got up to 14 cycles. With __SMP__ "no" 3 is doing good before it crashes on the atomic copy. I am not sure of possible other problems related to this.

If you want me to file a new bug I will.
Comment 11 Pat Double 2006-06-23 08:37:04 UTC
Submitted bug 137745 due to silence and age of this one :)