Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86: Remove CONFIG_X86_OOSTORE

This was an optimization that made memcpy type benchmarks a little
faster on ancient (Circa 1998) IDT Winchip CPUs. In real-life
workloads, it wasn't even noticable, and I doubt anyone is running
benchmarks on 16 year old silicon any more.

Given this code has likely seen very little use over the last decade,
let's just remove it.

Signed-off-by: Dave Jones <davej@fedoraproject.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Dave Jones and committed by
Linus Torvalds
09df7c4c 8712a005

+5 -290
-4
arch/x86/Kconfig.cpu
··· 341 341 def_bool y 342 342 depends on (MCYRIXIII || MK7 || MGEODE_LX) && !UML 343 343 344 - config X86_OOSTORE 345 - def_bool y 346 - depends on (MWINCHIP3D || MWINCHIPC6) && MTRR 347 - 348 344 # 349 345 # P6_NOPs are a relatively minor optimization that require a family >= 350 346 # 6 processor, except that it is broken on certain VIA chips.
+2 -6
arch/x86/include/asm/barrier.h
··· 85 85 #else 86 86 # define smp_rmb() barrier() 87 87 #endif 88 - #ifdef CONFIG_X86_OOSTORE 89 - # define smp_wmb() wmb() 90 - #else 91 - # define smp_wmb() barrier() 92 - #endif 88 + #define smp_wmb() barrier() 93 89 #define smp_read_barrier_depends() read_barrier_depends() 94 90 #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) 95 91 #else /* !SMP */ ··· 96 100 #define set_mb(var, value) do { var = value; barrier(); } while (0) 97 101 #endif /* SMP */ 98 102 99 - #if defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE) 103 + #if defined(CONFIG_X86_PPRO_FENCE) 100 104 101 105 /* 102 106 * For either of these options x86 doesn't have a strong TSO memory
+1 -1
arch/x86/include/asm/io.h
··· 237 237 238 238 static inline void flush_write_buffers(void) 239 239 { 240 - #if defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE) 240 + #if defined(CONFIG_X86_PPRO_FENCE) 241 241 asm volatile("lock; addl $0,0(%%esp)": : :"memory"); 242 242 #endif 243 243 }
+2 -3
arch/x86/include/asm/spinlock.h
··· 26 26 # define LOCK_PTR_REG "D" 27 27 #endif 28 28 29 - #if defined(CONFIG_X86_32) && \ 30 - (defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE)) 29 + #if defined(CONFIG_X86_32) && (defined(CONFIG_X86_PPRO_FENCE)) 31 30 /* 32 - * On PPro SMP or if we are using OOSTORE, we use a locked operation to unlock 31 + * On PPro SMP, we use a locked operation to unlock 33 32 * (PPro errata 66, 92) 34 33 */ 35 34 # define UNLOCK_LOCK_PREFIX LOCK_PREFIX
-272
arch/x86/kernel/cpu/centaur.c
··· 8 8 9 9 #include "cpu.h" 10 10 11 - #ifdef CONFIG_X86_OOSTORE 12 - 13 - static u32 power2(u32 x) 14 - { 15 - u32 s = 1; 16 - 17 - while (s <= x) 18 - s <<= 1; 19 - 20 - return s >>= 1; 21 - } 22 - 23 - 24 - /* 25 - * Set up an actual MCR 26 - */ 27 - static void centaur_mcr_insert(int reg, u32 base, u32 size, int key) 28 - { 29 - u32 lo, hi; 30 - 31 - hi = base & ~0xFFF; 32 - lo = ~(size-1); /* Size is a power of 2 so this makes a mask */ 33 - lo &= ~0xFFF; /* Remove the ctrl value bits */ 34 - lo |= key; /* Attribute we wish to set */ 35 - wrmsr(reg+MSR_IDT_MCR0, lo, hi); 36 - mtrr_centaur_report_mcr(reg, lo, hi); /* Tell the mtrr driver */ 37 - } 38 - 39 - /* 40 - * Figure what we can cover with MCR's 41 - * 42 - * Shortcut: We know you can't put 4Gig of RAM on a winchip 43 - */ 44 - static u32 ramtop(void) 45 - { 46 - u32 clip = 0xFFFFFFFFUL; 47 - u32 top = 0; 48 - int i; 49 - 50 - for (i = 0; i < e820.nr_map; i++) { 51 - unsigned long start, end; 52 - 53 - if (e820.map[i].addr > 0xFFFFFFFFUL) 54 - continue; 55 - /* 56 - * Don't MCR over reserved space. Ignore the ISA hole 57 - * we frob around that catastrophe already 58 - */ 59 - if (e820.map[i].type == E820_RESERVED) { 60 - if (e820.map[i].addr >= 0x100000UL && 61 - e820.map[i].addr < clip) 62 - clip = e820.map[i].addr; 63 - continue; 64 - } 65 - start = e820.map[i].addr; 66 - end = e820.map[i].addr + e820.map[i].size; 67 - if (start >= end) 68 - continue; 69 - if (end > top) 70 - top = end; 71 - } 72 - /* 73 - * Everything below 'top' should be RAM except for the ISA hole. 74 - * Because of the limited MCR's we want to map NV/ACPI into our 75 - * MCR range for gunk in RAM 76 - * 77 - * Clip might cause us to MCR insufficient RAM but that is an 78 - * acceptable failure mode and should only bite obscure boxes with 79 - * a VESA hole at 15Mb 80 - * 81 - * The second case Clip sometimes kicks in is when the EBDA is marked 82 - * as reserved. Again we fail safe with reasonable results 83 - */ 84 - if (top > clip) 85 - top = clip; 86 - 87 - return top; 88 - } 89 - 90 - /* 91 - * Compute a set of MCR's to give maximum coverage 92 - */ 93 - static int centaur_mcr_compute(int nr, int key) 94 - { 95 - u32 mem = ramtop(); 96 - u32 root = power2(mem); 97 - u32 base = root; 98 - u32 top = root; 99 - u32 floor = 0; 100 - int ct = 0; 101 - 102 - while (ct < nr) { 103 - u32 fspace = 0; 104 - u32 high; 105 - u32 low; 106 - 107 - /* 108 - * Find the largest block we will fill going upwards 109 - */ 110 - high = power2(mem-top); 111 - 112 - /* 113 - * Find the largest block we will fill going downwards 114 - */ 115 - low = base/2; 116 - 117 - /* 118 - * Don't fill below 1Mb going downwards as there 119 - * is an ISA hole in the way. 120 - */ 121 - if (base <= 1024*1024) 122 - low = 0; 123 - 124 - /* 125 - * See how much space we could cover by filling below 126 - * the ISA hole 127 - */ 128 - 129 - if (floor == 0) 130 - fspace = 512*1024; 131 - else if (floor == 512*1024) 132 - fspace = 128*1024; 133 - 134 - /* And forget ROM space */ 135 - 136 - /* 137 - * Now install the largest coverage we get 138 - */ 139 - if (fspace > high && fspace > low) { 140 - centaur_mcr_insert(ct, floor, fspace, key); 141 - floor += fspace; 142 - } else if (high > low) { 143 - centaur_mcr_insert(ct, top, high, key); 144 - top += high; 145 - } else if (low > 0) { 146 - base -= low; 147 - centaur_mcr_insert(ct, base, low, key); 148 - } else 149 - break; 150 - ct++; 151 - } 152 - /* 153 - * We loaded ct values. We now need to set the mask. The caller 154 - * must do this bit. 155 - */ 156 - return ct; 157 - } 158 - 159 - static void centaur_create_optimal_mcr(void) 160 - { 161 - int used; 162 - int i; 163 - 164 - /* 165 - * Allocate up to 6 mcrs to mark as much of ram as possible 166 - * as write combining and weak write ordered. 167 - * 168 - * To experiment with: Linux never uses stack operations for 169 - * mmio spaces so we could globally enable stack operation wc 170 - * 171 - * Load the registers with type 31 - full write combining, all 172 - * writes weakly ordered. 173 - */ 174 - used = centaur_mcr_compute(6, 31); 175 - 176 - /* 177 - * Wipe unused MCRs 178 - */ 179 - for (i = used; i < 8; i++) 180 - wrmsr(MSR_IDT_MCR0+i, 0, 0); 181 - } 182 - 183 - static void winchip2_create_optimal_mcr(void) 184 - { 185 - u32 lo, hi; 186 - int used; 187 - int i; 188 - 189 - /* 190 - * Allocate up to 6 mcrs to mark as much of ram as possible 191 - * as write combining, weak store ordered. 192 - * 193 - * Load the registers with type 25 194 - * 8 - weak write ordering 195 - * 16 - weak read ordering 196 - * 1 - write combining 197 - */ 198 - used = centaur_mcr_compute(6, 25); 199 - 200 - /* 201 - * Mark the registers we are using. 202 - */ 203 - rdmsr(MSR_IDT_MCR_CTRL, lo, hi); 204 - for (i = 0; i < used; i++) 205 - lo |= 1<<(9+i); 206 - wrmsr(MSR_IDT_MCR_CTRL, lo, hi); 207 - 208 - /* 209 - * Wipe unused MCRs 210 - */ 211 - 212 - for (i = used; i < 8; i++) 213 - wrmsr(MSR_IDT_MCR0+i, 0, 0); 214 - } 215 - 216 - /* 217 - * Handle the MCR key on the Winchip 2. 218 - */ 219 - static void winchip2_unprotect_mcr(void) 220 - { 221 - u32 lo, hi; 222 - u32 key; 223 - 224 - rdmsr(MSR_IDT_MCR_CTRL, lo, hi); 225 - lo &= ~0x1C0; /* blank bits 8-6 */ 226 - key = (lo>>17) & 7; 227 - lo |= key<<6; /* replace with unlock key */ 228 - wrmsr(MSR_IDT_MCR_CTRL, lo, hi); 229 - } 230 - 231 - static void winchip2_protect_mcr(void) 232 - { 233 - u32 lo, hi; 234 - 235 - rdmsr(MSR_IDT_MCR_CTRL, lo, hi); 236 - lo &= ~0x1C0; /* blank bits 8-6 */ 237 - wrmsr(MSR_IDT_MCR_CTRL, lo, hi); 238 - } 239 - #endif /* CONFIG_X86_OOSTORE */ 240 - 241 11 #define ACE_PRESENT (1 << 6) 242 12 #define ACE_ENABLED (1 << 7) 243 13 #define ACE_FCR (1 << 28) /* MSR_VIA_FCR */ ··· 132 362 fcr_clr = DPDC; 133 363 printk(KERN_NOTICE "Disabling bugged TSC.\n"); 134 364 clear_cpu_cap(c, X86_FEATURE_TSC); 135 - #ifdef CONFIG_X86_OOSTORE 136 - centaur_create_optimal_mcr(); 137 - /* 138 - * Enable: 139 - * write combining on non-stack, non-string 140 - * write combining on string, all types 141 - * weak write ordering 142 - * 143 - * The C6 original lacks weak read order 144 - * 145 - * Note 0x120 is write only on Winchip 1 146 - */ 147 - wrmsr(MSR_IDT_MCR_CTRL, 0x01F0001F, 0); 148 - #endif 149 365 break; 150 366 case 8: 151 367 switch (c->x86_mask) { ··· 148 392 fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK| 149 393 E2MMX|EAMD3D; 150 394 fcr_clr = DPDC; 151 - #ifdef CONFIG_X86_OOSTORE 152 - winchip2_unprotect_mcr(); 153 - winchip2_create_optimal_mcr(); 154 - rdmsr(MSR_IDT_MCR_CTRL, lo, hi); 155 - /* 156 - * Enable: 157 - * write combining on non-stack, non-string 158 - * write combining on string, all types 159 - * weak write ordering 160 - */ 161 - lo |= 31; 162 - wrmsr(MSR_IDT_MCR_CTRL, lo, hi); 163 - winchip2_protect_mcr(); 164 - #endif 165 395 break; 166 396 case 9: 167 397 name = "3"; 168 398 fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK| 169 399 E2MMX|EAMD3D; 170 400 fcr_clr = DPDC; 171 - #ifdef CONFIG_X86_OOSTORE 172 - winchip2_unprotect_mcr(); 173 - winchip2_create_optimal_mcr(); 174 - rdmsr(MSR_IDT_MCR_CTRL, lo, hi); 175 - /* 176 - * Enable: 177 - * write combining on non-stack, non-string 178 - * write combining on string, all types 179 - * weak write ordering 180 - */ 181 - lo |= 31; 182 - wrmsr(MSR_IDT_MCR_CTRL, lo, hi); 183 - winchip2_protect_mcr(); 184 - #endif 185 401 break; 186 402 default: 187 403 name = "??";
-4
arch/x86/um/asm/barrier.h
··· 40 40 #define smp_rmb() barrier() 41 41 #endif /* CONFIG_X86_PPRO_FENCE */ 42 42 43 - #ifdef CONFIG_X86_OOSTORE 44 - #define smp_wmb() wmb() 45 - #else /* CONFIG_X86_OOSTORE */ 46 43 #define smp_wmb() barrier() 47 - #endif /* CONFIG_X86_OOSTORE */ 48 44 49 45 #define smp_read_barrier_depends() read_barrier_depends() 50 46 #define set_mb(var, value) do { (void)xchg(&var, value); } while (0)