Skip to contentSkip to conversation

/proc/mtrr in 2.6

DISCUSSION [email protected] 2 participants 3 messages Nov 19, 2003

lore
Share & tools
lore
#0 lore raw

In 2.6, having /proc/mtrr support in a kernel run on a system which lacks MTRR support (like my crusoe) results in /proc/mtrr existing, but giving EIO if you try to read it. On 2.4, it is detected as not existing and not created. Is this the new intentional behaviour, or just a bug?

#1 lore raw
Quoted 4 lines · On Tue, Nov 18, 2003 at 09:12:34PM -0800, [email protected] wrote:

In 2.6, having /proc/mtrr support in a kernel run on a system which lacks MTRR support (like my crusoe) results in /proc/mtrr existing, but giving EIO if you try to read it. On 2.4, it is detected as not existing and not created. Is this the new intentional behaviour, or just a bug?

Need something like this perhaps ?

arch/i386/kernel/cpu/mtrr/if.c renamed from arch/i386/kernel/cpu/mtrr/if.c~ +8 -0
@@ -352,6 +352,14 @@
 
 static int __init mtrr_if_init(void)
 {
+	struct cpuinfo_x86 *c = &boot_cpu_data;
+
+	if ((!cpu_has(c, X86_FEATURE_MTRR)) ||
+	    (!cpu_has(c, X86_FEATURE_K6_MTRR)) ||
+	    (!cpu_has(c, X86_FEATURE_CYRIX_ARR)) ||
+	    (!cpu_has(c, X86_FEATURE_CENTAUR_MCR)))
+		return -ENODEV;
+
 	proc_root_mtrr =
 	    create_proc_entry("mtrr", S_IWUSR | S_IRUGO, &proc_root);
 	if (proc_root_mtrr) {
#2 lore raw
Quoted 7 lines · Dave Jones
Quoted 4 lines · On Tue, Nov 18, 2003 at 09:12:34PM -0800, [email protected] wrote:

In 2.6, having /proc/mtrr support in a kernel run on a system which lacks MTRR support (like my crusoe) results in /proc/mtrr existing, but giving EIO if you try to read it. On 2.4, it is detected as not existing and not created. Is this the new intentional behaviour, or just a bug?

Need something like this perhaps ?

Better yet, get the logic right..

arch/i386/kernel/cpu/mtrr/if.c renamed from arch/i386/kernel/cpu/mtrr/if.c~ +8 -0
@@ -352,6 +352,14 @@
 
 static int __init mtrr_if_init(void)
 {
+	struct cpuinfo_x86 *c = &boot_cpu_data;
+
+	if ((!cpu_has(c, X86_FEATURE_MTRR)) &&
+		(!cpu_has(c, X86_FEATURE_K6_MTRR)) &&
+		(!cpu_has(c, X86_FEATURE_CYRIX_ARR)) &&
+		(!cpu_has(c, X86_FEATURE_CENTAUR_MCR)))
+	return -ENODEV;
+
 	proc_root_mtrr =
 	    create_proc_entry("mtrr", S_IWUSR | S_IRUGO, &proc_root);
 	if (proc_root_mtrr) {