diff options
Diffstat (limited to 'arch/i386')
26 files changed, 558 insertions, 232 deletions
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index b008fb0cd7b7..f17bd1d2707e 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
@@ -37,6 +37,10 @@ config GENERIC_IOMAP | |||
37 | bool | 37 | bool |
38 | default y | 38 | default y |
39 | 39 | ||
40 | config GENERIC_HWEIGHT | ||
41 | bool | ||
42 | default y | ||
43 | |||
40 | config ARCH_MAY_HAVE_PC_FDC | 44 | config ARCH_MAY_HAVE_PC_FDC |
41 | bool | 45 | bool |
42 | default y | 46 | default y |
@@ -227,6 +231,15 @@ config SCHED_SMT | |||
227 | cost of slightly increased overhead in some places. If unsure say | 231 | cost of slightly increased overhead in some places. If unsure say |
228 | N here. | 232 | N here. |
229 | 233 | ||
234 | config SCHED_MC | ||
235 | bool "Multi-core scheduler support" | ||
236 | depends on SMP | ||
237 | default y | ||
238 | help | ||
239 | Multi-core scheduler support improves the CPU scheduler's decision | ||
240 | making when dealing with multi-core CPU chips at a cost of slightly | ||
241 | increased overhead in some places. If unsure say N here. | ||
242 | |||
230 | source "kernel/Kconfig.preempt" | 243 | source "kernel/Kconfig.preempt" |
231 | 244 | ||
232 | config X86_UP_APIC | 245 | config X86_UP_APIC |
diff --git a/arch/i386/Makefile b/arch/i386/Makefile index c848a5b30391..3e4adb1e2244 100644 --- a/arch/i386/Makefile +++ b/arch/i386/Makefile | |||
@@ -103,7 +103,7 @@ AFLAGS += $(mflags-y) | |||
103 | boot := arch/i386/boot | 103 | boot := arch/i386/boot |
104 | 104 | ||
105 | PHONY += zImage bzImage compressed zlilo bzlilo \ | 105 | PHONY += zImage bzImage compressed zlilo bzlilo \ |
106 | zdisk bzdisk fdimage fdimage144 fdimage288 install | 106 | zdisk bzdisk fdimage fdimage144 fdimage288 isoimage install |
107 | 107 | ||
108 | all: bzImage | 108 | all: bzImage |
109 | 109 | ||
@@ -122,7 +122,7 @@ zlilo bzlilo: vmlinux | |||
122 | zdisk bzdisk: vmlinux | 122 | zdisk bzdisk: vmlinux |
123 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) zdisk | 123 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) zdisk |
124 | 124 | ||
125 | fdimage fdimage144 fdimage288: vmlinux | 125 | fdimage fdimage144 fdimage288 isoimage: vmlinux |
126 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@ | 126 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@ |
127 | 127 | ||
128 | install: | 128 | install: |
@@ -139,6 +139,9 @@ define archhelp | |||
139 | echo ' install to $$(INSTALL_PATH) and run lilo' | 139 | echo ' install to $$(INSTALL_PATH) and run lilo' |
140 | echo ' bzdisk - Create a boot floppy in /dev/fd0' | 140 | echo ' bzdisk - Create a boot floppy in /dev/fd0' |
141 | echo ' fdimage - Create a boot floppy image' | 141 | echo ' fdimage - Create a boot floppy image' |
142 | echo ' isoimage - Create a boot CD-ROM image' | ||
142 | endef | 143 | endef |
143 | 144 | ||
144 | CLEAN_FILES += arch/$(ARCH)/boot/fdimage arch/$(ARCH)/boot/mtools.conf | 145 | CLEAN_FILES += arch/$(ARCH)/boot/fdimage \ |
146 | arch/$(ARCH)/boot/image.iso \ | ||
147 | arch/$(ARCH)/boot/mtools.conf | ||
diff --git a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile index f136752563b1..33e55476381b 100644 --- a/arch/i386/boot/Makefile +++ b/arch/i386/boot/Makefile | |||
@@ -62,8 +62,12 @@ $(obj)/setup $(obj)/bootsect: %: %.o FORCE | |||
62 | $(obj)/compressed/vmlinux: FORCE | 62 | $(obj)/compressed/vmlinux: FORCE |
63 | $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ | 63 | $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ |
64 | 64 | ||
65 | # Set this if you want to pass append arguments to the zdisk/fdimage kernel | 65 | # Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel |
66 | FDARGS = | 66 | FDARGS = |
67 | # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel | ||
68 | FDINITRD = | ||
69 | |||
70 | image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,) | ||
67 | 71 | ||
68 | $(obj)/mtools.conf: $(src)/mtools.conf.in | 72 | $(obj)/mtools.conf: $(src)/mtools.conf.in |
69 | sed -e 's|@OBJ@|$(obj)|g' < $< > $@ | 73 | sed -e 's|@OBJ@|$(obj)|g' < $< > $@ |
@@ -72,8 +76,11 @@ $(obj)/mtools.conf: $(src)/mtools.conf.in | |||
72 | zdisk: $(BOOTIMAGE) $(obj)/mtools.conf | 76 | zdisk: $(BOOTIMAGE) $(obj)/mtools.conf |
73 | MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync | 77 | MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync |
74 | syslinux /dev/fd0 ; sync | 78 | syslinux /dev/fd0 ; sync |
75 | echo 'default linux $(FDARGS)' | \ | 79 | echo '$(image_cmdline)' | \ |
76 | MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg | 80 | MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg |
81 | if [ -f '$(FDINITRD)' ] ; then \ | ||
82 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \ | ||
83 | fi | ||
77 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync | 84 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync |
78 | 85 | ||
79 | # These require being root or having syslinux 2.02 or higher installed | 86 | # These require being root or having syslinux 2.02 or higher installed |
@@ -81,18 +88,39 @@ fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf | |||
81 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440 | 88 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440 |
82 | MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync | 89 | MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync |
83 | syslinux $(obj)/fdimage ; sync | 90 | syslinux $(obj)/fdimage ; sync |
84 | echo 'default linux $(FDARGS)' | \ | 91 | echo '$(image_cmdline)' | \ |
85 | MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg | 92 | MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg |
93 | if [ -f '$(FDINITRD)' ] ; then \ | ||
94 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \ | ||
95 | fi | ||
86 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync | 96 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync |
87 | 97 | ||
88 | fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf | 98 | fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf |
89 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880 | 99 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880 |
90 | MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync | 100 | MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync |
91 | syslinux $(obj)/fdimage ; sync | 101 | syslinux $(obj)/fdimage ; sync |
92 | echo 'default linux $(FDARGS)' | \ | 102 | echo '$(image_cmdline)' | \ |
93 | MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg | 103 | MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg |
104 | if [ -f '$(FDINITRD)' ] ; then \ | ||
105 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \ | ||
106 | fi | ||
94 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync | 107 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync |
95 | 108 | ||
109 | isoimage: $(BOOTIMAGE) | ||
110 | -rm -rf $(obj)/isoimage | ||
111 | mkdir $(obj)/isoimage | ||
112 | cp `echo /usr/lib*/syslinux/isolinux.bin | awk '{ print $1; }'` \ | ||
113 | $(obj)/isoimage | ||
114 | cp $(BOOTIMAGE) $(obj)/isoimage/linux | ||
115 | echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg | ||
116 | if [ -f '$(FDINITRD)' ] ; then \ | ||
117 | cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \ | ||
118 | fi | ||
119 | mkisofs -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \ | ||
120 | -no-emul-boot -boot-load-size 4 -boot-info-table \ | ||
121 | $(obj)/isoimage | ||
122 | rm -rf $(obj)/isoimage | ||
123 | |||
96 | zlilo: $(BOOTIMAGE) | 124 | zlilo: $(BOOTIMAGE) |
97 | if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi | 125 | if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi |
98 | if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi | 126 | if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi |
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S index 2ac40c8244c4..0000a2674537 100644 --- a/arch/i386/boot/video.S +++ b/arch/i386/boot/video.S | |||
@@ -1924,6 +1924,7 @@ skip10: movb %ah, %al | |||
1924 | ret | 1924 | ret |
1925 | 1925 | ||
1926 | store_edid: | 1926 | store_edid: |
1927 | #ifdef CONFIG_FB_FIRMWARE_EDID | ||
1927 | pushw %es # just save all registers | 1928 | pushw %es # just save all registers |
1928 | pushw %ax | 1929 | pushw %ax |
1929 | pushw %bx | 1930 | pushw %bx |
@@ -1954,6 +1955,7 @@ store_edid: | |||
1954 | popw %bx | 1955 | popw %bx |
1955 | popw %ax | 1956 | popw %ax |
1956 | popw %es | 1957 | popw %es |
1958 | #endif | ||
1957 | ret | 1959 | ret |
1958 | 1960 | ||
1959 | # VIDEO_SELECT-only variables | 1961 | # VIDEO_SELECT-only variables |
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index f1a21945963d..033066176b3e 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c | |||
@@ -668,10 +668,10 @@ unsigned long __init acpi_find_rsdp(void) | |||
668 | unsigned long rsdp_phys = 0; | 668 | unsigned long rsdp_phys = 0; |
669 | 669 | ||
670 | if (efi_enabled) { | 670 | if (efi_enabled) { |
671 | if (efi.acpi20) | 671 | if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) |
672 | return __pa(efi.acpi20); | 672 | return efi.acpi20; |
673 | else if (efi.acpi) | 673 | else if (efi.acpi != EFI_INVALID_TABLE_ADDR) |
674 | return __pa(efi.acpi); | 674 | return efi.acpi; |
675 | } | 675 | } |
676 | /* | 676 | /* |
677 | * Scan memory looking for the RSDP signature. First search EBDA (low | 677 | * Scan memory looking for the RSDP signature. First search EBDA (low |
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 7e3d6b6a4e96..a06a49075f10 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -266,7 +266,7 @@ static void __init early_cpu_detect(void) | |||
266 | void __cpuinit generic_identify(struct cpuinfo_x86 * c) | 266 | void __cpuinit generic_identify(struct cpuinfo_x86 * c) |
267 | { | 267 | { |
268 | u32 tfms, xlvl; | 268 | u32 tfms, xlvl; |
269 | int junk; | 269 | int ebx; |
270 | 270 | ||
271 | if (have_cpuid_p()) { | 271 | if (have_cpuid_p()) { |
272 | /* Get vendor name */ | 272 | /* Get vendor name */ |
@@ -282,7 +282,7 @@ void __cpuinit generic_identify(struct cpuinfo_x86 * c) | |||
282 | /* Intel-defined flags: level 0x00000001 */ | 282 | /* Intel-defined flags: level 0x00000001 */ |
283 | if ( c->cpuid_level >= 0x00000001 ) { | 283 | if ( c->cpuid_level >= 0x00000001 ) { |
284 | u32 capability, excap; | 284 | u32 capability, excap; |
285 | cpuid(0x00000001, &tfms, &junk, &excap, &capability); | 285 | cpuid(0x00000001, &tfms, &ebx, &excap, &capability); |
286 | c->x86_capability[0] = capability; | 286 | c->x86_capability[0] = capability; |
287 | c->x86_capability[4] = excap; | 287 | c->x86_capability[4] = excap; |
288 | c->x86 = (tfms >> 8) & 15; | 288 | c->x86 = (tfms >> 8) & 15; |
@@ -292,6 +292,11 @@ void __cpuinit generic_identify(struct cpuinfo_x86 * c) | |||
292 | if (c->x86 >= 0x6) | 292 | if (c->x86 >= 0x6) |
293 | c->x86_model += ((tfms >> 16) & 0xF) << 4; | 293 | c->x86_model += ((tfms >> 16) & 0xF) << 4; |
294 | c->x86_mask = tfms & 15; | 294 | c->x86_mask = tfms & 15; |
295 | #ifdef CONFIG_SMP | ||
296 | c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0); | ||
297 | #else | ||
298 | c->apicid = (ebx >> 24) & 0xFF; | ||
299 | #endif | ||
295 | } else { | 300 | } else { |
296 | /* Have CPUID level 0 only - unheard of */ | 301 | /* Have CPUID level 0 only - unheard of */ |
297 | c->x86 = 4; | 302 | c->x86 = 4; |
@@ -474,7 +479,6 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
474 | 479 | ||
475 | cpuid(1, &eax, &ebx, &ecx, &edx); | 480 | cpuid(1, &eax, &ebx, &ecx, &edx); |
476 | 481 | ||
477 | c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0); | ||
478 | 482 | ||
479 | if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY)) | 483 | if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY)) |
480 | return; | 484 | return; |
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index e5bc06480ff9..712a26bd4457 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -40,6 +40,7 @@ | |||
40 | 40 | ||
41 | #ifdef CONFIG_X86_POWERNOW_K8_ACPI | 41 | #ifdef CONFIG_X86_POWERNOW_K8_ACPI |
42 | #include <linux/acpi.h> | 42 | #include <linux/acpi.h> |
43 | #include <linux/mutex.h> | ||
43 | #include <acpi/processor.h> | 44 | #include <acpi/processor.h> |
44 | #endif | 45 | #endif |
45 | 46 | ||
@@ -49,7 +50,7 @@ | |||
49 | #include "powernow-k8.h" | 50 | #include "powernow-k8.h" |
50 | 51 | ||
51 | /* serialize freq changes */ | 52 | /* serialize freq changes */ |
52 | static DECLARE_MUTEX(fidvid_sem); | 53 | static DEFINE_MUTEX(fidvid_mutex); |
53 | 54 | ||
54 | static struct powernow_k8_data *powernow_data[NR_CPUS]; | 55 | static struct powernow_k8_data *powernow_data[NR_CPUS]; |
55 | 56 | ||
@@ -943,17 +944,17 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
943 | if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate)) | 944 | if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate)) |
944 | goto err_out; | 945 | goto err_out; |
945 | 946 | ||
946 | down(&fidvid_sem); | 947 | mutex_lock(&fidvid_mutex); |
947 | 948 | ||
948 | powernow_k8_acpi_pst_values(data, newstate); | 949 | powernow_k8_acpi_pst_values(data, newstate); |
949 | 950 | ||
950 | if (transition_frequency(data, newstate)) { | 951 | if (transition_frequency(data, newstate)) { |
951 | printk(KERN_ERR PFX "transition frequency failed\n"); | 952 | printk(KERN_ERR PFX "transition frequency failed\n"); |
952 | ret = 1; | 953 | ret = 1; |
953 | up(&fidvid_sem); | 954 | mutex_unlock(&fidvid_mutex); |
954 | goto err_out; | 955 | goto err_out; |
955 | } | 956 | } |
956 | up(&fidvid_sem); | 957 | mutex_unlock(&fidvid_mutex); |
957 | 958 | ||
958 | pol->cur = find_khz_freq_from_fid(data->currfid); | 959 | pol->cur = find_khz_freq_from_fid(data->currfid); |
959 | ret = 0; | 960 | ret = 0; |
@@ -1094,10 +1095,15 @@ static int __devexit powernowk8_cpu_exit (struct cpufreq_policy *pol) | |||
1094 | 1095 | ||
1095 | static unsigned int powernowk8_get (unsigned int cpu) | 1096 | static unsigned int powernowk8_get (unsigned int cpu) |
1096 | { | 1097 | { |
1097 | struct powernow_k8_data *data = powernow_data[cpu]; | 1098 | struct powernow_k8_data *data; |
1098 | cpumask_t oldmask = current->cpus_allowed; | 1099 | cpumask_t oldmask = current->cpus_allowed; |
1099 | unsigned int khz = 0; | 1100 | unsigned int khz = 0; |
1100 | 1101 | ||
1102 | data = powernow_data[first_cpu(cpu_core_map[cpu])]; | ||
1103 | |||
1104 | if (!data) | ||
1105 | return -EINVAL; | ||
1106 | |||
1101 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | 1107 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); |
1102 | if (smp_processor_id() != cpu) { | 1108 | if (smp_processor_id() != cpu) { |
1103 | printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu); | 1109 | printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu); |
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h index 00ea899c17e1..79a7c5c87edc 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h | |||
@@ -182,10 +182,6 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid); | |||
182 | 182 | ||
183 | static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); | 183 | static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); |
184 | 184 | ||
185 | #ifndef for_each_cpu_mask | ||
186 | #define for_each_cpu_mask(i,mask) for (i=0;i<1;i++) | ||
187 | #endif | ||
188 | |||
189 | #ifdef CONFIG_SMP | 185 | #ifdef CONFIG_SMP |
190 | static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) | 186 | static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) |
191 | { | 187 | { |
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c index ce61921369e5..9df87b03612c 100644 --- a/arch/i386/kernel/cpu/intel_cacheinfo.c +++ b/arch/i386/kernel/cpu/intel_cacheinfo.c | |||
@@ -173,6 +173,10 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) | |||
173 | unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */ | 173 | unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */ |
174 | unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */ | 174 | unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */ |
175 | unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */ | 175 | unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */ |
176 | unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb; | ||
177 | #ifdef CONFIG_SMP | ||
178 | unsigned int cpu = (c == &boot_cpu_data) ? 0 : (c - cpu_data); | ||
179 | #endif | ||
176 | 180 | ||
177 | if (c->cpuid_level > 3) { | 181 | if (c->cpuid_level > 3) { |
178 | static int is_initialized; | 182 | static int is_initialized; |
@@ -205,9 +209,15 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) | |||
205 | break; | 209 | break; |
206 | case 2: | 210 | case 2: |
207 | new_l2 = this_leaf.size/1024; | 211 | new_l2 = this_leaf.size/1024; |
212 | num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing; | ||
213 | index_msb = get_count_order(num_threads_sharing); | ||
214 | l2_id = c->apicid >> index_msb; | ||
208 | break; | 215 | break; |
209 | case 3: | 216 | case 3: |
210 | new_l3 = this_leaf.size/1024; | 217 | new_l3 = this_leaf.size/1024; |
218 | num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing; | ||
219 | index_msb = get_count_order(num_threads_sharing); | ||
220 | l3_id = c->apicid >> index_msb; | ||
211 | break; | 221 | break; |
212 | default: | 222 | default: |
213 | break; | 223 | break; |
@@ -215,11 +225,19 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) | |||
215 | } | 225 | } |
216 | } | 226 | } |
217 | } | 227 | } |
218 | if (c->cpuid_level > 1) { | 228 | /* |
229 | * Don't use cpuid2 if cpuid4 is supported. For P4, we use cpuid2 for | ||
230 | * trace cache | ||
231 | */ | ||
232 | if ((num_cache_leaves == 0 || c->x86 == 15) && c->cpuid_level > 1) { | ||
219 | /* supports eax=2 call */ | 233 | /* supports eax=2 call */ |
220 | int i, j, n; | 234 | int i, j, n; |
221 | int regs[4]; | 235 | int regs[4]; |
222 | unsigned char *dp = (unsigned char *)regs; | 236 | unsigned char *dp = (unsigned char *)regs; |
237 | int only_trace = 0; | ||
238 | |||
239 | if (num_cache_leaves != 0 && c->x86 == 15) | ||
240 | only_trace = 1; | ||
223 | 241 | ||
224 | /* Number of times to iterate */ | 242 | /* Number of times to iterate */ |
225 | n = cpuid_eax(2) & 0xFF; | 243 | n = cpuid_eax(2) & 0xFF; |
@@ -241,6 +259,8 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) | |||
241 | while (cache_table[k].descriptor != 0) | 259 | while (cache_table[k].descriptor != 0) |
242 | { | 260 | { |
243 | if (cache_table[k].descriptor == des) { | 261 | if (cache_table[k].descriptor == des) { |
262 | if (only_trace && cache_table[k].cache_type != LVL_TRACE) | ||
263 | break; | ||
244 | switch (cache_table[k].cache_type) { | 264 | switch (cache_table[k].cache_type) { |
245 | case LVL_1_INST: | 265 | case LVL_1_INST: |
246 | l1i += cache_table[k].size; | 266 | l1i += cache_table[k].size; |
@@ -266,34 +286,45 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) | |||
266 | } | 286 | } |
267 | } | 287 | } |
268 | } | 288 | } |
289 | } | ||
269 | 290 | ||
270 | if (new_l1d) | 291 | if (new_l1d) |
271 | l1d = new_l1d; | 292 | l1d = new_l1d; |
272 | 293 | ||
273 | if (new_l1i) | 294 | if (new_l1i) |
274 | l1i = new_l1i; | 295 | l1i = new_l1i; |
275 | 296 | ||
276 | if (new_l2) | 297 | if (new_l2) { |
277 | l2 = new_l2; | 298 | l2 = new_l2; |
299 | #ifdef CONFIG_SMP | ||
300 | cpu_llc_id[cpu] = l2_id; | ||
301 | #endif | ||
302 | } | ||
278 | 303 | ||
279 | if (new_l3) | 304 | if (new_l3) { |
280 | l3 = new_l3; | 305 | l3 = new_l3; |
306 | #ifdef CONFIG_SMP | ||
307 | cpu_llc_id[cpu] = l3_id; | ||
308 | #endif | ||
309 | } | ||
281 | 310 | ||
282 | if ( trace ) | 311 | if (trace) |
283 | printk (KERN_INFO "CPU: Trace cache: %dK uops", trace); | 312 | printk (KERN_INFO "CPU: Trace cache: %dK uops", trace); |
284 | else if ( l1i ) | 313 | else if ( l1i ) |
285 | printk (KERN_INFO "CPU: L1 I cache: %dK", l1i); | 314 | printk (KERN_INFO "CPU: L1 I cache: %dK", l1i); |
286 | if ( l1d ) | ||
287 | printk(", L1 D cache: %dK\n", l1d); | ||
288 | else | ||
289 | printk("\n"); | ||
290 | if ( l2 ) | ||
291 | printk(KERN_INFO "CPU: L2 cache: %dK\n", l2); | ||
292 | if ( l3 ) | ||
293 | printk(KERN_INFO "CPU: L3 cache: %dK\n", l3); | ||
294 | 315 | ||
295 | c->x86_cache_size = l3 ? l3 : (l2 ? l2 : (l1i+l1d)); | 316 | if (l1d) |
296 | } | 317 | printk(", L1 D cache: %dK\n", l1d); |
318 | else | ||
319 | printk("\n"); | ||
320 | |||
321 | if (l2) | ||
322 | printk(KERN_INFO "CPU: L2 cache: %dK\n", l2); | ||
323 | |||
324 | if (l3) | ||
325 | printk(KERN_INFO "CPU: L3 cache: %dK\n", l3); | ||
326 | |||
327 | c->x86_cache_size = l3 ? l3 : (l2 ? l2 : (l1i+l1d)); | ||
297 | 328 | ||
298 | return l2; | 329 | return l2; |
299 | } | 330 | } |
diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c index 3b4618bed70d..fff90bda4733 100644 --- a/arch/i386/kernel/cpu/mtrr/main.c +++ b/arch/i386/kernel/cpu/mtrr/main.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
37 | #include <linux/smp.h> | 37 | #include <linux/smp.h> |
38 | #include <linux/cpu.h> | 38 | #include <linux/cpu.h> |
39 | #include <linux/mutex.h> | ||
39 | 40 | ||
40 | #include <asm/mtrr.h> | 41 | #include <asm/mtrr.h> |
41 | 42 | ||
@@ -47,7 +48,7 @@ | |||
47 | u32 num_var_ranges = 0; | 48 | u32 num_var_ranges = 0; |
48 | 49 | ||
49 | unsigned int *usage_table; | 50 | unsigned int *usage_table; |
50 | static DECLARE_MUTEX(mtrr_sem); | 51 | static DEFINE_MUTEX(mtrr_mutex); |
51 | 52 | ||
52 | u32 size_or_mask, size_and_mask; | 53 | u32 size_or_mask, size_and_mask; |
53 | 54 | ||
@@ -333,7 +334,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, | |||
333 | /* No CPU hotplug when we change MTRR entries */ | 334 | /* No CPU hotplug when we change MTRR entries */ |
334 | lock_cpu_hotplug(); | 335 | lock_cpu_hotplug(); |
335 | /* Search for existing MTRR */ | 336 | /* Search for existing MTRR */ |
336 | down(&mtrr_sem); | 337 | mutex_lock(&mtrr_mutex); |
337 | for (i = 0; i < num_var_ranges; ++i) { | 338 | for (i = 0; i < num_var_ranges; ++i) { |
338 | mtrr_if->get(i, &lbase, &lsize, <ype); | 339 | mtrr_if->get(i, &lbase, &lsize, <ype); |
339 | if (base >= lbase + lsize) | 340 | if (base >= lbase + lsize) |
@@ -371,7 +372,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, | |||
371 | printk(KERN_INFO "mtrr: no more MTRRs available\n"); | 372 | printk(KERN_INFO "mtrr: no more MTRRs available\n"); |
372 | error = i; | 373 | error = i; |
373 | out: | 374 | out: |
374 | up(&mtrr_sem); | 375 | mutex_unlock(&mtrr_mutex); |
375 | unlock_cpu_hotplug(); | 376 | unlock_cpu_hotplug(); |
376 | return error; | 377 | return error; |
377 | } | 378 | } |
@@ -464,7 +465,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size) | |||
464 | max = num_var_ranges; | 465 | max = num_var_ranges; |
465 | /* No CPU hotplug when we change MTRR entries */ | 466 | /* No CPU hotplug when we change MTRR entries */ |
466 | lock_cpu_hotplug(); | 467 | lock_cpu_hotplug(); |
467 | down(&mtrr_sem); | 468 | mutex_lock(&mtrr_mutex); |
468 | if (reg < 0) { | 469 | if (reg < 0) { |
469 | /* Search for existing MTRR */ | 470 | /* Search for existing MTRR */ |
470 | for (i = 0; i < max; ++i) { | 471 | for (i = 0; i < max; ++i) { |
@@ -503,7 +504,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size) | |||
503 | set_mtrr(reg, 0, 0, 0); | 504 | set_mtrr(reg, 0, 0, 0); |
504 | error = reg; | 505 | error = reg; |
505 | out: | 506 | out: |
506 | up(&mtrr_sem); | 507 | mutex_unlock(&mtrr_mutex); |
507 | unlock_cpu_hotplug(); | 508 | unlock_cpu_hotplug(); |
508 | return error; | 509 | return error; |
509 | } | 510 | } |
@@ -685,7 +686,7 @@ void mtrr_ap_init(void) | |||
685 | if (!mtrr_if || !use_intel()) | 686 | if (!mtrr_if || !use_intel()) |
686 | return; | 687 | return; |
687 | /* | 688 | /* |
688 | * Ideally we should hold mtrr_sem here to avoid mtrr entries changed, | 689 | * Ideally we should hold mtrr_mutex here to avoid mtrr entries changed, |
689 | * but this routine will be called in cpu boot time, holding the lock | 690 | * but this routine will be called in cpu boot time, holding the lock |
690 | * breaks it. This routine is called in two cases: 1.very earily time | 691 | * breaks it. This routine is called in two cases: 1.very earily time |
691 | * of software resume, when there absolutely isn't mtrr entry changes; | 692 | * of software resume, when there absolutely isn't mtrr entry changes; |
diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c index ebc8dc116c43..5efceebc48dc 100644 --- a/arch/i386/kernel/dmi_scan.c +++ b/arch/i386/kernel/dmi_scan.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/init.h> | 3 | #include <linux/init.h> |
4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
5 | #include <linux/dmi.h> | 5 | #include <linux/dmi.h> |
6 | #include <linux/efi.h> | ||
6 | #include <linux/bootmem.h> | 7 | #include <linux/bootmem.h> |
7 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
8 | #include <asm/dmi.h> | 9 | #include <asm/dmi.h> |
@@ -185,47 +186,72 @@ static void __init dmi_decode(struct dmi_header *dm) | |||
185 | } | 186 | } |
186 | } | 187 | } |
187 | 188 | ||
188 | void __init dmi_scan_machine(void) | 189 | static int __init dmi_present(char __iomem *p) |
189 | { | 190 | { |
190 | u8 buf[15]; | 191 | u8 buf[15]; |
191 | char __iomem *p, *q; | 192 | memcpy_fromio(buf, p, 15); |
193 | if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) { | ||
194 | u16 num = (buf[13] << 8) | buf[12]; | ||
195 | u16 len = (buf[7] << 8) | buf[6]; | ||
196 | u32 base = (buf[11] << 24) | (buf[10] << 16) | | ||
197 | (buf[9] << 8) | buf[8]; | ||
192 | 198 | ||
193 | /* | 199 | /* |
194 | * no iounmap() for that ioremap(); it would be a no-op, but it's | 200 | * DMI version 0.0 means that the real version is taken from |
195 | * so early in setup that sucker gets confused into doing what | 201 | * the SMBIOS version, which we don't know at this point. |
196 | * it shouldn't if we actually call it. | 202 | */ |
197 | */ | 203 | if (buf[14] != 0) |
198 | p = ioremap(0xF0000, 0x10000); | 204 | printk(KERN_INFO "DMI %d.%d present.\n", |
199 | if (p == NULL) | 205 | buf[14] >> 4, buf[14] & 0xF); |
200 | goto out; | 206 | else |
201 | 207 | printk(KERN_INFO "DMI present.\n"); | |
202 | for (q = p; q < p + 0x10000; q += 16) { | 208 | if (dmi_table(base,len, num, dmi_decode) == 0) |
203 | memcpy_fromio(buf, q, 15); | 209 | return 0; |
204 | if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) { | 210 | } |
205 | u16 num = (buf[13] << 8) | buf[12]; | 211 | return 1; |
206 | u16 len = (buf[7] << 8) | buf[6]; | 212 | } |
207 | u32 base = (buf[11] << 24) | (buf[10] << 16) | | ||
208 | (buf[9] << 8) | buf[8]; | ||
209 | |||
210 | /* | ||
211 | * DMI version 0.0 means that the real version is taken from | ||
212 | * the SMBIOS version, which we don't know at this point. | ||
213 | */ | ||
214 | if (buf[14] != 0) | ||
215 | printk(KERN_INFO "DMI %d.%d present.\n", | ||
216 | buf[14] >> 4, buf[14] & 0xF); | ||
217 | else | ||
218 | printk(KERN_INFO "DMI present.\n"); | ||
219 | 213 | ||
220 | if (dmi_table(base,len, num, dmi_decode) == 0) | 214 | void __init dmi_scan_machine(void) |
215 | { | ||
216 | char __iomem *p, *q; | ||
217 | int rc; | ||
218 | |||
219 | if (efi_enabled) { | ||
220 | if (efi.smbios == EFI_INVALID_TABLE_ADDR) | ||
221 | goto out; | ||
222 | |||
223 | /* This is called as a core_initcall() because it isn't | ||
224 | * needed during early boot. This also means we can | ||
225 | * iounmap the space when we're done with it. | ||
226 | */ | ||
227 | p = dmi_ioremap(efi.smbios, 32); | ||
228 | if (p == NULL) | ||
229 | goto out; | ||
230 | |||
231 | rc = dmi_present(p + 0x10); /* offset of _DMI_ string */ | ||
232 | dmi_iounmap(p, 32); | ||
233 | if (!rc) | ||
234 | return; | ||
235 | } | ||
236 | else { | ||
237 | /* | ||
238 | * no iounmap() for that ioremap(); it would be a no-op, but | ||
239 | * it's so early in setup that sucker gets confused into doing | ||
240 | * what it shouldn't if we actually call it. | ||
241 | */ | ||
242 | p = dmi_ioremap(0xF0000, 0x10000); | ||
243 | if (p == NULL) | ||
244 | goto out; | ||
245 | |||
246 | for (q = p; q < p + 0x10000; q += 16) { | ||
247 | rc = dmi_present(q); | ||
248 | if (!rc) | ||
221 | return; | 249 | return; |
222 | } | 250 | } |
223 | } | 251 | } |
224 | 252 | out: printk(KERN_INFO "DMI not present or invalid.\n"); | |
225 | out: printk(KERN_INFO "DMI not present or invalid.\n"); | ||
226 | } | 253 | } |
227 | 254 | ||
228 | |||
229 | /** | 255 | /** |
230 | * dmi_check_system - check system DMI data | 256 | * dmi_check_system - check system DMI data |
231 | * @list: array of dmi_system_id structures to match against | 257 | * @list: array of dmi_system_id structures to match against |
diff --git a/arch/i386/kernel/efi.c b/arch/i386/kernel/efi.c index 7ec6cfa01fb3..9202b67c4b2e 100644 --- a/arch/i386/kernel/efi.c +++ b/arch/i386/kernel/efi.c | |||
@@ -361,7 +361,7 @@ void __init efi_init(void) | |||
361 | */ | 361 | */ |
362 | c16 = (efi_char16_t *) boot_ioremap(efi.systab->fw_vendor, 2); | 362 | c16 = (efi_char16_t *) boot_ioremap(efi.systab->fw_vendor, 2); |
363 | if (c16) { | 363 | if (c16) { |
364 | for (i = 0; i < sizeof(vendor) && *c16; ++i) | 364 | for (i = 0; i < (sizeof(vendor) - 1) && *c16; ++i) |
365 | vendor[i] = *c16++; | 365 | vendor[i] = *c16++; |
366 | vendor[i] = '\0'; | 366 | vendor[i] = '\0'; |
367 | } else | 367 | } else |
@@ -381,29 +381,38 @@ void __init efi_init(void) | |||
381 | if (config_tables == NULL) | 381 | if (config_tables == NULL) |
382 | printk(KERN_ERR PFX "Could not map EFI Configuration Table!\n"); | 382 | printk(KERN_ERR PFX "Could not map EFI Configuration Table!\n"); |
383 | 383 | ||
384 | efi.mps = EFI_INVALID_TABLE_ADDR; | ||
385 | efi.acpi = EFI_INVALID_TABLE_ADDR; | ||
386 | efi.acpi20 = EFI_INVALID_TABLE_ADDR; | ||
387 | efi.smbios = EFI_INVALID_TABLE_ADDR; | ||
388 | efi.sal_systab = EFI_INVALID_TABLE_ADDR; | ||
389 | efi.boot_info = EFI_INVALID_TABLE_ADDR; | ||
390 | efi.hcdp = EFI_INVALID_TABLE_ADDR; | ||
391 | efi.uga = EFI_INVALID_TABLE_ADDR; | ||
392 | |||
384 | for (i = 0; i < num_config_tables; i++) { | 393 | for (i = 0; i < num_config_tables; i++) { |
385 | if (efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID) == 0) { | 394 | if (efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID) == 0) { |
386 | efi.mps = (void *)config_tables[i].table; | 395 | efi.mps = config_tables[i].table; |
387 | printk(KERN_INFO " MPS=0x%lx ", config_tables[i].table); | 396 | printk(KERN_INFO " MPS=0x%lx ", config_tables[i].table); |
388 | } else | 397 | } else |
389 | if (efi_guidcmp(config_tables[i].guid, ACPI_20_TABLE_GUID) == 0) { | 398 | if (efi_guidcmp(config_tables[i].guid, ACPI_20_TABLE_GUID) == 0) { |
390 | efi.acpi20 = __va(config_tables[i].table); | 399 | efi.acpi20 = config_tables[i].table; |
391 | printk(KERN_INFO " ACPI 2.0=0x%lx ", config_tables[i].table); | 400 | printk(KERN_INFO " ACPI 2.0=0x%lx ", config_tables[i].table); |
392 | } else | 401 | } else |
393 | if (efi_guidcmp(config_tables[i].guid, ACPI_TABLE_GUID) == 0) { | 402 | if (efi_guidcmp(config_tables[i].guid, ACPI_TABLE_GUID) == 0) { |
394 | efi.acpi = __va(config_tables[i].table); | 403 | efi.acpi = config_tables[i].table; |
395 | printk(KERN_INFO " ACPI=0x%lx ", config_tables[i].table); | 404 | printk(KERN_INFO " ACPI=0x%lx ", config_tables[i].table); |
396 | } else | 405 | } else |
397 | if (efi_guidcmp(config_tables[i].guid, SMBIOS_TABLE_GUID) == 0) { | 406 | if (efi_guidcmp(config_tables[i].guid, SMBIOS_TABLE_GUID) == 0) { |
398 | efi.smbios = (void *) config_tables[i].table; | 407 | efi.smbios = config_tables[i].table; |
399 | printk(KERN_INFO " SMBIOS=0x%lx ", config_tables[i].table); | 408 | printk(KERN_INFO " SMBIOS=0x%lx ", config_tables[i].table); |
400 | } else | 409 | } else |
401 | if (efi_guidcmp(config_tables[i].guid, HCDP_TABLE_GUID) == 0) { | 410 | if (efi_guidcmp(config_tables[i].guid, HCDP_TABLE_GUID) == 0) { |
402 | efi.hcdp = (void *)config_tables[i].table; | 411 | efi.hcdp = config_tables[i].table; |
403 | printk(KERN_INFO " HCDP=0x%lx ", config_tables[i].table); | 412 | printk(KERN_INFO " HCDP=0x%lx ", config_tables[i].table); |
404 | } else | 413 | } else |
405 | if (efi_guidcmp(config_tables[i].guid, UGA_IO_PROTOCOL_GUID) == 0) { | 414 | if (efi_guidcmp(config_tables[i].guid, UGA_IO_PROTOCOL_GUID) == 0) { |
406 | efi.uga = (void *)config_tables[i].table; | 415 | efi.uga = config_tables[i].table; |
407 | printk(KERN_INFO " UGA=0x%lx ", config_tables[i].table); | 416 | printk(KERN_INFO " UGA=0x%lx ", config_tables[i].table); |
408 | } | 417 | } |
409 | } | 418 | } |
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 311b4e7266f1..3b329af4afc5 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c | |||
@@ -381,7 +381,7 @@ static void do_irq_balance(void) | |||
381 | unsigned long imbalance = 0; | 381 | unsigned long imbalance = 0; |
382 | cpumask_t allowed_mask, target_cpu_mask, tmp; | 382 | cpumask_t allowed_mask, target_cpu_mask, tmp; |
383 | 383 | ||
384 | for_each_cpu(i) { | 384 | for_each_possible_cpu(i) { |
385 | int package_index; | 385 | int package_index; |
386 | CPU_IRQ(i) = 0; | 386 | CPU_IRQ(i) = 0; |
387 | if (!cpu_online(i)) | 387 | if (!cpu_online(i)) |
@@ -632,7 +632,7 @@ static int __init balanced_irq_init(void) | |||
632 | else | 632 | else |
633 | printk(KERN_ERR "balanced_irq_init: failed to spawn balanced_irq"); | 633 | printk(KERN_ERR "balanced_irq_init: failed to spawn balanced_irq"); |
634 | failed: | 634 | failed: |
635 | for_each_cpu(i) { | 635 | for_each_possible_cpu(i) { |
636 | kfree(irq_cpu_data[i].irq_delta); | 636 | kfree(irq_cpu_data[i].irq_delta); |
637 | irq_cpu_data[i].irq_delta = NULL; | 637 | irq_cpu_data[i].irq_delta = NULL; |
638 | kfree(irq_cpu_data[i].last_irq); | 638 | kfree(irq_cpu_data[i].last_irq); |
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index 7a59050242a7..f19768789e8a 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c | |||
@@ -35,12 +35,56 @@ | |||
35 | #include <asm/cacheflush.h> | 35 | #include <asm/cacheflush.h> |
36 | #include <asm/kdebug.h> | 36 | #include <asm/kdebug.h> |
37 | #include <asm/desc.h> | 37 | #include <asm/desc.h> |
38 | #include <asm/uaccess.h> | ||
38 | 39 | ||
39 | void jprobe_return_end(void); | 40 | void jprobe_return_end(void); |
40 | 41 | ||
41 | DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; | 42 | DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; |
42 | DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | 43 | DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); |
43 | 44 | ||
45 | /* insert a jmp code */ | ||
46 | static inline void set_jmp_op(void *from, void *to) | ||
47 | { | ||
48 | struct __arch_jmp_op { | ||
49 | char op; | ||
50 | long raddr; | ||
51 | } __attribute__((packed)) *jop; | ||
52 | jop = (struct __arch_jmp_op *)from; | ||
53 | jop->raddr = (long)(to) - ((long)(from) + 5); | ||
54 | jop->op = RELATIVEJUMP_INSTRUCTION; | ||
55 | } | ||
56 | |||
57 | /* | ||
58 | * returns non-zero if opcodes can be boosted. | ||
59 | */ | ||
60 | static inline int can_boost(kprobe_opcode_t opcode) | ||
61 | { | ||
62 | switch (opcode & 0xf0 ) { | ||
63 | case 0x70: | ||
64 | return 0; /* can't boost conditional jump */ | ||
65 | case 0x90: | ||
66 | /* can't boost call and pushf */ | ||
67 | return opcode != 0x9a && opcode != 0x9c; | ||
68 | case 0xc0: | ||
69 | /* can't boost undefined opcodes and soft-interruptions */ | ||
70 | return (0xc1 < opcode && opcode < 0xc6) || | ||
71 | (0xc7 < opcode && opcode < 0xcc) || opcode == 0xcf; | ||
72 | case 0xd0: | ||
73 | /* can boost AA* and XLAT */ | ||
74 | return (opcode == 0xd4 || opcode == 0xd5 || opcode == 0xd7); | ||
75 | case 0xe0: | ||
76 | /* can boost in/out and (may be) jmps */ | ||
77 | return (0xe3 < opcode && opcode != 0xe8); | ||
78 | case 0xf0: | ||
79 | /* clear and set flags can be boost */ | ||
80 | return (opcode == 0xf5 || (0xf7 < opcode && opcode < 0xfe)); | ||
81 | default: | ||
82 | /* currently, can't boost 2 bytes opcodes */ | ||
83 | return opcode != 0x0f; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | |||
44 | /* | 88 | /* |
45 | * returns non-zero if opcode modifies the interrupt flag. | 89 | * returns non-zero if opcode modifies the interrupt flag. |
46 | */ | 90 | */ |
@@ -65,6 +109,11 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) | |||
65 | 109 | ||
66 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); | 110 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); |
67 | p->opcode = *p->addr; | 111 | p->opcode = *p->addr; |
112 | if (can_boost(p->opcode)) { | ||
113 | p->ainsn.boostable = 0; | ||
114 | } else { | ||
115 | p->ainsn.boostable = -1; | ||
116 | } | ||
68 | return 0; | 117 | return 0; |
69 | } | 118 | } |
70 | 119 | ||
@@ -155,9 +204,13 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
155 | { | 204 | { |
156 | struct kprobe *p; | 205 | struct kprobe *p; |
157 | int ret = 0; | 206 | int ret = 0; |
158 | kprobe_opcode_t *addr = NULL; | 207 | kprobe_opcode_t *addr; |
159 | unsigned long *lp; | ||
160 | struct kprobe_ctlblk *kcb; | 208 | struct kprobe_ctlblk *kcb; |
209 | #ifdef CONFIG_PREEMPT | ||
210 | unsigned pre_preempt_count = preempt_count(); | ||
211 | #endif /* CONFIG_PREEMPT */ | ||
212 | |||
213 | addr = (kprobe_opcode_t *)(regs->eip - sizeof(kprobe_opcode_t)); | ||
161 | 214 | ||
162 | /* | 215 | /* |
163 | * We don't want to be preempted for the entire | 216 | * We don't want to be preempted for the entire |
@@ -166,17 +219,6 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
166 | preempt_disable(); | 219 | preempt_disable(); |
167 | kcb = get_kprobe_ctlblk(); | 220 | kcb = get_kprobe_ctlblk(); |
168 | 221 | ||
169 | /* Check if the application is using LDT entry for its code segment and | ||
170 | * calculate the address by reading the base address from the LDT entry. | ||
171 | */ | ||
172 | if ((regs->xcs & 4) && (current->mm)) { | ||
173 | lp = (unsigned long *) ((unsigned long)((regs->xcs >> 3) * 8) | ||
174 | + (char *) current->mm->context.ldt); | ||
175 | addr = (kprobe_opcode_t *) (get_desc_base(lp) + regs->eip - | ||
176 | sizeof(kprobe_opcode_t)); | ||
177 | } else { | ||
178 | addr = (kprobe_opcode_t *)(regs->eip - sizeof(kprobe_opcode_t)); | ||
179 | } | ||
180 | /* Check we're not actually recursing */ | 222 | /* Check we're not actually recursing */ |
181 | if (kprobe_running()) { | 223 | if (kprobe_running()) { |
182 | p = get_kprobe(addr); | 224 | p = get_kprobe(addr); |
@@ -252,6 +294,21 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
252 | /* handler has already set things up, so skip ss setup */ | 294 | /* handler has already set things up, so skip ss setup */ |
253 | return 1; | 295 | return 1; |
254 | 296 | ||
297 | if (p->ainsn.boostable == 1 && | ||
298 | #ifdef CONFIG_PREEMPT | ||
299 | !(pre_preempt_count) && /* | ||
300 | * This enables booster when the direct | ||
301 | * execution path aren't preempted. | ||
302 | */ | ||
303 | #endif /* CONFIG_PREEMPT */ | ||
304 | !p->post_handler && !p->break_handler ) { | ||
305 | /* Boost up -- we can execute copied instructions directly */ | ||
306 | reset_current_kprobe(); | ||
307 | regs->eip = (unsigned long)p->ainsn.insn; | ||
308 | preempt_enable_no_resched(); | ||
309 | return 1; | ||
310 | } | ||
311 | |||
255 | ss_probe: | 312 | ss_probe: |
256 | prepare_singlestep(p, regs); | 313 | prepare_singlestep(p, regs); |
257 | kcb->kprobe_status = KPROBE_HIT_SS; | 314 | kcb->kprobe_status = KPROBE_HIT_SS; |
@@ -267,17 +324,44 @@ no_kprobe: | |||
267 | * here. When a retprobed function returns, this probe is hit and | 324 | * here. When a retprobed function returns, this probe is hit and |
268 | * trampoline_probe_handler() runs, calling the kretprobe's handler. | 325 | * trampoline_probe_handler() runs, calling the kretprobe's handler. |
269 | */ | 326 | */ |
270 | void kretprobe_trampoline_holder(void) | 327 | void __kprobes kretprobe_trampoline_holder(void) |
271 | { | 328 | { |
272 | asm volatile ( ".global kretprobe_trampoline\n" | 329 | asm volatile ( ".global kretprobe_trampoline\n" |
273 | "kretprobe_trampoline: \n" | 330 | "kretprobe_trampoline: \n" |
274 | "nop\n"); | 331 | " pushf\n" |
275 | } | 332 | /* skip cs, eip, orig_eax, es, ds */ |
333 | " subl $20, %esp\n" | ||
334 | " pushl %eax\n" | ||
335 | " pushl %ebp\n" | ||
336 | " pushl %edi\n" | ||
337 | " pushl %esi\n" | ||
338 | " pushl %edx\n" | ||
339 | " pushl %ecx\n" | ||
340 | " pushl %ebx\n" | ||
341 | " movl %esp, %eax\n" | ||
342 | " call trampoline_handler\n" | ||
343 | /* move eflags to cs */ | ||
344 | " movl 48(%esp), %edx\n" | ||
345 | " movl %edx, 44(%esp)\n" | ||
346 | /* save true return address on eflags */ | ||
347 | " movl %eax, 48(%esp)\n" | ||
348 | " popl %ebx\n" | ||
349 | " popl %ecx\n" | ||
350 | " popl %edx\n" | ||
351 | " popl %esi\n" | ||
352 | " popl %edi\n" | ||
353 | " popl %ebp\n" | ||
354 | " popl %eax\n" | ||
355 | /* skip eip, orig_eax, es, ds */ | ||
356 | " addl $16, %esp\n" | ||
357 | " popf\n" | ||
358 | " ret\n"); | ||
359 | } | ||
276 | 360 | ||
277 | /* | 361 | /* |
278 | * Called when we hit the probe point at kretprobe_trampoline | 362 | * Called from kretprobe_trampoline |
279 | */ | 363 | */ |
280 | int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | 364 | fastcall void *__kprobes trampoline_handler(struct pt_regs *regs) |
281 | { | 365 | { |
282 | struct kretprobe_instance *ri = NULL; | 366 | struct kretprobe_instance *ri = NULL; |
283 | struct hlist_head *head; | 367 | struct hlist_head *head; |
@@ -306,8 +390,11 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | |||
306 | /* another task is sharing our hash bucket */ | 390 | /* another task is sharing our hash bucket */ |
307 | continue; | 391 | continue; |
308 | 392 | ||
309 | if (ri->rp && ri->rp->handler) | 393 | if (ri->rp && ri->rp->handler){ |
394 | __get_cpu_var(current_kprobe) = &ri->rp->kp; | ||
310 | ri->rp->handler(ri, regs); | 395 | ri->rp->handler(ri, regs); |
396 | __get_cpu_var(current_kprobe) = NULL; | ||
397 | } | ||
311 | 398 | ||
312 | orig_ret_address = (unsigned long)ri->ret_addr; | 399 | orig_ret_address = (unsigned long)ri->ret_addr; |
313 | recycle_rp_inst(ri); | 400 | recycle_rp_inst(ri); |
@@ -322,18 +409,10 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | |||
322 | } | 409 | } |
323 | 410 | ||
324 | BUG_ON(!orig_ret_address || (orig_ret_address == trampoline_address)); | 411 | BUG_ON(!orig_ret_address || (orig_ret_address == trampoline_address)); |
325 | regs->eip = orig_ret_address; | ||
326 | 412 | ||
327 | reset_current_kprobe(); | ||
328 | spin_unlock_irqrestore(&kretprobe_lock, flags); | 413 | spin_unlock_irqrestore(&kretprobe_lock, flags); |
329 | preempt_enable_no_resched(); | ||
330 | 414 | ||
331 | /* | 415 | return (void*)orig_ret_address; |
332 | * By returning a non-zero value, we are telling | ||
333 | * kprobe_handler() that we don't want the post_handler | ||
334 | * to run (and have re-enabled preemption) | ||
335 | */ | ||
336 | return 1; | ||
337 | } | 416 | } |
338 | 417 | ||
339 | /* | 418 | /* |
@@ -357,15 +436,17 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | |||
357 | * 2) If the single-stepped instruction was a call, the return address | 436 | * 2) If the single-stepped instruction was a call, the return address |
358 | * that is atop the stack is the address following the copied instruction. | 437 | * that is atop the stack is the address following the copied instruction. |
359 | * We need to make it the address following the original instruction. | 438 | * We need to make it the address following the original instruction. |
439 | * | ||
440 | * This function also checks instruction size for preparing direct execution. | ||
360 | */ | 441 | */ |
361 | static void __kprobes resume_execution(struct kprobe *p, | 442 | static void __kprobes resume_execution(struct kprobe *p, |
362 | struct pt_regs *regs, struct kprobe_ctlblk *kcb) | 443 | struct pt_regs *regs, struct kprobe_ctlblk *kcb) |
363 | { | 444 | { |
364 | unsigned long *tos = (unsigned long *)®s->esp; | 445 | unsigned long *tos = (unsigned long *)®s->esp; |
365 | unsigned long next_eip = 0; | ||
366 | unsigned long copy_eip = (unsigned long)p->ainsn.insn; | 446 | unsigned long copy_eip = (unsigned long)p->ainsn.insn; |
367 | unsigned long orig_eip = (unsigned long)p->addr; | 447 | unsigned long orig_eip = (unsigned long)p->addr; |
368 | 448 | ||
449 | regs->eflags &= ~TF_MASK; | ||
369 | switch (p->ainsn.insn[0]) { | 450 | switch (p->ainsn.insn[0]) { |
370 | case 0x9c: /* pushfl */ | 451 | case 0x9c: /* pushfl */ |
371 | *tos &= ~(TF_MASK | IF_MASK); | 452 | *tos &= ~(TF_MASK | IF_MASK); |
@@ -375,37 +456,51 @@ static void __kprobes resume_execution(struct kprobe *p, | |||
375 | case 0xcb: | 456 | case 0xcb: |
376 | case 0xc2: | 457 | case 0xc2: |
377 | case 0xca: | 458 | case 0xca: |
378 | regs->eflags &= ~TF_MASK; | 459 | case 0xea: /* jmp absolute -- eip is correct */ |
379 | /* eip is already adjusted, no more changes required*/ | 460 | /* eip is already adjusted, no more changes required */ |
380 | return; | 461 | p->ainsn.boostable = 1; |
462 | goto no_change; | ||
381 | case 0xe8: /* call relative - Fix return addr */ | 463 | case 0xe8: /* call relative - Fix return addr */ |
382 | *tos = orig_eip + (*tos - copy_eip); | 464 | *tos = orig_eip + (*tos - copy_eip); |
383 | break; | 465 | break; |
384 | case 0xff: | 466 | case 0xff: |
385 | if ((p->ainsn.insn[1] & 0x30) == 0x10) { | 467 | if ((p->ainsn.insn[1] & 0x30) == 0x10) { |
386 | /* call absolute, indirect */ | 468 | /* call absolute, indirect */ |
387 | /* Fix return addr; eip is correct. */ | 469 | /* |
388 | next_eip = regs->eip; | 470 | * Fix return addr; eip is correct. |
471 | * But this is not boostable | ||
472 | */ | ||
389 | *tos = orig_eip + (*tos - copy_eip); | 473 | *tos = orig_eip + (*tos - copy_eip); |
474 | goto no_change; | ||
390 | } else if (((p->ainsn.insn[1] & 0x31) == 0x20) || /* jmp near, absolute indirect */ | 475 | } else if (((p->ainsn.insn[1] & 0x31) == 0x20) || /* jmp near, absolute indirect */ |
391 | ((p->ainsn.insn[1] & 0x31) == 0x21)) { /* jmp far, absolute indirect */ | 476 | ((p->ainsn.insn[1] & 0x31) == 0x21)) { /* jmp far, absolute indirect */ |
392 | /* eip is correct. */ | 477 | /* eip is correct. And this is boostable */ |
393 | next_eip = regs->eip; | 478 | p->ainsn.boostable = 1; |
479 | goto no_change; | ||
394 | } | 480 | } |
395 | break; | ||
396 | case 0xea: /* jmp absolute -- eip is correct */ | ||
397 | next_eip = regs->eip; | ||
398 | break; | ||
399 | default: | 481 | default: |
400 | break; | 482 | break; |
401 | } | 483 | } |
402 | 484 | ||
403 | regs->eflags &= ~TF_MASK; | 485 | if (p->ainsn.boostable == 0) { |
404 | if (next_eip) { | 486 | if ((regs->eip > copy_eip) && |
405 | regs->eip = next_eip; | 487 | (regs->eip - copy_eip) + 5 < MAX_INSN_SIZE) { |
406 | } else { | 488 | /* |
407 | regs->eip = orig_eip + (regs->eip - copy_eip); | 489 | * These instructions can be executed directly if it |
490 | * jumps back to correct address. | ||
491 | */ | ||
492 | set_jmp_op((void *)regs->eip, | ||
493 | (void *)orig_eip + (regs->eip - copy_eip)); | ||
494 | p->ainsn.boostable = 1; | ||
495 | } else { | ||
496 | p->ainsn.boostable = -1; | ||
497 | } | ||
408 | } | 498 | } |
499 | |||
500 | regs->eip = orig_eip + (regs->eip - copy_eip); | ||
501 | |||
502 | no_change: | ||
503 | return; | ||
409 | } | 504 | } |
410 | 505 | ||
411 | /* | 506 | /* |
@@ -453,15 +548,57 @@ static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) | |||
453 | struct kprobe *cur = kprobe_running(); | 548 | struct kprobe *cur = kprobe_running(); |
454 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | 549 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); |
455 | 550 | ||
456 | if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr)) | 551 | switch(kcb->kprobe_status) { |
457 | return 1; | 552 | case KPROBE_HIT_SS: |
458 | 553 | case KPROBE_REENTER: | |
459 | if (kcb->kprobe_status & KPROBE_HIT_SS) { | 554 | /* |
460 | resume_execution(cur, regs, kcb); | 555 | * We are here because the instruction being single |
556 | * stepped caused a page fault. We reset the current | ||
557 | * kprobe and the eip points back to the probe address | ||
558 | * and allow the page fault handler to continue as a | ||
559 | * normal page fault. | ||
560 | */ | ||
561 | regs->eip = (unsigned long)cur->addr; | ||
461 | regs->eflags |= kcb->kprobe_old_eflags; | 562 | regs->eflags |= kcb->kprobe_old_eflags; |
462 | 563 | if (kcb->kprobe_status == KPROBE_REENTER) | |
463 | reset_current_kprobe(); | 564 | restore_previous_kprobe(kcb); |
565 | else | ||
566 | reset_current_kprobe(); | ||
464 | preempt_enable_no_resched(); | 567 | preempt_enable_no_resched(); |
568 | break; | ||
569 | case KPROBE_HIT_ACTIVE: | ||
570 | case KPROBE_HIT_SSDONE: | ||
571 | /* | ||
572 | * We increment the nmissed count for accounting, | ||
573 | * we can also use npre/npostfault count for accouting | ||
574 | * these specific fault cases. | ||
575 | */ | ||
576 | kprobes_inc_nmissed_count(cur); | ||
577 | |||
578 | /* | ||
579 | * We come here because instructions in the pre/post | ||
580 | * handler caused the page_fault, this could happen | ||
581 | * if handler tries to access user space by | ||
582 | * copy_from_user(), get_user() etc. Let the | ||
583 | * user-specified handler try to fix it first. | ||
584 | */ | ||
585 | if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr)) | ||
586 | return 1; | ||
587 | |||
588 | /* | ||
589 | * In case the user-specified fault handler returned | ||
590 | * zero, try to fix up. | ||
591 | */ | ||
592 | if (fixup_exception(regs)) | ||
593 | return 1; | ||
594 | |||
595 | /* | ||
596 | * fixup_exception() could not handle it, | ||
597 | * Let do_page_fault() fix it. | ||
598 | */ | ||
599 | break; | ||
600 | default: | ||
601 | break; | ||
465 | } | 602 | } |
466 | return 0; | 603 | return 0; |
467 | } | 604 | } |
@@ -475,6 +612,9 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, | |||
475 | struct die_args *args = (struct die_args *)data; | 612 | struct die_args *args = (struct die_args *)data; |
476 | int ret = NOTIFY_DONE; | 613 | int ret = NOTIFY_DONE; |
477 | 614 | ||
615 | if (args->regs && user_mode(args->regs)) | ||
616 | return ret; | ||
617 | |||
478 | switch (val) { | 618 | switch (val) { |
479 | case DIE_INT3: | 619 | case DIE_INT3: |
480 | if (kprobe_handler(args->regs)) | 620 | if (kprobe_handler(args->regs)) |
@@ -564,12 +704,7 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | |||
564 | return 0; | 704 | return 0; |
565 | } | 705 | } |
566 | 706 | ||
567 | static struct kprobe trampoline_p = { | ||
568 | .addr = (kprobe_opcode_t *) &kretprobe_trampoline, | ||
569 | .pre_handler = trampoline_probe_handler | ||
570 | }; | ||
571 | |||
572 | int __init arch_init_kprobes(void) | 707 | int __init arch_init_kprobes(void) |
573 | { | 708 | { |
574 | return register_kprobe(&trampoline_p); | 709 | return 0; |
575 | } | 710 | } |
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c index 55bc365b8753..e7c138f66c5a 100644 --- a/arch/i386/kernel/microcode.c +++ b/arch/i386/kernel/microcode.c | |||
@@ -81,6 +81,7 @@ | |||
81 | #include <linux/miscdevice.h> | 81 | #include <linux/miscdevice.h> |
82 | #include <linux/spinlock.h> | 82 | #include <linux/spinlock.h> |
83 | #include <linux/mm.h> | 83 | #include <linux/mm.h> |
84 | #include <linux/mutex.h> | ||
84 | 85 | ||
85 | #include <asm/msr.h> | 86 | #include <asm/msr.h> |
86 | #include <asm/uaccess.h> | 87 | #include <asm/uaccess.h> |
@@ -114,7 +115,7 @@ MODULE_LICENSE("GPL"); | |||
114 | static DEFINE_SPINLOCK(microcode_update_lock); | 115 | static DEFINE_SPINLOCK(microcode_update_lock); |
115 | 116 | ||
116 | /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ | 117 | /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ |
117 | static DECLARE_MUTEX(microcode_sem); | 118 | static DEFINE_MUTEX(microcode_mutex); |
118 | 119 | ||
119 | static void __user *user_buffer; /* user area microcode data buffer */ | 120 | static void __user *user_buffer; /* user area microcode data buffer */ |
120 | static unsigned int user_buffer_size; /* it's size */ | 121 | static unsigned int user_buffer_size; /* it's size */ |
@@ -444,7 +445,7 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_ | |||
444 | return -EINVAL; | 445 | return -EINVAL; |
445 | } | 446 | } |
446 | 447 | ||
447 | down(µcode_sem); | 448 | mutex_lock(µcode_mutex); |
448 | 449 | ||
449 | user_buffer = (void __user *) buf; | 450 | user_buffer = (void __user *) buf; |
450 | user_buffer_size = (int) len; | 451 | user_buffer_size = (int) len; |
@@ -453,31 +454,14 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_ | |||
453 | if (!ret) | 454 | if (!ret) |
454 | ret = (ssize_t)len; | 455 | ret = (ssize_t)len; |
455 | 456 | ||
456 | up(µcode_sem); | 457 | mutex_unlock(µcode_mutex); |
457 | 458 | ||
458 | return ret; | 459 | return ret; |
459 | } | 460 | } |
460 | 461 | ||
461 | static int microcode_ioctl (struct inode *inode, struct file *file, | ||
462 | unsigned int cmd, unsigned long arg) | ||
463 | { | ||
464 | switch (cmd) { | ||
465 | /* | ||
466 | * XXX: will be removed after microcode_ctl | ||
467 | * is updated to ignore failure of this ioctl() | ||
468 | */ | ||
469 | case MICROCODE_IOCFREE: | ||
470 | return 0; | ||
471 | default: | ||
472 | return -EINVAL; | ||
473 | } | ||
474 | return -EINVAL; | ||
475 | } | ||
476 | |||
477 | static struct file_operations microcode_fops = { | 462 | static struct file_operations microcode_fops = { |
478 | .owner = THIS_MODULE, | 463 | .owner = THIS_MODULE, |
479 | .write = microcode_write, | 464 | .write = microcode_write, |
480 | .ioctl = microcode_ioctl, | ||
481 | .open = microcode_open, | 465 | .open = microcode_open, |
482 | }; | 466 | }; |
483 | 467 | ||
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c index 9074818b9473..d43b498ec745 100644 --- a/arch/i386/kernel/nmi.c +++ b/arch/i386/kernel/nmi.c | |||
@@ -138,12 +138,12 @@ static int __init check_nmi_watchdog(void) | |||
138 | if (nmi_watchdog == NMI_LOCAL_APIC) | 138 | if (nmi_watchdog == NMI_LOCAL_APIC) |
139 | smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0); | 139 | smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0); |
140 | 140 | ||
141 | for_each_cpu(cpu) | 141 | for_each_possible_cpu(cpu) |
142 | prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count; | 142 | prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count; |
143 | local_irq_enable(); | 143 | local_irq_enable(); |
144 | mdelay((10*1000)/nmi_hz); // wait 10 ticks | 144 | mdelay((10*1000)/nmi_hz); // wait 10 ticks |
145 | 145 | ||
146 | for_each_cpu(cpu) { | 146 | for_each_possible_cpu(cpu) { |
147 | #ifdef CONFIG_SMP | 147 | #ifdef CONFIG_SMP |
148 | /* Check cpu_callin_map here because that is set | 148 | /* Check cpu_callin_map here because that is set |
149 | after the timer is started. */ | 149 | after the timer is started. */ |
@@ -510,7 +510,7 @@ void touch_nmi_watchdog (void) | |||
510 | * Just reset the alert counters, (other CPUs might be | 510 | * Just reset the alert counters, (other CPUs might be |
511 | * spinning on locks we hold): | 511 | * spinning on locks we hold): |
512 | */ | 512 | */ |
513 | for_each_cpu(i) | 513 | for_each_possible_cpu(i) |
514 | alert_counter[i] = 0; | 514 | alert_counter[i] = 0; |
515 | 515 | ||
516 | /* | 516 | /* |
@@ -529,7 +529,8 @@ void nmi_watchdog_tick (struct pt_regs * regs) | |||
529 | * always switch the stack NMI-atomically, it's safe to use | 529 | * always switch the stack NMI-atomically, it's safe to use |
530 | * smp_processor_id(). | 530 | * smp_processor_id(). |
531 | */ | 531 | */ |
532 | int sum, cpu = smp_processor_id(); | 532 | unsigned int sum; |
533 | int cpu = smp_processor_id(); | ||
533 | 534 | ||
534 | sum = per_cpu(irq_stat, cpu).apic_timer_irqs; | 535 | sum = per_cpu(irq_stat, cpu).apic_timer_irqs; |
535 | 536 | ||
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 299e61674084..24b3e745478b 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/kallsyms.h> | 38 | #include <linux/kallsyms.h> |
39 | #include <linux/ptrace.h> | 39 | #include <linux/ptrace.h> |
40 | #include <linux/random.h> | 40 | #include <linux/random.h> |
41 | #include <linux/kprobes.h> | ||
42 | 41 | ||
43 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
44 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
@@ -364,13 +363,6 @@ void exit_thread(void) | |||
364 | struct task_struct *tsk = current; | 363 | struct task_struct *tsk = current; |
365 | struct thread_struct *t = &tsk->thread; | 364 | struct thread_struct *t = &tsk->thread; |
366 | 365 | ||
367 | /* | ||
368 | * Remove function-return probe instances associated with this task | ||
369 | * and put them back on the free list. Do not insert an exit probe for | ||
370 | * this function, it will be disabled by kprobe_flush_task if you do. | ||
371 | */ | ||
372 | kprobe_flush_task(tsk); | ||
373 | |||
374 | /* The process may have allocated an io port bitmap... nuke it. */ | 366 | /* The process may have allocated an io port bitmap... nuke it. */ |
375 | if (unlikely(NULL != t->io_bitmap_ptr)) { | 367 | if (unlikely(NULL != t->io_bitmap_ptr)) { |
376 | int cpu = get_cpu(); | 368 | int cpu = get_cpu(); |
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index d313a11acafa..8c08660b4e5d 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/kexec.h> | 46 | #include <linux/kexec.h> |
47 | #include <linux/crash_dump.h> | 47 | #include <linux/crash_dump.h> |
48 | #include <linux/dmi.h> | 48 | #include <linux/dmi.h> |
49 | #include <linux/pfn.h> | ||
49 | 50 | ||
50 | #include <video/edid.h> | 51 | #include <video/edid.h> |
51 | 52 | ||
@@ -1058,10 +1059,10 @@ static int __init | |||
1058 | free_available_memory(unsigned long start, unsigned long end, void *arg) | 1059 | free_available_memory(unsigned long start, unsigned long end, void *arg) |
1059 | { | 1060 | { |
1060 | /* check max_low_pfn */ | 1061 | /* check max_low_pfn */ |
1061 | if (start >= ((max_low_pfn + 1) << PAGE_SHIFT)) | 1062 | if (start >= (max_low_pfn << PAGE_SHIFT)) |
1062 | return 0; | 1063 | return 0; |
1063 | if (end >= ((max_low_pfn + 1) << PAGE_SHIFT)) | 1064 | if (end >= (max_low_pfn << PAGE_SHIFT)) |
1064 | end = (max_low_pfn + 1) << PAGE_SHIFT; | 1065 | end = max_low_pfn << PAGE_SHIFT; |
1065 | if (start < end) | 1066 | if (start < end) |
1066 | free_bootmem(start, end - start); | 1067 | free_bootmem(start, end - start); |
1067 | 1068 | ||
@@ -1286,8 +1287,6 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat | |||
1286 | probe_roms(); | 1287 | probe_roms(); |
1287 | for (i = 0; i < e820.nr_map; i++) { | 1288 | for (i = 0; i < e820.nr_map; i++) { |
1288 | struct resource *res; | 1289 | struct resource *res; |
1289 | if (e820.map[i].addr + e820.map[i].size > 0x100000000ULL) | ||
1290 | continue; | ||
1291 | res = kzalloc(sizeof(struct resource), GFP_ATOMIC); | 1290 | res = kzalloc(sizeof(struct resource), GFP_ATOMIC); |
1292 | switch (e820.map[i].type) { | 1291 | switch (e820.map[i].type) { |
1293 | case E820_RAM: res->name = "System RAM"; break; | 1292 | case E820_RAM: res->name = "System RAM"; break; |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 82371d83bfa9..a6969903f2d6 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -72,6 +72,9 @@ int phys_proc_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID}; | |||
72 | /* Core ID of each logical CPU */ | 72 | /* Core ID of each logical CPU */ |
73 | int cpu_core_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID}; | 73 | int cpu_core_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID}; |
74 | 74 | ||
75 | /* Last level cache ID of each logical CPU */ | ||
76 | int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; | ||
77 | |||
75 | /* representing HT siblings of each logical CPU */ | 78 | /* representing HT siblings of each logical CPU */ |
76 | cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; | 79 | cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; |
77 | EXPORT_SYMBOL(cpu_sibling_map); | 80 | EXPORT_SYMBOL(cpu_sibling_map); |
@@ -440,6 +443,18 @@ static void __devinit smp_callin(void) | |||
440 | 443 | ||
441 | static int cpucount; | 444 | static int cpucount; |
442 | 445 | ||
446 | /* maps the cpu to the sched domain representing multi-core */ | ||
447 | cpumask_t cpu_coregroup_map(int cpu) | ||
448 | { | ||
449 | struct cpuinfo_x86 *c = cpu_data + cpu; | ||
450 | /* | ||
451 | * For perf, we return last level cache shared map. | ||
452 | * TBD: when power saving sched policy is added, we will return | ||
453 | * cpu_core_map when power saving policy is enabled | ||
454 | */ | ||
455 | return c->llc_shared_map; | ||
456 | } | ||
457 | |||
443 | /* representing cpus for which sibling maps can be computed */ | 458 | /* representing cpus for which sibling maps can be computed */ |
444 | static cpumask_t cpu_sibling_setup_map; | 459 | static cpumask_t cpu_sibling_setup_map; |
445 | 460 | ||
@@ -459,12 +474,16 @@ set_cpu_sibling_map(int cpu) | |||
459 | cpu_set(cpu, cpu_sibling_map[i]); | 474 | cpu_set(cpu, cpu_sibling_map[i]); |
460 | cpu_set(i, cpu_core_map[cpu]); | 475 | cpu_set(i, cpu_core_map[cpu]); |
461 | cpu_set(cpu, cpu_core_map[i]); | 476 | cpu_set(cpu, cpu_core_map[i]); |
477 | cpu_set(i, c[cpu].llc_shared_map); | ||
478 | cpu_set(cpu, c[i].llc_shared_map); | ||
462 | } | 479 | } |
463 | } | 480 | } |
464 | } else { | 481 | } else { |
465 | cpu_set(cpu, cpu_sibling_map[cpu]); | 482 | cpu_set(cpu, cpu_sibling_map[cpu]); |
466 | } | 483 | } |
467 | 484 | ||
485 | cpu_set(cpu, c[cpu].llc_shared_map); | ||
486 | |||
468 | if (current_cpu_data.x86_max_cores == 1) { | 487 | if (current_cpu_data.x86_max_cores == 1) { |
469 | cpu_core_map[cpu] = cpu_sibling_map[cpu]; | 488 | cpu_core_map[cpu] = cpu_sibling_map[cpu]; |
470 | c[cpu].booted_cores = 1; | 489 | c[cpu].booted_cores = 1; |
@@ -472,6 +491,11 @@ set_cpu_sibling_map(int cpu) | |||
472 | } | 491 | } |
473 | 492 | ||
474 | for_each_cpu_mask(i, cpu_sibling_setup_map) { | 493 | for_each_cpu_mask(i, cpu_sibling_setup_map) { |
494 | if (cpu_llc_id[cpu] != BAD_APICID && | ||
495 | cpu_llc_id[cpu] == cpu_llc_id[i]) { | ||
496 | cpu_set(i, c[cpu].llc_shared_map); | ||
497 | cpu_set(cpu, c[i].llc_shared_map); | ||
498 | } | ||
475 | if (phys_proc_id[cpu] == phys_proc_id[i]) { | 499 | if (phys_proc_id[cpu] == phys_proc_id[i]) { |
476 | cpu_set(i, cpu_core_map[cpu]); | 500 | cpu_set(i, cpu_core_map[cpu]); |
477 | cpu_set(cpu, cpu_core_map[i]); | 501 | cpu_set(cpu, cpu_core_map[i]); |
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S index ac687d00a1ce..326595f3fa4d 100644 --- a/arch/i386/kernel/syscall_table.S +++ b/arch/i386/kernel/syscall_table.S | |||
@@ -310,3 +310,5 @@ ENTRY(sys_call_table) | |||
310 | .long sys_pselect6 | 310 | .long sys_pselect6 |
311 | .long sys_ppoll | 311 | .long sys_ppoll |
312 | .long sys_unshare /* 310 */ | 312 | .long sys_unshare /* 310 */ |
313 | .long sys_set_robust_list | ||
314 | .long sys_get_robust_list | ||
diff --git a/arch/i386/kernel/timers/timer_pm.c b/arch/i386/kernel/timers/timer_pm.c index 264edaaac315..144e94a04933 100644 --- a/arch/i386/kernel/timers/timer_pm.c +++ b/arch/i386/kernel/timers/timer_pm.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/pci.h> | ||
18 | #include <asm/types.h> | 19 | #include <asm/types.h> |
19 | #include <asm/timer.h> | 20 | #include <asm/timer.h> |
20 | #include <asm/smp.h> | 21 | #include <asm/smp.h> |
@@ -45,24 +46,31 @@ static seqlock_t monotonic_lock = SEQLOCK_UNLOCKED; | |||
45 | 46 | ||
46 | #define ACPI_PM_MASK 0xFFFFFF /* limit it to 24 bits */ | 47 | #define ACPI_PM_MASK 0xFFFFFF /* limit it to 24 bits */ |
47 | 48 | ||
49 | static int pmtmr_need_workaround __read_mostly = 1; | ||
50 | |||
48 | /*helper function to safely read acpi pm timesource*/ | 51 | /*helper function to safely read acpi pm timesource*/ |
49 | static inline u32 read_pmtmr(void) | 52 | static inline u32 read_pmtmr(void) |
50 | { | 53 | { |
51 | u32 v1=0,v2=0,v3=0; | 54 | if (pmtmr_need_workaround) { |
52 | /* It has been reported that because of various broken | 55 | u32 v1, v2, v3; |
53 | * chipsets (ICH4, PIIX4 and PIIX4E) where the ACPI PM time | 56 | |
54 | * source is not latched, so you must read it multiple | 57 | /* It has been reported that because of various broken |
55 | * times to insure a safe value is read. | 58 | * chipsets (ICH4, PIIX4 and PIIX4E) where the ACPI PM time |
56 | */ | 59 | * source is not latched, so you must read it multiple |
57 | do { | 60 | * times to insure a safe value is read. |
58 | v1 = inl(pmtmr_ioport); | 61 | */ |
59 | v2 = inl(pmtmr_ioport); | 62 | do { |
60 | v3 = inl(pmtmr_ioport); | 63 | v1 = inl(pmtmr_ioport); |
61 | } while ((v1 > v2 && v1 < v3) || (v2 > v3 && v2 < v1) | 64 | v2 = inl(pmtmr_ioport); |
62 | || (v3 > v1 && v3 < v2)); | 65 | v3 = inl(pmtmr_ioport); |
63 | 66 | } while ((v1 > v2 && v1 < v3) || (v2 > v3 && v2 < v1) | |
64 | /* mask the output to 24 bits */ | 67 | || (v3 > v1 && v3 < v2)); |
65 | return v2 & ACPI_PM_MASK; | 68 | |
69 | /* mask the output to 24 bits */ | ||
70 | return v2 & ACPI_PM_MASK; | ||
71 | } | ||
72 | |||
73 | return inl(pmtmr_ioport) & ACPI_PM_MASK; | ||
66 | } | 74 | } |
67 | 75 | ||
68 | 76 | ||
@@ -263,6 +271,72 @@ struct init_timer_opts __initdata timer_pmtmr_init = { | |||
263 | .opts = &timer_pmtmr, | 271 | .opts = &timer_pmtmr, |
264 | }; | 272 | }; |
265 | 273 | ||
274 | #ifdef CONFIG_PCI | ||
275 | /* | ||
276 | * PIIX4 Errata: | ||
277 | * | ||
278 | * The power management timer may return improper results when read. | ||
279 | * Although the timer value settles properly after incrementing, | ||
280 | * while incrementing there is a 3 ns window every 69.8 ns where the | ||
281 | * timer value is indeterminate (a 4.2% chance that the data will be | ||
282 | * incorrect when read). As a result, the ACPI free running count up | ||
283 | * timer specification is violated due to erroneous reads. | ||
284 | */ | ||
285 | static int __init pmtmr_bug_check(void) | ||
286 | { | ||
287 | static struct pci_device_id gray_list[] __initdata = { | ||
288 | /* these chipsets may have bug. */ | ||
289 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, | ||
290 | PCI_DEVICE_ID_INTEL_82801DB_0) }, | ||
291 | { }, | ||
292 | }; | ||
293 | struct pci_dev *dev; | ||
294 | int pmtmr_has_bug = 0; | ||
295 | u8 rev; | ||
296 | |||
297 | if (cur_timer != &timer_pmtmr || !pmtmr_need_workaround) | ||
298 | return 0; | ||
299 | |||
300 | dev = pci_get_device(PCI_VENDOR_ID_INTEL, | ||
301 | PCI_DEVICE_ID_INTEL_82371AB_3, NULL); | ||
302 | if (dev) { | ||
303 | pci_read_config_byte(dev, PCI_REVISION_ID, &rev); | ||
304 | /* the bug has been fixed in PIIX4M */ | ||
305 | if (rev < 3) { | ||
306 | printk(KERN_WARNING "* Found PM-Timer Bug on this " | ||
307 | "chipset. Due to workarounds for a bug,\n" | ||
308 | "* this time source is slow. Consider trying " | ||
309 | "other time sources (clock=)\n"); | ||
310 | pmtmr_has_bug = 1; | ||
311 | } | ||
312 | pci_dev_put(dev); | ||
313 | } | ||
314 | |||
315 | if (pci_dev_present(gray_list)) { | ||
316 | printk(KERN_WARNING "* This chipset may have PM-Timer Bug. Due" | ||
317 | " to workarounds for a bug,\n" | ||
318 | "* this time source is slow. If you are sure your timer" | ||
319 | " does not have\n" | ||
320 | "* this bug, please use \"pmtmr_good\" to disable the " | ||
321 | "workaround\n"); | ||
322 | pmtmr_has_bug = 1; | ||
323 | } | ||
324 | |||
325 | if (!pmtmr_has_bug) | ||
326 | pmtmr_need_workaround = 0; | ||
327 | |||
328 | return 0; | ||
329 | } | ||
330 | device_initcall(pmtmr_bug_check); | ||
331 | #endif | ||
332 | |||
333 | static int __init pmtr_good_setup(char *__str) | ||
334 | { | ||
335 | pmtmr_need_workaround = 0; | ||
336 | return 1; | ||
337 | } | ||
338 | __setup("pmtmr_good", pmtr_good_setup); | ||
339 | |||
266 | MODULE_LICENSE("GPL"); | 340 | MODULE_LICENSE("GPL"); |
267 | MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>"); | 341 | MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>"); |
268 | MODULE_DESCRIPTION("Power Management Timer (PMTMR) as primary timing source for x86"); | 342 | MODULE_DESCRIPTION("Power Management Timer (PMTMR) as primary timing source for x86"); |
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index de5386b01d38..6b63a5aa1e46 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c | |||
@@ -92,22 +92,21 @@ asmlinkage void spurious_interrupt_bug(void); | |||
92 | asmlinkage void machine_check(void); | 92 | asmlinkage void machine_check(void); |
93 | 93 | ||
94 | static int kstack_depth_to_print = 24; | 94 | static int kstack_depth_to_print = 24; |
95 | struct notifier_block *i386die_chain; | 95 | ATOMIC_NOTIFIER_HEAD(i386die_chain); |
96 | static DEFINE_SPINLOCK(die_notifier_lock); | ||
97 | 96 | ||
98 | int register_die_notifier(struct notifier_block *nb) | 97 | int register_die_notifier(struct notifier_block *nb) |
99 | { | 98 | { |
100 | int err = 0; | ||
101 | unsigned long flags; | ||
102 | |||
103 | vmalloc_sync_all(); | 99 | vmalloc_sync_all(); |
104 | spin_lock_irqsave(&die_notifier_lock, flags); | 100 | return atomic_notifier_chain_register(&i386die_chain, nb); |
105 | err = notifier_chain_register(&i386die_chain, nb); | ||
106 | spin_unlock_irqrestore(&die_notifier_lock, flags); | ||
107 | return err; | ||
108 | } | 101 | } |
109 | EXPORT_SYMBOL(register_die_notifier); | 102 | EXPORT_SYMBOL(register_die_notifier); |
110 | 103 | ||
104 | int unregister_die_notifier(struct notifier_block *nb) | ||
105 | { | ||
106 | return atomic_notifier_chain_unregister(&i386die_chain, nb); | ||
107 | } | ||
108 | EXPORT_SYMBOL(unregister_die_notifier); | ||
109 | |||
111 | static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) | 110 | static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) |
112 | { | 111 | { |
113 | return p > (void *)tinfo && | 112 | return p > (void *)tinfo && |
@@ -386,8 +385,12 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
386 | #endif | 385 | #endif |
387 | if (nl) | 386 | if (nl) |
388 | printk("\n"); | 387 | printk("\n"); |
389 | notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); | 388 | if (notify_die(DIE_OOPS, str, regs, err, |
390 | show_registers(regs); | 389 | current->thread.trap_no, SIGSEGV) != |
390 | NOTIFY_STOP) | ||
391 | show_registers(regs); | ||
392 | else | ||
393 | regs = NULL; | ||
391 | } else | 394 | } else |
392 | printk(KERN_EMERG "Recursive die() failure, output suppressed\n"); | 395 | printk(KERN_EMERG "Recursive die() failure, output suppressed\n"); |
393 | 396 | ||
@@ -395,6 +398,9 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
395 | die.lock_owner = -1; | 398 | die.lock_owner = -1; |
396 | spin_unlock_irqrestore(&die.lock, flags); | 399 | spin_unlock_irqrestore(&die.lock, flags); |
397 | 400 | ||
401 | if (!regs) | ||
402 | return; | ||
403 | |||
398 | if (kexec_should_crash(current)) | 404 | if (kexec_should_crash(current)) |
399 | crash_kexec(regs); | 405 | crash_kexec(regs); |
400 | 406 | ||
@@ -623,7 +629,7 @@ static DEFINE_SPINLOCK(nmi_print_lock); | |||
623 | 629 | ||
624 | void die_nmi (struct pt_regs *regs, const char *msg) | 630 | void die_nmi (struct pt_regs *regs, const char *msg) |
625 | { | 631 | { |
626 | if (notify_die(DIE_NMIWATCHDOG, msg, regs, 0, 0, SIGINT) == | 632 | if (notify_die(DIE_NMIWATCHDOG, msg, regs, 0, 2, SIGINT) == |
627 | NOTIFY_STOP) | 633 | NOTIFY_STOP) |
628 | return; | 634 | return; |
629 | 635 | ||
@@ -662,7 +668,7 @@ static void default_do_nmi(struct pt_regs * regs) | |||
662 | reason = get_nmi_reason(); | 668 | reason = get_nmi_reason(); |
663 | 669 | ||
664 | if (!(reason & 0xc0)) { | 670 | if (!(reason & 0xc0)) { |
665 | if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT) | 671 | if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT) |
666 | == NOTIFY_STOP) | 672 | == NOTIFY_STOP) |
667 | return; | 673 | return; |
668 | #ifdef CONFIG_X86_LOCAL_APIC | 674 | #ifdef CONFIG_X86_LOCAL_APIC |
@@ -678,7 +684,7 @@ static void default_do_nmi(struct pt_regs * regs) | |||
678 | unknown_nmi_error(reason, regs); | 684 | unknown_nmi_error(reason, regs); |
679 | return; | 685 | return; |
680 | } | 686 | } |
681 | if (notify_die(DIE_NMI, "nmi", regs, reason, 0, SIGINT) == NOTIFY_STOP) | 687 | if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) |
682 | return; | 688 | return; |
683 | if (reason & 0x80) | 689 | if (reason & 0x80) |
684 | mem_parity_error(reason, regs); | 690 | mem_parity_error(reason, regs); |
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c index 8165626a5c30..70e560a1b79a 100644 --- a/arch/i386/mach-voyager/voyager_smp.c +++ b/arch/i386/mach-voyager/voyager_smp.c | |||
@@ -1700,7 +1700,7 @@ after_handle_vic_irq(unsigned int irq) | |||
1700 | 1700 | ||
1701 | printk("VOYAGER SMP: CPU%d lost interrupt %d\n", | 1701 | printk("VOYAGER SMP: CPU%d lost interrupt %d\n", |
1702 | cpu, irq); | 1702 | cpu, irq); |
1703 | for_each_cpu(real_cpu, mask) { | 1703 | for_each_possible_cpu(real_cpu, mask) { |
1704 | 1704 | ||
1705 | outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu, | 1705 | outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu, |
1706 | VIC_PROCESSOR_ID); | 1706 | VIC_PROCESSOR_ID); |
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c index c4af9638dbfa..fe6eb901326e 100644 --- a/arch/i386/mm/discontig.c +++ b/arch/i386/mm/discontig.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/nodemask.h> | 31 | #include <linux/nodemask.h> |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/kexec.h> | 33 | #include <linux/kexec.h> |
34 | #include <linux/pfn.h> | ||
34 | 35 | ||
35 | #include <asm/e820.h> | 36 | #include <asm/e820.h> |
36 | #include <asm/setup.h> | 37 | #include <asm/setup.h> |
@@ -352,17 +353,6 @@ void __init zone_sizes_init(void) | |||
352 | { | 353 | { |
353 | int nid; | 354 | int nid; |
354 | 355 | ||
355 | /* | ||
356 | * Insert nodes into pgdat_list backward so they appear in order. | ||
357 | * Clobber node 0's links and NULL out pgdat_list before starting. | ||
358 | */ | ||
359 | pgdat_list = NULL; | ||
360 | for (nid = MAX_NUMNODES - 1; nid >= 0; nid--) { | ||
361 | if (!node_online(nid)) | ||
362 | continue; | ||
363 | NODE_DATA(nid)->pgdat_next = pgdat_list; | ||
364 | pgdat_list = NODE_DATA(nid); | ||
365 | } | ||
366 | 356 | ||
367 | for_each_online_node(nid) { | 357 | for_each_online_node(nid) { |
368 | unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; | 358 | unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; |
diff --git a/arch/i386/mm/pgtable.c b/arch/i386/mm/pgtable.c index 9db3242103be..2889567e21a1 100644 --- a/arch/i386/mm/pgtable.c +++ b/arch/i386/mm/pgtable.c | |||
@@ -36,7 +36,7 @@ void show_mem(void) | |||
36 | printk(KERN_INFO "Mem-info:\n"); | 36 | printk(KERN_INFO "Mem-info:\n"); |
37 | show_free_areas(); | 37 | show_free_areas(); |
38 | printk(KERN_INFO "Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); | 38 | printk(KERN_INFO "Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); |
39 | for_each_pgdat(pgdat) { | 39 | for_each_online_pgdat(pgdat) { |
40 | pgdat_resize_lock(pgdat, &flags); | 40 | pgdat_resize_lock(pgdat, &flags); |
41 | for (i = 0; i < pgdat->node_spanned_pages; ++i) { | 41 | for (i = 0; i < pgdat->node_spanned_pages; ++i) { |
42 | page = pgdat_page_nr(pgdat, i); | 42 | page = pgdat_page_nr(pgdat, i); |
diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c index 1accce50c2c7..1a2076ce6f6a 100644 --- a/arch/i386/oprofile/nmi_int.c +++ b/arch/i386/oprofile/nmi_int.c | |||
@@ -122,7 +122,7 @@ static void nmi_save_registers(void * dummy) | |||
122 | static void free_msrs(void) | 122 | static void free_msrs(void) |
123 | { | 123 | { |
124 | int i; | 124 | int i; |
125 | for_each_cpu(i) { | 125 | for_each_possible_cpu(i) { |
126 | kfree(cpu_msrs[i].counters); | 126 | kfree(cpu_msrs[i].counters); |
127 | cpu_msrs[i].counters = NULL; | 127 | cpu_msrs[i].counters = NULL; |
128 | kfree(cpu_msrs[i].controls); | 128 | kfree(cpu_msrs[i].controls); |