Attempting to use with 3.11

If you have trouble with PHC you can ask and hope for help here.
ibidem
Posts: 8
Joined: Thu 1. Aug 2013, 05:36

Attempting to use with 3.11

Post by ibidem » Thu 1. Aug 2013, 05:49

Since I've got an AMD-based laptop, I would like to try out dpm (the new Radeon dynamic power management, which can really lower power use).
This requires kernel 3.11.

But here's what I get:

Code: Select all

make -C /lib/modules/3.11.0-rc3-tp-24/build SUBDIRS=/root/phc-k8_v0.4.5b2 phc-k8.ko
make[1]: Entering directory `/usr/src/linux-headers-3.11.0-rc3-tp-24'
  CC [M]  /root/phc-k8_v0.4.5b2/phc-k8.o
/root/phc-k8_v0.4.5b2/phc-k8.c: In function '__check_direct_transitions':
/root/phc-k8_v0.4.5b2/phc-k8.c:65: warning: return from incompatible pointer type
/root/phc-k8_v0.4.5b2/phc-k8.c: In function '__check_min_800MHz':
/root/phc-k8_v0.4.5b2/phc-k8.c:68: warning: return from incompatible pointer type
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'print_basics':
/root/phc-k8_v0.4.5b2/phc-k8.c:889: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:891: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:896: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:898: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'fill_powernow_table':
/root/phc-k8_v0.4.5b2/phc-k8.c:945: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:946: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:951: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'powernow_k8_cpu_init_acpi':
/root/phc-k8_v0.4.5b2/phc-k8.c:1169: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'fill_powernow_table_pstate':
/root/phc-k8_v0.4.5b2/phc-k8.c:1263: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'fill_powernow_table_fidvid':
/root/phc-k8_v0.4.5b2/phc-k8.c:1292: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'fill_powernow_table_fidvid_dt':
/root/phc-k8_v0.4.5b2/phc-k8.c:1358: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'transition_frequency_fidvid':
/root/phc-k8_v0.4.5b2/phc-k8.c:1452: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:1453: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'powernowk8_apply_settings':
/root/phc-k8_v0.4.5b2/phc-k8.c:1839: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'show_controls':
/root/phc-k8_v0.4.5b2/phc-k8.c:1910: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:1911: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'store_phc_controls':
/root/phc-k8_v0.4.5b2/phc-k8.c:1973: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:1984: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:1989: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'show_fids':
/root/phc-k8_v0.4.5b2/phc-k8.c:2031: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'show_phc_available_fids':
/root/phc-k8_v0.4.5b2/phc-k8.c:2048: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'store_phc_fids':
/root/phc-k8_v0.4.5b2/phc-k8.c:2094: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:2104: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:2109: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:2110: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'show_vids':
/root/phc-k8_v0.4.5b2/phc-k8.c:2153: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:2157: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c: In function 'store_phc_vids':
/root/phc-k8_v0.4.5b2/phc-k8.c:2237: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:2238: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:2249: error: 'struct cpufreq_frequency_table' has no member named 'index'
/root/phc-k8_v0.4.5b2/phc-k8.c:2250: error: 'struct cpufreq_frequency_table' has no member named 'index'
make[2]: *** [/root/phc-k8_v0.4.5b2/phc-k8.o] Error 1
make[1]: *** [phc-k8.ko] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.11.0-rc3-tp-24'
make: *** [phc-k8.ko] Error 2

ibidem
Posts: 8
Joined: Thu 1. Aug 2013, 05:36

Re: Attempting to use with 3.11

Post by ibidem » Thu 1. Aug 2013, 06:06

OK, "index" became "driver_data".
Dirty way to fix is:

Code: Select all

sed -e 's/\.index/.driver_data/g' -i phc-k8.c
But that's not the right way, I know.

ibidem
Posts: 8
Joined: Thu 1. Aug 2013, 05:36

Re: Attempting to use with 3.11

Post by ibidem » Thu 1. Aug 2013, 07:20

And a proper patch.
(Although it's a git patch, the repo is based on the 0.4.5b2 tarball)
I can't attach it, so I'm copy/pasting.

Code: Select all

commit 725d95ba950a93edfcc85a3e2ca9eb25e1e164ee
Author: Isaac Dunham <idunham@lavabit.com>
Date:   Wed Jul 31 22:10:41 2013 -0700

    Proper fix for 3.11

diff --git a/phc-k8.c b/phc-k8.c
index e42ae7a..d186103 100644
--- a/phc-k8.c
+++ b/phc-k8.c
@@ -886,16 +886,32 @@ static void print_basics(struct powernow_k8_data *data)
 				printk(KERN_INFO PFX
 					"   %d : pstate %d (%d MHz), vid 0x%x\n",
 					j,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+					data->powernow_table[j].driver_data & HW_PSTATE_MASK,
+#else
 					data->powernow_table[j].index & HW_PSTATE_MASK,
+#endif
 					data->powernow_table[j].frequency/1000,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+					cpufreqtable_index_to_vid(data->powernow_table[j].driver_data));
+#else
 					cpufreqtable_index_to_vid(data->powernow_table[j].index));
+#endif
 			} else {
 				printk(KERN_INFO PFX
 					"   %d : fid 0x%x (%d MHz), vid 0x%x\n",
 					j,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+					data->powernow_table[j].driver_data & 0xff,
+#else
 					data->powernow_table[j].index & 0xff,
+#endif
 					data->powernow_table[j].frequency/1000,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+					data->powernow_table[j].driver_data >> 8);
+#else
 					data->powernow_table[j].index >> 8);
+#endif
 			}
 		}
 	}
@@ -942,13 +958,25 @@ static int fill_powernow_table(struct powernow_k8_data *data,
 
 	for (j = 0; j < data->numps; j++) {
 		int freq;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		powernow_table[j].driver_data = pst[j].fid; /* lower 8 bits */
+#else
 		powernow_table[j].index = pst[j].fid; /* lower 8 bits */
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		powernow_table[j].driver_data |= (pst[j].vid << 8); /* upper 8 bits */
+#else
 		powernow_table[j].index |= (pst[j].vid << 8); /* upper 8 bits */
+#endif
 		freq = find_khz_freq_from_fid(pst[j].fid);
 		powernow_table[j].frequency = freq;
 	}
 	powernow_table[data->numps].frequency = CPUFREQ_TABLE_END;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+	powernow_table[data->numps].driver_data = 0;
+#else
 	powernow_table[data->numps].index = 0;
+#endif
 
 	if (query_current_values_with_pending_wait(data)) {
 		kfree(powernow_table);
@@ -1166,7 +1194,11 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
 		goto err_out_mem;
 
 	powernow_table[numps].frequency = CPUFREQ_TABLE_END;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+	powernow_table[numps].driver_data = 0;
+#else
 	powernow_table[numps].index = 0;
+#endif
 	data->powernow_table = powernow_table;
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
@@ -1260,7 +1292,11 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data,
 			powernow_table[i].frequency =
 				data->acpi_data.states[i].core_frequency * 1000;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		powernow_table[i].driver_data = index | (lo << 16);
+#else
 		powernow_table[i].index = index | (lo << 16);
+#endif
 	}
 	return 0;
 }
@@ -1289,7 +1325,11 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data,
 		pr_debug("   %d : fid 0x%x, vid 0x%x\n", i, fid, vid);
 
 		index = fid | (vid<<8);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		powernow_table[i].driver_data = index;
+#else
 		powernow_table[i].index = index;
+#endif
 
 		freq = find_khz_freq_from_fid(fid);
 		powernow_table[i].frequency = freq;
@@ -1355,7 +1395,11 @@ static int fill_powernow_table_fidvid_dt(struct powernow_k8_data *data,
 
 		pr_debug("   %d : fid 0x%x, vid 0x%x\n", i, fid, vid);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		powernow_table[i].driver_data = (fid & 0xFF)
+#else
 		powernow_table[i].index = (fid & 0xFF)
+#endif
 				|((vid & 0xFF) << 8);
 
 		/* For now, mark all entries not in the acpi_data.states as invalid */
@@ -1449,8 +1493,16 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data,
 	 * the cpufreq frequency table in find_psb_table, vid
 	 * are the upper 8 bits.
 	 */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+	fid = data->powernow_table[index].driver_data & 0xFF;
+#else
 	fid = data->powernow_table[index].index & 0xFF;
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+	vid = (data->powernow_table[index].driver_data & 0xFF00) >> 8;
+#else
 	vid = (data->powernow_table[index].index & 0xFF00) >> 8;
+#endif
 
 	pr_debug("table matched fid 0x%x, giving vid 0x%x\n", fid, vid);
 
@@ -1836,8 +1888,13 @@ static int powernowk8_apply_settings(struct cpufreq_policy *pol) {
 			u32 hi, lo;
 			rdmsr(hwpstate_base + i, lo, hi);
 			lo &= ~(HW_PSTATE_VID_MASK);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+			lo |= ((data->powernow_table[i].driver_data >> 16) \
+				& HW_PSTATE_VID_MASK);
+#else
 			lo |= ((data->powernow_table[i].index >> 16) \
 				& HW_PSTATE_VID_MASK);
+#endif
 			//printk(KERN_INFO PFX "writing %.8x:%.8x\n", hi, lo);
 			wrmsr(hwpstate_base + i, lo, hi);
 		}
@@ -1907,8 +1964,16 @@ show_controls(struct cpufreq_frequency_table *table, int entries, char *buf)
 
 	for (j = first_valid_entry(table, 0); j < entries; 
 	     j = first_valid_entry(table, j + 1)) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		unsigned int fid = table[j].driver_data & 0xff;
+#else
 		unsigned int fid = table[j].index & 0xff;
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		unsigned int vid = (table[j].driver_data >> 8) & 0xff;
+#else
 		unsigned int vid = (table[j].index >> 8) & 0xff;
+#endif
 		count += snprintf(&buf[count], PAGE_SIZE - count, "%u:%u ", fid, vid);
 	}
 	if (count > 0) {
@@ -1970,7 +2035,11 @@ store_phc_controls(struct cpufreq_policy *pol, const char *buf, size_t count)
 
 		/* lookup matching fid in the existing powernow table and
 		   mark prepending entries as invalid */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		while (fid < (data->powernow_table[entry].driver_data & 0xFF)
+#else
 		while (fid < (data->powernow_table[entry].index & 0xFF)
+#endif
 			&& entry < data->numps) {
 			data->powernow_table[entry].frequency = CPUFREQ_ENTRY_INVALID;
 			entry++;
@@ -1981,12 +2050,20 @@ store_phc_controls(struct cpufreq_policy *pol, const char *buf, size_t count)
 			break;
 		/* If the supplied frequency cannot be found in the frequencies
 		   table, the printk an error, but still continue */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		else if (fid != (data->powernow_table[entry].driver_data & 0xFF)) {
+#else
 		else if (fid != (data->powernow_table[entry].index & 0xFF)) {
+#endif
 			printk(KERN_ERR PFX "invalid fid value %lu\n", fid);
 			continue;
 		}
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		data->powernow_table[entry].driver_data = (fid & 0xFF)|((vid & 0xFF) << 8);
+#else
 		data->powernow_table[entry].index = (fid & 0xFF)|((vid & 0xFF) << 8);
+#endif
 		data->powernow_table[entry].frequency = (vid <= LEAST_VID)
 				? find_khz_freq_from_fid(fid)
 				: CPUFREQ_ENTRY_INVALID;
@@ -2028,7 +2105,11 @@ show_fids(struct cpufreq_frequency_table *table, int entries, char *buf)
 
 	for (j = first_valid_entry(table, 0); j < entries; 
 	     j = first_valid_entry(table, j + 1)) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		unsigned int fid = table[j].driver_data & 0xff;
+#else
 		unsigned int fid = table[j].index & 0xff;
+#endif
 		count += snprintf(&buf[count], PAGE_SIZE - count, "%u ", fid);
 	}
 	if (count > 0) {
@@ -2045,7 +2126,11 @@ static ssize_t show_phc_available_fids(struct cpufreq_policy *pol, char *buf)
 	int j;
 
 	for (j = 0; j < data->numps; j++) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		unsigned int fid = data->powernow_table[j].driver_data & 0xff;
+#else
 		unsigned int fid = data->powernow_table[j].index & 0xff;
+#endif
 		count += snprintf(&buf[count], PAGE_SIZE - count, "%u ", fid);
 	}
 	if (count > 0) {
@@ -2091,7 +2176,11 @@ store_phc_fids(struct cpufreq_policy *pol, const char *buf, size_t count)
 		/* lookup matching fid in the existing powernow table and
 		   mark prepending entries as invalid */
 		while (entry < data->numps
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+			&& fid < (data->powernow_table[entry].driver_data & 0xFF)) {
+#else
 			&& fid < (data->powernow_table[entry].index & 0xFF)) {
+#endif
 			data->powernow_table[entry].frequency = CPUFREQ_ENTRY_INVALID;
 			entry++;
 		}
@@ -2101,13 +2190,25 @@ store_phc_fids(struct cpufreq_policy *pol, const char *buf, size_t count)
 			break;
 		/* If the supplied frequency cannot be found in the frequencies
 		   table, the printk an error, but still continue */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		else if (fid != (data->powernow_table[entry].driver_data & 0xFF)) {
+#else
 		else if (fid != (data->powernow_table[entry].index & 0xFF)) {
+#endif
 			printk(KERN_ERR PFX "invalid fid value %lu\n", fid);
 			continue;
 		}
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		vid = (data->powernow_table[entry].driver_data >> 8) & 0xFF;
+#else
 		vid = (data->powernow_table[entry].index >> 8) & 0xFF;
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+		data->powernow_table[entry].driver_data = (fid & 0xFF)|((vid & 0xFF) << 8);
+#else
 		data->powernow_table[entry].index = (fid & 0xFF)|((vid & 0xFF) << 8);
+#endif
 		data->powernow_table[entry].frequency = (vid <= LEAST_VID)
 				? find_khz_freq_from_fid(fid)
 				: CPUFREQ_ENTRY_INVALID;
@@ -2150,11 +2251,19 @@ static ssize_t show_vids(struct cpufreq_frequency_table *table, int entries,
 		unsigned int vid;
 
 		if (cpu_family != CPU_HW_PSTATE) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+			vid = (table[j].driver_data >> 8) & 0xff;
+#else
 			vid = (table[j].index >> 8) & 0xff;
+#endif
 			if (table[j].frequency != CPUFREQ_ENTRY_INVALID && vid <= LEAST_VID)
 				count += snprintf(&buf[count], PAGE_SIZE - count, "%u ", vid);
 		} else {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+			vid = cpufreqtable_index_to_vid(table[j].driver_data);
+#else
 			vid = cpufreqtable_index_to_vid(table[j].index);
+#endif
 			if (table[j].frequency != CPUFREQ_ENTRY_INVALID
 				&& (vid == (vid & 0x7f)))
 				count += snprintf(&buf[count], PAGE_SIZE - count, "%u ", vid);
@@ -2234,8 +2343,16 @@ store_phc_vids(struct cpufreq_policy *pol, const char *buf, size_t count)
 		if (cpu_family != CPU_HW_PSTATE) {
 			/* Least vid is actually the highest value allowed */
 			if (vid <= LEAST_VID || vid == VID_OFF) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+				u32 fid = data->powernow_table[i].driver_data & 0xFF;
+#else
 				u32 fid = data->powernow_table[i].index & 0xFF;
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+				data->powernow_table[i].driver_data = fid | ((vid & 0xFF) << 8);
+#else
 				data->powernow_table[i].index = fid | ((vid & 0xFF) << 8);
+#endif
 				data->powernow_table[i].frequency = (vid <= LEAST_VID)
 					? find_khz_freq_from_fid(fid)
 					: CPUFREQ_ENTRY_INVALID;
@@ -2246,9 +2363,18 @@ store_phc_vids(struct cpufreq_policy *pol, const char *buf, size_t count)
 			}
 		} else {
 			if (vid == (vid & 0x7f)) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+				u32 mask = (data->powernow_table[i].driver_data & ~(HW_PSTATE_VID_MASK << 16));
+#else
 				u32 mask = (data->powernow_table[i].index & ~(HW_PSTATE_VID_MASK << 16));
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+				data->powernow_table[i].driver_data = mask | \
+						((vid << HW_PSTATE_VID_SHIFT) & HW_PSTATE_VID_MASK) << 16;
+#else
 				data->powernow_table[i].index = mask | \
 						((vid << HW_PSTATE_VID_SHIFT) & HW_PSTATE_VID_MASK) << 16;
+#endif
 			} else {
 				printk(KERN_ERR PFX
 					"vid value %i is out of bounds: %lu\n", i, vid);

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

Re: Attempting to use with 3.11

Post by DavidG » Thu 1. Aug 2013, 17:29

Thanks, I had already started working on this. If I remember well, there have been other (trivial) changes to cpufreq/powernow-k8 as well that I would like to add before I'm releasing phc-k8 0.4.5. May I add you to my list of testers...? ;)

ibidem
Posts: 8
Joined: Thu 1. Aug 2013, 05:36

Re: Attempting to use with 3.11

Post by ibidem » Tue 6. Aug 2013, 04:20

DavidG wrote:Thanks, I had already started working on this. If I remember well, there have been other (trivial) changes to cpufreq/powernow-k8 as well that I would like to add before I'm releasing phc-k8 0.4.5. May I add you to my list of testers...? ;)
If you wish that will be fine, but I don't have a really good idea how to test beyond "builds, loads, and setting the default variables works".
Also, 3.11-rc3 isn't shutting down here, so I'm using 3.8 as my main kernel for now.
Another issue I ran into was that I had to comment out the part that builds mperf in dkms.conf.
(PS: I also have an Atom N270-based system with Ubuntu Lucid still as the main OS...AR5007/some odd variant that is rather buggy, so I need madwifi-hal, so I need a 2.6.3x kernel).

To find out what had changed, I did a git log of the cpufreq docs, then I used sed to make an initial patch with the #if ... wrappers around each line, then compiled it and looked at the errors to adjust it.

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

Re: Attempting to use with 3.11

Post by DavidG » Sat 7. Sep 2013, 00:49

There's a new beta driver in the test releases topic that should support 3.11 (and the most recently accepted changes for 3.12-rc1) Please try it and let me know if it works alright.
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

ibidem
Posts: 8
Joined: Thu 1. Aug 2013, 05:36

Re: Attempting to use with 3.11

Post by ibidem » Sat 21. Sep 2013, 18:03

DavidG wrote:There's a new beta driver in the test releases topic that should support 3.11 (and the most recently accepted changes for 3.12-rc1) Please try it and let me know if it works alright.
3.12 rc1:

Code: Select all

DKMS make.log for phc-k8-0.4.5b3 for kernel 3.12.0-rc1-tp-23 (i686)
Fri Sep 20 21:37:24 PDT 2013
make[1]: Entering directory `/usr/src/linux-headers-3.12.0-rc1-tp-23'
  CC [M]  /var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.o
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c: In function '__check_direct_transitions':
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:65: warning: return from incompatible pointer type
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c: In function '__check_min_800MHz':
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:68: warning: return from incompatible pointer type
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c: In function 'powernowk8_cpu_init':
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:1806: error: 'struct cpufreq_driver' has no member named 'getavg'
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c: At top level:
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:2510: error: unknown field 'owner' specified in initializer
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:2510: warning: initialization makes integer from pointer without a cast
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:2510: error: initializer element is not computable at load time
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:2510: error: (near initialization for 'cpufreq_amd64_driver.flags')
make[2]: *** [/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.o] Error 1
make[1]: *** [_module_/var/lib/dkms/phc-k8/0.4.5b3/build] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.12.0-rc1-tp-23'
Have not yet tested 3.11.

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

