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

Discuss about PHC here. For problems please use the PHC Help forum
ryszardzonk
Posts: 19
Joined: Sat 2. Oct 2010, 14:27

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

Post by ryszardzonk » Tue 5. Mar 2013, 19:18

After compiling kernel 3.8.2 I have just tried your fix by adding it to the phc-k8.c. It compiled fine, but it returned a warning

Code: Select all

WARNING: "cpufreq_get_measured_perf" [/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.ko] undefined!
Please take a look if there is something else that would need fixing or I applied it in the wrong place

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

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

Post by DavidG » Tue 19. Mar 2013, 14:10

ryszardzonk wrote:After compiling kernel 3.8.2 I have just tried your fix by adding it to the phc-k8.c. It compiled fine, but it returned a warning

Code: Select all

WARNING: "cpufreq_get_measured_perf" [/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.ko] undefined!
Please take a look if there is something else that would need fixing or I applied it in the wrong place
I'm sorry it took so long, but have you also tried without building mperf in phc-k8? Maybe that'll help? I'll try to look into it, however I'm really busy at the moment, so I'm not sure when I'll get the chance... I'm planning to remove mperf from phc-k8, since mperf has been in the kernel for a very long time now and I don't think I have to support that much older kernels any longer.
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 » Thu 21. Mar 2013, 17:12

no problem. I can w8 for reply ;)

I have tried compiling without mperf and created following patch http://pastebin.com/4YfVsgzx but it seems it is not enough and the change within phc-k8 itself is needed

I am not sure if trowing out "cpufreq_get_measured_perf" from phc-k8.c is the appropriate way to proceed as this is what kernel complains about, however the below is the only instance of it

/* Check for APERF/MPERF support in hardware */
if (cpu_has(c, X86_FEATURE_APERFMPERF))
cpufreq_amd64_driver.getavg = cpufreq_get_measured_perf;

If You get a change please take a look at it so hopefully I can bother You with changes in kernel 3.9 as I am sure there must be some ;)

EDIT: removing that statement produced a warninig so there must be some better way of changing this

/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c: In function ‘powernowk8_cpu_init’:
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1740:3: warning: statement with no effect [-Wunused-value]

EDIT 2: despite that warning the module now installed with no problem for kernel 3.8.3 and is working here for past few hours ;)

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

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

Post by ryszardzonk » Thu 30. May 2013, 15:41

@ DavidG
Same trick worked for both 3.8 & 3.9, but with 3.10 it is whole different ball game :( Please take a look at possible fix to the problem

make
make -C /usr/src/linux SUBDIRS=/usr/src/patches-kernel/phc-k8_v0.4.5b1 phc-k8.ko
make[1]: Wejście do katalogu `/usr/src/linux-3.10-rc3'
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:70: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:73:1: warning: return from incompatible pointer type [enabled by default]
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c: In function ‘transition_frequency_fidvid’:
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1468:3: warning: passing argument 1 of ‘cpufreq_notify_transition’ from incompatible pointer type [enabled by default]
In file included from /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:39:0:
include/linux/cpufreq.h:281:6: note: expected ‘struct cpufreq_policy *’ but argument is of type ‘struct cpufreq_freqs *’
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1468:3: error: too few arguments to function ‘cpufreq_notify_transition’
In file included from /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:39:0:
include/linux/cpufreq.h:281:6: note: declared here
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1479:3: warning: passing argument 1 of ‘cpufreq_notify_transition’ from incompatible pointer type [enabled by default]
In file included from /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:39:0:
include/linux/cpufreq.h:281:6: note: expected ‘struct cpufreq_policy *’ but argument is of type ‘struct cpufreq_freqs *’
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1479:3: warning: passing argument 2 of ‘cpufreq_notify_transition’ makes pointer from integer without a cast [enabled by default]
In file included from /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:39:0:
include/linux/cpufreq.h:281:6: note: expected ‘struct cpufreq_freqs *’ but argument is of type ‘int’
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1479:3: error: too few arguments to function ‘cpufreq_notify_transition’
In file included from /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:39:0:
include/linux/cpufreq.h:281:6: note: declared here
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c: In function ‘transition_frequency_pstate’:
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1505:3: warning: passing argument 1 of ‘cpufreq_notify_transition’ from incompatible pointer type [enabled by default]
In file included from /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:39:0:
include/linux/cpufreq.h:281:6: note: expected ‘struct cpufreq_policy *’ but argument is of type ‘struct cpufreq_freqs *’
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1505:3: error: too few arguments to function ‘cpufreq_notify_transition’
In file included from /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:39:0:
include/linux/cpufreq.h:281:6: note: declared here
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1513:3: warning: passing argument 1 of ‘cpufreq_notify_transition’ from incompatible pointer type [enabled by default]
In file included from /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:39:0:
include/linux/cpufreq.h:281:6: note: expected ‘struct cpufreq_policy *’ but argument is of type ‘struct cpufreq_freqs *’
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1513:3: warning: passing argument 2 of ‘cpufreq_notify_transition’ makes pointer from integer without a cast [enabled by default]
In file included from /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:39:0:
include/linux/cpufreq.h:281:6: note: expected ‘struct cpufreq_freqs *’ but argument is of type ‘int’
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1513:3: error: too few arguments to function ‘cpufreq_notify_transition’
In file included from /usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:39:0:
include/linux/cpufreq.h:281:6: note: declared here
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c: In function ‘powernowk8_cpu_init’:
/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.c:1740:3: warning: statement with no effect [-Wunused-value]
make[2]: *** [/usr/src/patches-kernel/phc-k8_v0.4.5b1/phc-k8.o] Błąd 1
make[1]: *** [phc-k8.ko] Error 2
make[1]: Opuszczenie katalogu `/usr/src/linux-3.10-rc3'
make: *** [phc-k8.ko] Error 2

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

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

Post by DavidG » Tue 4. Jun 2013, 10:48

Thanks for noticing! Unfortunately I haven't had much chance to work on phc-k8 (nor one of my other projects), but I will try to modify the phc-k8 driver (and perhaps finally release it as stable driver ;-) ). Looking at the git history, the changes don't seem to be very big. I should be able to fix it...
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 » Tue 25. Jun 2013, 12:43

DavidG have you been able to spare some time around PHC patch? 3.10 looks like is just around the corner :roll:

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

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

Post by DavidG » Wed 26. Jun 2013, 21:37

ryszardzonk wrote:DavidG have you been able to spare some time around PHC patch? 3.10 looks like is just around the corner :roll:
I have tried to incorporate the latest changes to 3.10 and I just uploaded a v0.4.5b2 version driver that should hopefully work. Unfortunately I am unable to test it at the moment, but the changes since 3.7 are small enough to work...

Please test it and let me know if it works for you... ;)
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 » Sat 29. Jun 2013, 22:15

