Fix for linux-3.x support in phc-k8

Discuss about PHC here. For problems please use the PHC Help forum
User avatar
DavidG
Posts: 179
Joined: Fri 18. Jul 2008, 11:25
Contact:

Fix for linux-3.x support in phc-k8

Post by DavidG » Sun 7. Aug 2011, 16:56

Unfortunately the latest phc-k8 driver does not contain the fix I made to enable linux-3.x support. The driver itself should compile fine, however there is a line in the phc-k8 Makefile that issues an error as soon as the kernel is not a 2.6.x one... This is completely bogus, so the next lines can be removed safely from Makefile:

Code: Select all

ifneq ($(KERNELMAJOR), 2.6)
$(error Only support for 2.6 series kernels)
endif

A bank is a place where they lend you an umbrella in fair weather and ask for it back when it begins to rain -- R. Frost

Gele
Posts: 6
Joined: Sun 18. Jul 2010, 08:45

Re: Fix for linux-3.x support in phc-k8

Post by Gele » Sat 15. Sep 2012, 18:05

ThanX :-) It now works on kernel 3.2
one strange for me is that sudo make help gives an error:
/bin/sh: 1: Syntax error: "(" unexpected

User avatar
DavidG
Posts: 179
Joined: Fri 18. Jul 2008, 11:25
Contact:

Re: Fix for linux-3.x support in phc-k8

Post by DavidG » Tue 18. Sep 2012, 09:03

Gele wrote:ThanX :-) It now works on kernel 3.2
one strange for me is that sudo make help gives an error:
/bin/sh: 1: Syntax error: "(" unexpected
Thanks for noticing... :oops: Apparently this:

Code: Select all

        @echo -e all\\t\\t- (default target) build the kernel module
Should be:

Code: Select all

        @echo -e all\\t\\t- \(default target\) build the kernel module
A bank is a place where they lend you an umbrella in fair weather and ask for it back when it begins to rain -- R. Frost

User avatar
DavidG
Posts: 179
Joined: Fri 18. Jul 2008, 11:25
Contact:

Re: Fix for linux-3.x support in phc-k8

Post by DavidG » Wed 7. Nov 2012, 13:00

I finally had time to update the phc-k8 driver, there's a new beta driver that fixes these problems once and for all. I intend to release as soon as it has had some proper testing on AMD K8 and K10 architectures...

It is located here: viewtopic.php?f=13&t=38
A bank is a place where they lend you an umbrella in fair weather and ask for it back when it begins to rain -- R. Frost

ryszardzonk
Posts: 19
Joined: Sat 2. Oct 2010, 14:27

Re: Fix for linux-3.x support in phc-k8

Post by ryszardzonk » Fri 30. Nov 2012, 18:16

I noticed an article on the H-Online about CPU changes in kernel 3.7 pointing to the below changes in the tree

http://git.kernel.org/?p=linux/kernel/g ... 4fe30f6c12
http://git.kernel.org/?p=linux/kernel/g ... 328bfb0a94
http://git.kernel.org/?p=linux/kernel/g ... 215685dfab


http://www.h-online.com/open/features/K ... 58293.html

Hopefully all those and probably few others on the way are not a problem for the PHC 0.4.5 to get out of beta ;)

PS I am using for almost a year now PHC 0.4.4 with following with no issues :)

echo "25 27 49" > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids
echo "25 27 49" > /sys/devices/system/cpu/cpu1/cpufreq/phc_vids

I used 26 28 50 previous to that but I got into few freezes, but above is rock solid on my box :)

processor : 1
vendor_id : AuthenticAMD
cpu family : 20
model : 1
model name : AMD E-350 Processor
stepping : 0
microcode : 0x5000028

ryszardzonk
Posts: 19
Joined: Sat 2. Oct 2010, 14:27

Re: Fix for linux-3.x support in phc-k8

Post by ryszardzonk » Fri 30. Nov 2012, 20:13

during building I get a warning. Is it harmfull in any way?

Code: Select all