Re: Attempting to use with 3.11

Post by DavidG » Sun 22. Sep 2013, 10:57

Apparently more cpufreq patches were pending for 3.12-rc1 when the SSD of Linus crashed... ;) I'll try to fix it for the 0.4.5 final version.
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: Attempting to use with 3.11

Post by DavidG » Thu 10. Oct 2013, 00:14

ibidem wrote:
DavidG wrote:There's a new beta driver in the test releases topic that should support 3.11 (and the most recently accepted changes for 3.12-rc1) Please try it and let me know if it works alright.
3.12 rc1:

Code: Select all

DKMS make.log for phc-k8-0.4.5b3 for kernel 3.12.0-rc1-tp-23 (i686)
Fri Sep 20 21:37:24 PDT 2013
make[1]: Entering directory `/usr/src/linux-headers-3.12.0-rc1-tp-23'
  CC [M]  /var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.o
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c: In function '__check_direct_transitions':
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:65: warning: return from incompatible pointer type
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c: In function '__check_min_800MHz':
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:68: warning: return from incompatible pointer type
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c: In function 'powernowk8_cpu_init':
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:1806: error: 'struct cpufreq_driver' has no member named 'getavg'
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c: At top level:
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:2510: error: unknown field 'owner' specified in initializer
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:2510: warning: initialization makes integer from pointer without a cast
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:2510: error: initializer element is not computable at load time
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:2510: error: (near initialization for 'cpufreq_amd64_driver.flags')
make[2]: *** [/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.o] Error 1
make[1]: *** [_module_/var/lib/dkms/phc-k8/0.4.5b3/build] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.12.0-rc1-tp-23'
Have not yet tested 3.11.
A small update, it should have worked, but I'm suspecting your kernel version header was out-of-date. I only encountered this once, where I had updated the kernel git tree, but had not been running "make prepare" first. In that case the header file is still set to the older kernel version. It is probably to late to still check include/generated/utsrelease.h by now, but I think that is why you saw this happening... The beta3 driver should omit the owner field for 3.12.* kernels.
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

ibidem
Posts: 8
Joined: Thu 1. Aug 2013, 05:36

Re: Attempting to use with 3.11

Post by ibidem » Sat 12. Oct 2013, 07:49

DavidG wrote:
ibidem wrote:
DavidG wrote:There's a new beta driver in the test releases topic that should support 3.11 (and the most recently accepted changes for 3.12-rc1) Please try it and let me know if it works alright.
3.12 rc1:

Code: Select all

DKMS make.log for phc-k8-0.4.5b3 for kernel 3.12.0-rc1-tp-23 (i686)
Fri Sep 20 21:37:24 PDT 2013
make[1]: Entering directory `/usr/src/linux-headers-3.12.0-rc1-tp-23'
  CC [M]  /var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.o
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c: In function '__check_direct_transitions':
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:65: warning: return from incompatible pointer type
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c: In function '__check_min_800MHz':
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:68: warning: return from incompatible pointer type
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c: In function 'powernowk8_cpu_init':
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:1806: error: 'struct cpufreq_driver' has no member named 'getavg'
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c: At top level:
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:2510: error: unknown field 'owner' specified in initializer
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:2510: warning: initialization makes integer from pointer without a cast
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:2510: error: initializer element is not computable at load time
/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.c:2510: error: (near initialization for 'cpufreq_amd64_driver.flags')
make[2]: *** [/var/lib/dkms/phc-k8/0.4.5b3/build/phc-k8.o] Error 1
make[1]: *** [_module_/var/lib/dkms/phc-k8/0.4.5b3/build] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.12.0-rc1-tp-23'
Have not yet tested 3.11.
A small update, it should have worked, but I'm suspecting your kernel version header was out-of-date. I only encountered this once, where I had updated the kernel git tree, but had not been running "make prepare" first. In that case the header file is still set to the older kernel version. It is probably to late to still check include/generated/utsrelease.h by now, but I think that is why you saw this happening... The beta3 driver should omit the owner field for 3.12.* kernels.
I just looked at the source...It says

Code: Select all

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
	struct cpuinfo_x86 *c = &cpu_data(pol->cpu);
#endif

Code: Select all

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
	/* Check for APERF/MPERF support in hardware */
	if (cpu_has(c, X86_FEATURE_APERFMPERF))
		cpufreq_amd64_driver.getavg = cpufreq_get_measured_perf;
#endif
That means "if current is at least 3.12, compile this..."
Which is backwards of what it should be.

Post Reply