Working great here :) Thanks:!: :D

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

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

Post by DavidG » Mon 1. Jul 2013, 10:34

Glad to hear... Just in time, 3.10 was released yesterday 8-)

I intend to test a bit (more) on my hardware, update the changelog/version and then release it as stable...

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

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

Post by ryszardzonk » Sat 19. Jul 2014, 23:28

DavidG I have just tried to compile phc-k8 with new kernel 3.15.6 and unfortunately driver would not compile for me :(

PLease take a look at it when You find some time for it

Code: Select all

make -C /usr/src/linux SUBDIRS=/usr/src/gentoo/phc/phc-k8_v0.4.5 phc-k8.ko
make[1]: Wejście do katalogu '/usr/src/linux-3.15.6'
  CC [M]  /usr/src/gentoo/phc/phc-k8_v0.4.5/phc-k8.o
/usr/src/gentoo/phc/phc-k8_v0.4.5/phc-k8.c: In function ‘transition_frequency_fidvid’:
/usr/src/gentoo/phc/phc-k8_v0.4.5/phc-k8.c:1514:2: error: implicit declaration of function ‘cpufreq_notify_transition’ [-Werror=implicit-function-declaration]
  cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
  ^
/usr/src/gentoo/phc/phc-k8_v0.4.5/phc-k8.c: In function ‘powernowk8_cpu_exit’:
/usr/src/gentoo/phc/phc-k8_v0.4.5/phc-k8.c:1851:2: error: implicit declaration of function ‘cpufreq_frequency_table_put_attr’ [-Werror=implicit-function-declaration]
  cpufreq_frequency_table_put_attr(pol->cpu);
  ^
/usr/src/gentoo/phc/phc-k8_v0.4.5/phc-k8.c: In function ‘store_phc_controls’:
/usr/src/gentoo/phc/phc-k8_v0.4.5/phc-k8.c:2086:2: error: implicit declaration of function ‘cpufreq_frequency_table_get_attr’ [-Werror=implicit-function-declaration]
  cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu);
  ^
cc1: some warnings being treated as errors
scripts/Makefile.build:324: polecenia dla obiektu '/usr/src/gentoo/phc/phc-k8_v0.4.5/phc-k8.o' nie powiodły się
make[2]: *** [/usr/src/gentoo/phc/phc-k8_v0.4.5/phc-k8.o] Error 1
Makefile:1476: polecenia dla obiektu 'phc-k8.ko' nie powiodły się
make[1]: *** [phc-k8.ko] Error 2
make[1]: Leaving directory '/usr/src/linux-3.15.6'
Makefile:42: polecenia dla obiektu 'phc-k8.ko' nie powiodły się
make: *** [phc-k8.ko] Error 2
Regards,
rz

Post Reply