make -C /lib/modules/3.7.0-rc5/build SUBDIRS=/usr/src/patches-kernel/phc-k8_v0.4.5b1 phc-k8.ko
make[1]: Wejście do katalogu `/usr/src/linux-3.7-rc5'
  CC [M]  /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.o
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c: In function ‘__check_direct_transitions’:
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:65:1: warning: return from incompatible pointer type [enabled by default]
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c: In function ‘__check_min_800MHz’:
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:68:1: warning: return from incompatible pointer type [enabled by default]
  MODPOST 1 modules
  CC      /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.mod.o
  LD [M]  /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.ko
during install with kernel 3.7.0-rc7 I get an error requiring me to delete original mperf.ko module build within kernel. Is it ok to replace it with build with PHC?

Code: Select all

make install
install -m 644 -o root -g root phc-k8.modprobe /etc/modprobe.d/phc-k8.conf
mkdir -p /lib/modules/3.7.0-rc7/updates/kernel/arch/x86/kernel/cpu/cpufreq/
install -m 644 -o root -g root phc-k8.ko mperf.ko /lib/modules/3.7.0-rc7/updates/kernel/arch/x86/kernel/cpu/cpufreq/
depmod 3.7.0-rc7 -a
depmod: ERROR: kmod_module 'mperf' already exists with different path: new-path='/lib/modules/3.7.0-rc7/updates/kernel/arch/x86/kernel/cpu/cpufreq/mperf.ko' old-path='/lib/modules/3.7.0-rc7/kernel/drivers/cpufreq/mperf.ko'
depmod: ERROR: could not create module /lib/modules/3.7.0-rc7/updates/kernel/arch/x86/kernel/cpu/cpufreq/mperf.ko: File exists
depmod: ERROR: failed /lib/modules/3.7.0-rc7/updates/kernel/arch/x86/kernel/cpu/cpufreq/mperf.ko: File exists

User avatar
DavidG
Posts: 179
Joined: Fri 18. Jul 2008, 11:25
Contact:

Re: Fix for linux-3.x support in phc-k8

Post by DavidG » Fri 30. Nov 2012, 22:55

ryszardzonk wrote:during building I get a warning. Is it harmfull in any way?
It is completely harmless. It's caused by a standard Linux kernel macro for module parameters, so it's a bit odd that the kernel complains about this nonetheless...
during install with kernel 3.7.0-rc7 I get an error requiring me to delete original mperf.ko module build within kernel. Is it ok to replace it with build with PHC?
That is probably on "old" mperf.ko from the previous phc-k8 driver, since it is already in updates/
You can safely remove it. You can also run "sudo make uninstall" before building/installing the new driver, to make sure it's gone....
A bank is a place where they lend you an umbrella in fair weather and ask for it back when it begins to rain -- R. Frost

ryszardzonk
Posts: 19
Joined: Sat 2. Oct 2010, 14:27

Re: Fix for linux-3.x support in phc-k8

Post by ryszardzonk » Mon 3. Dec 2012, 16:40

DavidG wrote:That is probably on "old" mperf.ko from the previous phc-k8 driver, since it is already in updates/
You can safely remove it. You can also run "sudo make uninstall" before building/installing the new driver, to make sure it's gone....
well do not think it is related to the previous version of phc-k8. same think happens on the fresh install of completly new tree in /usr/src/linux and after removing files in /lib related to that source. might be worth an bit of investigation

ps seems to work after removing that "old" mperf.ko

ryszardzonk
Posts: 19
Joined: Sat 2. Oct 2010, 14:27

Re: Fix for linux-3.x support in phc-k8

Post by ryszardzonk » Fri 18. Jan 2013, 11:44

The previous problem was in fact created by linking to the old module however here come new one ;) For some reason it errors out on the new kernel - linux-3.8-rc4 :(

Please check below and see if there is any possibility of fixing it

Code: Select all

pc phc-k8_v0.4.5b1 # make
make -C /lib/modules/3.8.0-rc4/build SUBDIRS=/usr/src/patches-kernel/phc-k8_v0.4.5b1 phc-k8.ko
make[1]: Wejście do katalogu `/usr/src/linux-3.8-rc4'
  CC [M]  /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.o
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c: In function ‘__check_direct_transitions’:
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:65:1: warning: return from incompatible pointer type [enabled by default]
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c: In function ‘__check_min_800MHz’:
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:68:1: warning: return from incompatible pointer type [enabled by default]
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c: At top level:
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1761:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘powernowk8_cpu_exit’
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:2361:2: error: implicit declaration of function ‘__devexit_p’ [-Werror=implicit-function-declaration]
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:2361:23: error: ‘powernowk8_cpu_exit’ undeclared here (not in a function)
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.o] Błąd 1
make[1]: *** [phc-k8.ko] Błąd 2
make[1]: Opuszczenie katalogu `/usr/src/linux-3.8-rc4'
make: *** [phc-k8.ko] Błąd 2

User avatar
DavidG
Posts: 179
Joined: Fri 18. Jul 2008, 11:25
Contact:

Re: Fix for linux-3.x support in phc-k8

Post by DavidG » Fri 18. Jan 2013, 12:32

ryszardzonk wrote:The previous problem was in fact created by linking to the old module however here come new one ;) For some reason it errors out on the new kernel - linux-3.8-rc4 :(

Please check below and see if there is any possibility of fixing it

Code: Select all

pc phc-k8_v0.4.5b1 # make
make -C /lib/modules/3.8.0-rc4/build SUBDIRS=/usr/src/patches-kernel/phc-k8_v0.4.5b1 phc-k8.ko
make[1]: Wejście do katalogu `/usr/src/linux-3.8-rc4'
  CC [M]  /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.o
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c: In function ‘__check_direct_transitions’:
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:65:1: warning: return from incompatible pointer type [enabled by default]
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c: In function ‘__check_min_800MHz’:
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:68:1: warning: return from incompatible pointer type [enabled by default]
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c: At top level:
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1761:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘powernowk8_cpu_exit’
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:2361:2: error: implicit declaration of function ‘__devexit_p’ [-Werror=implicit-function-declaration]
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:2361:23: error: ‘powernowk8_cpu_exit’ undeclared here (not in a function)
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.o] Błąd 1
make[1]: *** [phc-k8.ko] Błąd 2
make[1]: Opuszczenie katalogu `/usr/src/linux-3.8-rc4'
make: *** [phc-k8.ko] Błąd 2
I haven't fixed it yet in my own code, but AFAIK for kernel > 3.7 the __devexit and __devexit_p need to be defined as:

Code: Select all

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
#define __devexit
#define __devexit_p(func) func
#endif
I'm not sure the #if will also work on -rc kernelversion though...
A bank is a place where they lend you an umbrella in fair weather and ask for it back when it begins to rain -- R. Frost

Post Reply