diff options
Diffstat (limited to 'arch/i386')
27 files changed, 199 insertions, 235 deletions
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index bac0da731ee3..dbf90ad6eac3 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
| @@ -997,8 +997,21 @@ source "drivers/Kconfig" | |||
| 997 | 997 | ||
| 998 | source "fs/Kconfig" | 998 | source "fs/Kconfig" |
| 999 | 999 | ||
| 1000 | menu "Instrumentation Support" | ||
| 1001 | depends on EXPERIMENTAL | ||
| 1002 | |||
| 1000 | source "arch/i386/oprofile/Kconfig" | 1003 | source "arch/i386/oprofile/Kconfig" |
| 1001 | 1004 | ||
| 1005 | config KPROBES | ||
| 1006 | bool "Kprobes (EXPERIMENTAL)" | ||
| 1007 | help | ||
| 1008 | Kprobes allows you to trap at almost any kernel address and | ||
| 1009 | execute a callback function. register_kprobe() establishes | ||
| 1010 | a probepoint and specifies the callback. Kprobes is useful | ||
| 1011 | for kernel debugging, non-intrusive instrumentation and testing. | ||
| 1012 | If in doubt, say "N". | ||
| 1013 | endmenu | ||
| 1014 | |||
| 1002 | source "arch/i386/Kconfig.debug" | 1015 | source "arch/i386/Kconfig.debug" |
| 1003 | 1016 | ||
| 1004 | source "security/Kconfig" | 1017 | source "security/Kconfig" |
diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug index 5228c40a6fb2..c48b424dd640 100644 --- a/arch/i386/Kconfig.debug +++ b/arch/i386/Kconfig.debug | |||
| @@ -22,16 +22,6 @@ config DEBUG_STACKOVERFLOW | |||
| 22 | This option will cause messages to be printed if free stack space | 22 | This option will cause messages to be printed if free stack space |
| 23 | drops below a certain limit. | 23 | drops below a certain limit. |
| 24 | 24 | ||
| 25 | config KPROBES | ||
| 26 | bool "Kprobes" | ||
| 27 | depends on DEBUG_KERNEL | ||
| 28 | help | ||
| 29 | Kprobes allows you to trap at almost any kernel address and | ||
| 30 | execute a callback function. register_kprobe() establishes | ||
| 31 | a probepoint and specifies the callback. Kprobes is useful | ||
| 32 | for kernel debugging, non-intrusive instrumentation and testing. | ||
| 33 | If in doubt, say "N". | ||
| 34 | |||
| 35 | config DEBUG_STACK_USAGE | 25 | config DEBUG_STACK_USAGE |
| 36 | bool "Stack utilization instrumentation" | 26 | bool "Stack utilization instrumentation" |
| 37 | depends on DEBUG_KERNEL | 27 | depends on DEBUG_KERNEL |
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c index 7c724ffa08bb..496a2c9909fe 100644 --- a/arch/i386/kernel/apic.c +++ b/arch/i386/kernel/apic.c | |||
| @@ -559,14 +559,20 @@ void __devinit setup_local_APIC(void) | |||
| 559 | * If Linux enabled the LAPIC against the BIOS default | 559 | * If Linux enabled the LAPIC against the BIOS default |
| 560 | * disable it down before re-entering the BIOS on shutdown. | 560 | * disable it down before re-entering the BIOS on shutdown. |
| 561 | * Otherwise the BIOS may get confused and not power-off. | 561 | * Otherwise the BIOS may get confused and not power-off. |
| 562 | * Additionally clear all LVT entries before disable_local_APIC | ||
| 563 | * for the case where Linux didn't enable the LAPIC. | ||
| 562 | */ | 564 | */ |
| 563 | void lapic_shutdown(void) | 565 | void lapic_shutdown(void) |
| 564 | { | 566 | { |
| 565 | if (!cpu_has_apic || !enabled_via_apicbase) | 567 | if (!cpu_has_apic) |
| 566 | return; | 568 | return; |
| 567 | 569 | ||
| 568 | local_irq_disable(); | 570 | local_irq_disable(); |
| 569 | disable_local_APIC(); | 571 | clear_local_APIC(); |
| 572 | |||
| 573 | if (enabled_via_apicbase) | ||
| 574 | disable_local_APIC(); | ||
| 575 | |||
| 570 | local_irq_enable(); | 576 | local_irq_enable(); |
| 571 | } | 577 | } |
| 572 | 578 | ||
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index d2ef0c2aa93e..003548b8735f 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c | |||
| @@ -447,8 +447,7 @@ static char * apm_event_name[] = { | |||
| 447 | "system standby resume", | 447 | "system standby resume", |
| 448 | "capabilities change" | 448 | "capabilities change" |
| 449 | }; | 449 | }; |
| 450 | #define NR_APM_EVENT_NAME \ | 450 | #define NR_APM_EVENT_NAME ARRAY_SIZE(apm_event_name) |
| 451 | (sizeof(apm_event_name) / sizeof(apm_event_name[0])) | ||
| 452 | 451 | ||
| 453 | typedef struct lookup_t { | 452 | typedef struct lookup_t { |
| 454 | int key; | 453 | int key; |
| @@ -479,7 +478,7 @@ static const lookup_t error_table[] = { | |||
| 479 | { APM_NO_ERROR, "BIOS did not set a return code" }, | 478 | { APM_NO_ERROR, "BIOS did not set a return code" }, |
| 480 | { APM_NOT_PRESENT, "No APM present" } | 479 | { APM_NOT_PRESENT, "No APM present" } |
| 481 | }; | 480 | }; |
| 482 | #define ERROR_COUNT (sizeof(error_table)/sizeof(lookup_t)) | 481 | #define ERROR_COUNT ARRAY_SIZE(error_table) |
| 483 | 482 | ||
| 484 | /** | 483 | /** |
| 485 | * apm_error - display an APM error | 484 | * apm_error - display an APM error |
| @@ -770,8 +769,26 @@ static int set_system_power_state(u_short state) | |||
| 770 | static int apm_do_idle(void) | 769 | static int apm_do_idle(void) |
| 771 | { | 770 | { |
| 772 | u32 eax; | 771 | u32 eax; |
| 772 | u8 ret = 0; | ||
| 773 | int idled = 0; | ||
| 774 | int polling; | ||
| 775 | |||
| 776 | polling = test_thread_flag(TIF_POLLING_NRFLAG); | ||
| 777 | if (polling) { | ||
| 778 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
| 779 | smp_mb__after_clear_bit(); | ||
| 780 | } | ||
| 781 | if (!need_resched()) { | ||
| 782 | idled = 1; | ||
| 783 | ret = apm_bios_call_simple(APM_FUNC_IDLE, 0, 0, &eax); | ||
| 784 | } | ||
| 785 | if (polling) | ||
| 786 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
| 787 | |||
| 788 | if (!idled) | ||
| 789 | return 0; | ||
| 773 | 790 | ||
| 774 | if (apm_bios_call_simple(APM_FUNC_IDLE, 0, 0, &eax)) { | 791 | if (ret) { |
| 775 | static unsigned long t; | 792 | static unsigned long t; |
| 776 | 793 | ||
| 777 | /* This always fails on some SMP boards running UP kernels. | 794 | /* This always fails on some SMP boards running UP kernels. |
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 74145a33cb0f..c145fb30002e 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
| @@ -30,8 +30,6 @@ static int disable_x86_serial_nr __devinitdata = 1; | |||
| 30 | 30 | ||
| 31 | struct cpu_dev * cpu_devs[X86_VENDOR_NUM] = {}; | 31 | struct cpu_dev * cpu_devs[X86_VENDOR_NUM] = {}; |
| 32 | 32 | ||
| 33 | extern void mcheck_init(struct cpuinfo_x86 *c); | ||
| 34 | |||
| 35 | extern int disable_pse; | 33 | extern int disable_pse; |
| 36 | 34 | ||
| 37 | static void default_init(struct cpuinfo_x86 * c) | 35 | static void default_init(struct cpuinfo_x86 * c) |
| @@ -429,9 +427,8 @@ void __devinit identify_cpu(struct cpuinfo_x86 *c) | |||
| 429 | } | 427 | } |
| 430 | 428 | ||
| 431 | /* Init Machine Check Exception if available. */ | 429 | /* Init Machine Check Exception if available. */ |
| 432 | #ifdef CONFIG_X86_MCE | ||
| 433 | mcheck_init(c); | 430 | mcheck_init(c); |
| 434 | #endif | 431 | |
| 435 | if (c == &boot_cpu_data) | 432 | if (c == &boot_cpu_data) |
| 436 | sysenter_setup(); | 433 | sysenter_setup(); |
| 437 | enable_sep_cpu(); | 434 | enable_sep_cpu(); |
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index caa9f7711343..871366b83b3f 100644 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
| @@ -377,10 +377,9 @@ acpi_cpufreq_cpu_init ( | |||
| 377 | arg0.buffer.length = 12; | 377 | arg0.buffer.length = 12; |
| 378 | arg0.buffer.pointer = (u8 *) arg0_buf; | 378 | arg0.buffer.pointer = (u8 *) arg0_buf; |
| 379 | 379 | ||
| 380 | data = kmalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); | 380 | data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); |
| 381 | if (!data) | 381 | if (!data) |
| 382 | return (-ENOMEM); | 382 | return (-ENOMEM); |
| 383 | memset(data, 0, sizeof(struct cpufreq_acpi_io)); | ||
| 384 | 383 | ||
| 385 | acpi_io_data[cpu] = data; | 384 | acpi_io_data[cpu] = data; |
| 386 | 385 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c index 73a5dc5b26b8..edcd626001da 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c | |||
| @@ -171,10 +171,9 @@ static int get_ranges (unsigned char *pst) | |||
| 171 | unsigned int speed; | 171 | unsigned int speed; |
| 172 | u8 fid, vid; | 172 | u8 fid, vid; |
| 173 | 173 | ||
| 174 | powernow_table = kmalloc((sizeof(struct cpufreq_frequency_table) * (number_scales + 1)), GFP_KERNEL); | 174 | powernow_table = kzalloc((sizeof(struct cpufreq_frequency_table) * (number_scales + 1)), GFP_KERNEL); |
| 175 | if (!powernow_table) | 175 | if (!powernow_table) |
| 176 | return -ENOMEM; | 176 | return -ENOMEM; |
| 177 | memset(powernow_table, 0, (sizeof(struct cpufreq_frequency_table) * (number_scales + 1))); | ||
| 178 | 177 | ||
| 179 | for (j=0 ; j < number_scales; j++) { | 178 | for (j=0 ; j < number_scales; j++) { |
| 180 | fid = *pst++; | 179 | fid = *pst++; |
| @@ -305,16 +304,13 @@ static int powernow_acpi_init(void) | |||
| 305 | goto err0; | 304 | goto err0; |
| 306 | } | 305 | } |
| 307 | 306 | ||
| 308 | acpi_processor_perf = kmalloc(sizeof(struct acpi_processor_performance), | 307 | acpi_processor_perf = kzalloc(sizeof(struct acpi_processor_performance), |
| 309 | GFP_KERNEL); | 308 | GFP_KERNEL); |
| 310 | |||
| 311 | if (!acpi_processor_perf) { | 309 | if (!acpi_processor_perf) { |
| 312 | retval = -ENOMEM; | 310 | retval = -ENOMEM; |
| 313 | goto err0; | 311 | goto err0; |
| 314 | } | 312 | } |
| 315 | 313 | ||
| 316 | memset(acpi_processor_perf, 0, sizeof(struct acpi_processor_performance)); | ||
| 317 | |||
| 318 | if (acpi_processor_register_performance(acpi_processor_perf, 0)) { | 314 | if (acpi_processor_register_performance(acpi_processor_perf, 0)) { |
| 319 | retval = -EIO; | 315 | retval = -EIO; |
| 320 | goto err1; | 316 | goto err1; |
| @@ -337,14 +333,12 @@ static int powernow_acpi_init(void) | |||
| 337 | goto err2; | 333 | goto err2; |
| 338 | } | 334 | } |
| 339 | 335 | ||
| 340 | powernow_table = kmalloc((number_scales + 1) * (sizeof(struct cpufreq_frequency_table)), GFP_KERNEL); | 336 | powernow_table = kzalloc((number_scales + 1) * (sizeof(struct cpufreq_frequency_table)), GFP_KERNEL); |
| 341 | if (!powernow_table) { | 337 | if (!powernow_table) { |
| 342 | retval = -ENOMEM; | 338 | retval = -ENOMEM; |
| 343 | goto err2; | 339 | goto err2; |
| 344 | } | 340 | } |
| 345 | 341 | ||
| 346 | memset(powernow_table, 0, ((number_scales + 1) * sizeof(struct cpufreq_frequency_table))); | ||
| 347 | |||
| 348 | pc.val = (unsigned long) acpi_processor_perf->states[0].control; | 342 | pc.val = (unsigned long) acpi_processor_perf->states[0].control; |
| 349 | for (i = 0; i < number_scales; i++) { | 343 | for (i = 0; i < number_scales; i++) { |
| 350 | u8 fid, vid; | 344 | u8 fid, vid; |
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index 2d5c9adba0cd..68a1fc87f4ca 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c | |||
| @@ -462,7 +462,6 @@ static int check_supported_cpu(unsigned int cpu) | |||
| 462 | 462 | ||
| 463 | oldmask = current->cpus_allowed; | 463 | oldmask = current->cpus_allowed; |
| 464 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | 464 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); |
| 465 | schedule(); | ||
| 466 | 465 | ||
| 467 | if (smp_processor_id() != cpu) { | 466 | if (smp_processor_id() != cpu) { |
| 468 | printk(KERN_ERR "limiting to cpu %u failed\n", cpu); | 467 | printk(KERN_ERR "limiting to cpu %u failed\n", cpu); |
| @@ -497,9 +496,7 @@ static int check_supported_cpu(unsigned int cpu) | |||
| 497 | 496 | ||
| 498 | out: | 497 | out: |
| 499 | set_cpus_allowed(current, oldmask); | 498 | set_cpus_allowed(current, oldmask); |
| 500 | schedule(); | ||
| 501 | return rc; | 499 | return rc; |
| 502 | |||
| 503 | } | 500 | } |
| 504 | 501 | ||
| 505 | static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8 maxvid) | 502 | static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8 maxvid) |
| @@ -913,7 +910,6 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
| 913 | /* only run on specific CPU from here on */ | 910 | /* only run on specific CPU from here on */ |
| 914 | oldmask = current->cpus_allowed; | 911 | oldmask = current->cpus_allowed; |
| 915 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); | 912 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); |
| 916 | schedule(); | ||
| 917 | 913 | ||
| 918 | if (smp_processor_id() != pol->cpu) { | 914 | if (smp_processor_id() != pol->cpu) { |
| 919 | printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); | 915 | printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); |
| @@ -968,8 +964,6 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
| 968 | 964 | ||
| 969 | err_out: | 965 | err_out: |
| 970 | set_cpus_allowed(current, oldmask); | 966 | set_cpus_allowed(current, oldmask); |
| 971 | schedule(); | ||
| 972 | |||
| 973 | return ret; | 967 | return ret; |
| 974 | } | 968 | } |
| 975 | 969 | ||
| @@ -991,12 +985,11 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 991 | if (!check_supported_cpu(pol->cpu)) | 985 | if (!check_supported_cpu(pol->cpu)) |
| 992 | return -ENODEV; | 986 | return -ENODEV; |
| 993 | 987 | ||
| 994 | data = kmalloc(sizeof(struct powernow_k8_data), GFP_KERNEL); | 988 | data = kzalloc(sizeof(struct powernow_k8_data), GFP_KERNEL); |
| 995 | if (!data) { | 989 | if (!data) { |
| 996 | printk(KERN_ERR PFX "unable to alloc powernow_k8_data"); | 990 | printk(KERN_ERR PFX "unable to alloc powernow_k8_data"); |
| 997 | return -ENOMEM; | 991 | return -ENOMEM; |
| 998 | } | 992 | } |
| 999 | memset(data,0,sizeof(struct powernow_k8_data)); | ||
| 1000 | 993 | ||
| 1001 | data->cpu = pol->cpu; | 994 | data->cpu = pol->cpu; |
| 1002 | 995 | ||
| @@ -1026,7 +1019,6 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 1026 | /* only run on specific CPU from here on */ | 1019 | /* only run on specific CPU from here on */ |
| 1027 | oldmask = current->cpus_allowed; | 1020 | oldmask = current->cpus_allowed; |
| 1028 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); | 1021 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); |
| 1029 | schedule(); | ||
| 1030 | 1022 | ||
| 1031 | if (smp_processor_id() != pol->cpu) { | 1023 | if (smp_processor_id() != pol->cpu) { |
| 1032 | printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); | 1024 | printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); |
| @@ -1045,7 +1037,6 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 1045 | 1037 | ||
| 1046 | /* run on any CPU again */ | 1038 | /* run on any CPU again */ |
| 1047 | set_cpus_allowed(current, oldmask); | 1039 | set_cpus_allowed(current, oldmask); |
| 1048 | schedule(); | ||
| 1049 | 1040 | ||
| 1050 | pol->governor = CPUFREQ_DEFAULT_GOVERNOR; | 1041 | pol->governor = CPUFREQ_DEFAULT_GOVERNOR; |
| 1051 | pol->cpus = cpu_core_map[pol->cpu]; | 1042 | pol->cpus = cpu_core_map[pol->cpu]; |
| @@ -1080,7 +1071,6 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 1080 | 1071 | ||
| 1081 | err_out: | 1072 | err_out: |
| 1082 | set_cpus_allowed(current, oldmask); | 1073 | set_cpus_allowed(current, oldmask); |
| 1083 | schedule(); | ||
| 1084 | powernow_k8_cpu_exit_acpi(data); | 1074 | powernow_k8_cpu_exit_acpi(data); |
| 1085 | 1075 | ||
| 1086 | kfree(data); | 1076 | kfree(data); |
| @@ -1116,17 +1106,14 @@ static unsigned int powernowk8_get (unsigned int cpu) | |||
| 1116 | set_cpus_allowed(current, oldmask); | 1106 | set_cpus_allowed(current, oldmask); |
| 1117 | return 0; | 1107 | return 0; |
| 1118 | } | 1108 | } |
| 1119 | preempt_disable(); | 1109 | |
| 1120 | |||
| 1121 | if (query_current_values_with_pending_wait(data)) | 1110 | if (query_current_values_with_pending_wait(data)) |
| 1122 | goto out; | 1111 | goto out; |
| 1123 | 1112 | ||
| 1124 | khz = find_khz_freq_from_fid(data->currfid); | 1113 | khz = find_khz_freq_from_fid(data->currfid); |
| 1125 | 1114 | ||
| 1126 | out: | 1115 | out: |
| 1127 | preempt_enable_no_resched(); | ||
| 1128 | set_cpus_allowed(current, oldmask); | 1116 | set_cpus_allowed(current, oldmask); |
| 1129 | |||
| 1130 | return khz; | 1117 | return khz; |
| 1131 | } | 1118 | } |
| 1132 | 1119 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c index 1465974256c9..edb9873e27e3 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | |||
| @@ -67,7 +67,7 @@ static const struct cpu_id cpu_ids[] = { | |||
| 67 | [CPU_MP4HT_D0] = {15, 3, 4 }, | 67 | [CPU_MP4HT_D0] = {15, 3, 4 }, |
| 68 | [CPU_MP4HT_E0] = {15, 4, 1 }, | 68 | [CPU_MP4HT_E0] = {15, 4, 1 }, |
| 69 | }; | 69 | }; |
| 70 | #define N_IDS (sizeof(cpu_ids)/sizeof(cpu_ids[0])) | 70 | #define N_IDS ARRAY_SIZE(cpu_ids) |
| 71 | 71 | ||
| 72 | struct cpu_model | 72 | struct cpu_model |
| 73 | { | 73 | { |
| @@ -423,12 +423,11 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | |||
| 423 | } | 423 | } |
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | centrino_model[cpu] = kmalloc(sizeof(struct cpu_model), GFP_KERNEL); | 426 | centrino_model[cpu] = kzalloc(sizeof(struct cpu_model), GFP_KERNEL); |
| 427 | if (!centrino_model[cpu]) { | 427 | if (!centrino_model[cpu]) { |
| 428 | result = -ENOMEM; | 428 | result = -ENOMEM; |
| 429 | goto err_unreg; | 429 | goto err_unreg; |
| 430 | } | 430 | } |
| 431 | memset(centrino_model[cpu], 0, sizeof(struct cpu_model)); | ||
| 432 | 431 | ||
| 433 | centrino_model[cpu]->model_name=NULL; | 432 | centrino_model[cpu]->model_name=NULL; |
| 434 | centrino_model[cpu]->max_freq = p.states[0].core_frequency * 1000; | 433 | centrino_model[cpu]->max_freq = p.states[0].core_frequency * 1000; |
diff --git a/arch/i386/kernel/cpu/mcheck/k7.c b/arch/i386/kernel/cpu/mcheck/k7.c index 7c6b9c73522f..fc5d5215e23d 100644 --- a/arch/i386/kernel/cpu/mcheck/k7.c +++ b/arch/i386/kernel/cpu/mcheck/k7.c | |||
| @@ -68,7 +68,7 @@ static fastcall void k7_machine_check(struct pt_regs * regs, long error_code) | |||
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | /* AMD K7 machine check is Intel like */ | 70 | /* AMD K7 machine check is Intel like */ |
| 71 | void __devinit amd_mcheck_init(struct cpuinfo_x86 *c) | 71 | void amd_mcheck_init(struct cpuinfo_x86 *c) |
| 72 | { | 72 | { |
| 73 | u32 l, h; | 73 | u32 l, h; |
| 74 | int i; | 74 | int i; |
diff --git a/arch/i386/kernel/cpu/mcheck/mce.c b/arch/i386/kernel/cpu/mcheck/mce.c index 2cf25d2ba0f1..6170af3c271a 100644 --- a/arch/i386/kernel/cpu/mcheck/mce.c +++ b/arch/i386/kernel/cpu/mcheck/mce.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #include "mce.h" | 17 | #include "mce.h" |
| 18 | 18 | ||
| 19 | int mce_disabled __devinitdata = 0; | 19 | int mce_disabled = 0; |
| 20 | int nr_mce_banks; | 20 | int nr_mce_banks; |
| 21 | 21 | ||
| 22 | EXPORT_SYMBOL_GPL(nr_mce_banks); /* non-fatal.o */ | 22 | EXPORT_SYMBOL_GPL(nr_mce_banks); /* non-fatal.o */ |
| @@ -31,7 +31,7 @@ static fastcall void unexpected_machine_check(struct pt_regs * regs, long error_ | |||
| 31 | void fastcall (*machine_check_vector)(struct pt_regs *, long error_code) = unexpected_machine_check; | 31 | void fastcall (*machine_check_vector)(struct pt_regs *, long error_code) = unexpected_machine_check; |
| 32 | 32 | ||
| 33 | /* This has to be run for each processor */ | 33 | /* This has to be run for each processor */ |
| 34 | void __devinit mcheck_init(struct cpuinfo_x86 *c) | 34 | void mcheck_init(struct cpuinfo_x86 *c) |
| 35 | { | 35 | { |
| 36 | if (mce_disabled==1) | 36 | if (mce_disabled==1) |
| 37 | return; | 37 | return; |
diff --git a/arch/i386/kernel/cpu/mcheck/p4.c b/arch/i386/kernel/cpu/mcheck/p4.c index 1d1e885f500a..fd2c459a31ef 100644 --- a/arch/i386/kernel/cpu/mcheck/p4.c +++ b/arch/i386/kernel/cpu/mcheck/p4.c | |||
| @@ -77,7 +77,7 @@ fastcall void smp_thermal_interrupt(struct pt_regs *regs) | |||
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | /* P4/Xeon Thermal regulation detect and init */ | 79 | /* P4/Xeon Thermal regulation detect and init */ |
| 80 | static void __devinit intel_init_thermal(struct cpuinfo_x86 *c) | 80 | static void intel_init_thermal(struct cpuinfo_x86 *c) |
| 81 | { | 81 | { |
| 82 | u32 l, h; | 82 | u32 l, h; |
| 83 | unsigned int cpu = smp_processor_id(); | 83 | unsigned int cpu = smp_processor_id(); |
| @@ -231,7 +231,7 @@ static fastcall void intel_machine_check(struct pt_regs * regs, long error_code) | |||
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | 233 | ||
| 234 | void __devinit intel_p4_mcheck_init(struct cpuinfo_x86 *c) | 234 | void intel_p4_mcheck_init(struct cpuinfo_x86 *c) |
| 235 | { | 235 | { |
| 236 | u32 l, h; | 236 | u32 l, h; |
| 237 | int i; | 237 | int i; |
diff --git a/arch/i386/kernel/cpu/mcheck/p5.c b/arch/i386/kernel/cpu/mcheck/p5.c index 3a2e24baddc7..94bc43d950cf 100644 --- a/arch/i386/kernel/cpu/mcheck/p5.c +++ b/arch/i386/kernel/cpu/mcheck/p5.c | |||
| @@ -28,7 +28,7 @@ static fastcall void pentium_machine_check(struct pt_regs * regs, long error_cod | |||
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | /* Set up machine check reporting for processors with Intel style MCE */ | 30 | /* Set up machine check reporting for processors with Intel style MCE */ |
| 31 | void __devinit intel_p5_mcheck_init(struct cpuinfo_x86 *c) | 31 | void intel_p5_mcheck_init(struct cpuinfo_x86 *c) |
| 32 | { | 32 | { |
| 33 | u32 l, h; | 33 | u32 l, h; |
| 34 | 34 | ||
diff --git a/arch/i386/kernel/cpu/mcheck/p6.c b/arch/i386/kernel/cpu/mcheck/p6.c index 979b18bc95c1..deeae42ce199 100644 --- a/arch/i386/kernel/cpu/mcheck/p6.c +++ b/arch/i386/kernel/cpu/mcheck/p6.c | |||
| @@ -79,7 +79,7 @@ static fastcall void intel_machine_check(struct pt_regs * regs, long error_code) | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | /* Set up machine check reporting for processors with Intel style MCE */ | 81 | /* Set up machine check reporting for processors with Intel style MCE */ |
| 82 | void __devinit intel_p6_mcheck_init(struct cpuinfo_x86 *c) | 82 | void intel_p6_mcheck_init(struct cpuinfo_x86 *c) |
| 83 | { | 83 | { |
| 84 | u32 l, h; | 84 | u32 l, h; |
| 85 | int i; | 85 | int i; |
diff --git a/arch/i386/kernel/cpu/mcheck/winchip.c b/arch/i386/kernel/cpu/mcheck/winchip.c index 5b9d2dd411d3..9e424b6c293d 100644 --- a/arch/i386/kernel/cpu/mcheck/winchip.c +++ b/arch/i386/kernel/cpu/mcheck/winchip.c | |||
| @@ -22,7 +22,7 @@ static fastcall void winchip_machine_check(struct pt_regs * regs, long error_cod | |||
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | /* Set up machine check reporting on the Winchip C6 series */ | 24 | /* Set up machine check reporting on the Winchip C6 series */ |
| 25 | void __devinit winchip_mcheck_init(struct cpuinfo_x86 *c) | 25 | void winchip_mcheck_init(struct cpuinfo_x86 *c) |
| 26 | { | 26 | { |
| 27 | u32 lo, hi; | 27 | u32 lo, hi; |
| 28 | machine_check_vector = winchip_machine_check; | 28 | machine_check_vector = winchip_machine_check; |
diff --git a/arch/i386/kernel/ioport.c b/arch/i386/kernel/ioport.c index f2b37654777f..b59a34dbe262 100644 --- a/arch/i386/kernel/ioport.c +++ b/arch/i386/kernel/ioport.c | |||
| @@ -108,8 +108,11 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) | |||
| 108 | /* | 108 | /* |
| 109 | * Sets the lazy trigger so that the next I/O operation will | 109 | * Sets the lazy trigger so that the next I/O operation will |
| 110 | * reload the correct bitmap. | 110 | * reload the correct bitmap. |
| 111 | * Reset the owner so that a process switch will not set | ||
| 112 | * tss->io_bitmap_base to IO_BITMAP_OFFSET. | ||
| 111 | */ | 113 | */ |
| 112 | tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET_LAZY; | 114 | tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET_LAZY; |
| 115 | tss->io_bitmap_owner = NULL; | ||
| 113 | 116 | ||
| 114 | put_cpu(); | 117 | put_cpu(); |
| 115 | 118 | ||
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index 6345b430b105..32b0c24ab9a6 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c | |||
| @@ -31,22 +31,16 @@ | |||
| 31 | #include <linux/config.h> | 31 | #include <linux/config.h> |
| 32 | #include <linux/kprobes.h> | 32 | #include <linux/kprobes.h> |
| 33 | #include <linux/ptrace.h> | 33 | #include <linux/ptrace.h> |
| 34 | #include <linux/spinlock.h> | ||
| 35 | #include <linux/preempt.h> | 34 | #include <linux/preempt.h> |
| 36 | #include <asm/cacheflush.h> | 35 | #include <asm/cacheflush.h> |
| 37 | #include <asm/kdebug.h> | 36 | #include <asm/kdebug.h> |
| 38 | #include <asm/desc.h> | 37 | #include <asm/desc.h> |
| 39 | 38 | ||
| 40 | static struct kprobe *current_kprobe; | ||
| 41 | static unsigned long kprobe_status, kprobe_old_eflags, kprobe_saved_eflags; | ||
| 42 | static struct kprobe *kprobe_prev; | ||
| 43 | static unsigned long kprobe_status_prev, kprobe_old_eflags_prev, kprobe_saved_eflags_prev; | ||
| 44 | static struct pt_regs jprobe_saved_regs; | ||
| 45 | static long *jprobe_saved_esp; | ||
| 46 | /* copy of the kernel stack at the probe fire time */ | ||
| 47 | static kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; | ||
| 48 | void jprobe_return_end(void); | 39 | void jprobe_return_end(void); |
| 49 | 40 | ||
| 41 | DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; | ||
| 42 | DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | ||
| 43 | |||
| 50 | /* | 44 | /* |
| 51 | * returns non-zero if opcode modifies the interrupt flag. | 45 | * returns non-zero if opcode modifies the interrupt flag. |
| 52 | */ | 46 | */ |
| @@ -91,29 +85,30 @@ void __kprobes arch_remove_kprobe(struct kprobe *p) | |||
| 91 | { | 85 | { |
| 92 | } | 86 | } |
| 93 | 87 | ||
| 94 | static inline void save_previous_kprobe(void) | 88 | static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) |
| 95 | { | 89 | { |
| 96 | kprobe_prev = current_kprobe; | 90 | kcb->prev_kprobe.kp = kprobe_running(); |
| 97 | kprobe_status_prev = kprobe_status; | 91 | kcb->prev_kprobe.status = kcb->kprobe_status; |
| 98 | kprobe_old_eflags_prev = kprobe_old_eflags; | 92 | kcb->prev_kprobe.old_eflags = kcb->kprobe_old_eflags; |
| 99 | kprobe_saved_eflags_prev = kprobe_saved_eflags; | 93 | kcb->prev_kprobe.saved_eflags = kcb->kprobe_saved_eflags; |
| 100 | } | 94 | } |
| 101 | 95 | ||
| 102 | static inline void restore_previous_kprobe(void) | 96 | static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) |
| 103 | { | 97 | { |
| 104 | current_kprobe = kprobe_prev; | 98 | __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; |
| 105 | kprobe_status = kprobe_status_prev; | 99 | kcb->kprobe_status = kcb->prev_kprobe.status; |
| 106 | kprobe_old_eflags = kprobe_old_eflags_prev; | 100 | kcb->kprobe_old_eflags = kcb->prev_kprobe.old_eflags; |
| 107 | kprobe_saved_eflags = kprobe_saved_eflags_prev; | 101 | kcb->kprobe_saved_eflags = kcb->prev_kprobe.saved_eflags; |
| 108 | } | 102 | } |
| 109 | 103 | ||
| 110 | static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs) | 104 | static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, |
| 105 | struct kprobe_ctlblk *kcb) | ||
| 111 | { | 106 | { |
| 112 | current_kprobe = p; | 107 | __get_cpu_var(current_kprobe) = p; |
| 113 | kprobe_saved_eflags = kprobe_old_eflags | 108 | kcb->kprobe_saved_eflags = kcb->kprobe_old_eflags |
| 114 | = (regs->eflags & (TF_MASK | IF_MASK)); | 109 | = (regs->eflags & (TF_MASK | IF_MASK)); |
| 115 | if (is_IF_modifier(p->opcode)) | 110 | if (is_IF_modifier(p->opcode)) |
| 116 | kprobe_saved_eflags &= ~IF_MASK; | 111 | kcb->kprobe_saved_eflags &= ~IF_MASK; |
| 117 | } | 112 | } |
| 118 | 113 | ||
| 119 | static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) | 114 | static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) |
| @@ -127,6 +122,7 @@ static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) | |||
| 127 | regs->eip = (unsigned long)&p->ainsn.insn; | 122 | regs->eip = (unsigned long)&p->ainsn.insn; |
| 128 | } | 123 | } |
| 129 | 124 | ||
| 125 | /* Called with kretprobe_lock held */ | ||
| 130 | void __kprobes arch_prepare_kretprobe(struct kretprobe *rp, | 126 | void __kprobes arch_prepare_kretprobe(struct kretprobe *rp, |
| 131 | struct pt_regs *regs) | 127 | struct pt_regs *regs) |
| 132 | { | 128 | { |
| @@ -157,9 +153,15 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
| 157 | int ret = 0; | 153 | int ret = 0; |
| 158 | kprobe_opcode_t *addr = NULL; | 154 | kprobe_opcode_t *addr = NULL; |
| 159 | unsigned long *lp; | 155 | unsigned long *lp; |
| 156 | struct kprobe_ctlblk *kcb; | ||
| 160 | 157 | ||
| 161 | /* We're in an interrupt, but this is clear and BUG()-safe. */ | 158 | /* |
| 159 | * We don't want to be preempted for the entire | ||
| 160 | * duration of kprobe processing | ||
| 161 | */ | ||
| 162 | preempt_disable(); | 162 | preempt_disable(); |
| 163 | kcb = get_kprobe_ctlblk(); | ||
| 164 | |||
| 163 | /* Check if the application is using LDT entry for its code segment and | 165 | /* Check if the application is using LDT entry for its code segment and |
| 164 | * calculate the address by reading the base address from the LDT entry. | 166 | * calculate the address by reading the base address from the LDT entry. |
| 165 | */ | 167 | */ |
| @@ -173,15 +175,12 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
| 173 | } | 175 | } |
| 174 | /* Check we're not actually recursing */ | 176 | /* Check we're not actually recursing */ |
| 175 | if (kprobe_running()) { | 177 | if (kprobe_running()) { |
| 176 | /* We *are* holding lock here, so this is safe. | ||
| 177 | Disarm the probe we just hit, and ignore it. */ | ||
| 178 | p = get_kprobe(addr); | 178 | p = get_kprobe(addr); |
| 179 | if (p) { | 179 | if (p) { |
| 180 | if (kprobe_status == KPROBE_HIT_SS && | 180 | if (kcb->kprobe_status == KPROBE_HIT_SS && |
| 181 | *p->ainsn.insn == BREAKPOINT_INSTRUCTION) { | 181 | *p->ainsn.insn == BREAKPOINT_INSTRUCTION) { |
| 182 | regs->eflags &= ~TF_MASK; | 182 | regs->eflags &= ~TF_MASK; |
| 183 | regs->eflags |= kprobe_saved_eflags; | 183 | regs->eflags |= kcb->kprobe_saved_eflags; |
| 184 | unlock_kprobes(); | ||
| 185 | goto no_kprobe; | 184 | goto no_kprobe; |
| 186 | } | 185 | } |
| 187 | /* We have reentered the kprobe_handler(), since | 186 | /* We have reentered the kprobe_handler(), since |
| @@ -190,26 +189,23 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
| 190 | * just single step on the instruction of the new probe | 189 | * just single step on the instruction of the new probe |
| 191 | * without calling any user handlers. | 190 | * without calling any user handlers. |
| 192 | */ | 191 | */ |
| 193 | save_previous_kprobe(); | 192 | save_previous_kprobe(kcb); |
| 194 | set_current_kprobe(p, regs); | 193 | set_current_kprobe(p, regs, kcb); |
| 195 | p->nmissed++; | 194 | p->nmissed++; |
| 196 | prepare_singlestep(p, regs); | 195 | prepare_singlestep(p, regs); |
| 197 | kprobe_status = KPROBE_REENTER; | 196 | kcb->kprobe_status = KPROBE_REENTER; |
| 198 | return 1; | 197 | return 1; |
| 199 | } else { | 198 | } else { |
| 200 | p = current_kprobe; | 199 | p = __get_cpu_var(current_kprobe); |
| 201 | if (p->break_handler && p->break_handler(p, regs)) { | 200 | if (p->break_handler && p->break_handler(p, regs)) { |
| 202 | goto ss_probe; | 201 | goto ss_probe; |
| 203 | } | 202 | } |
| 204 | } | 203 | } |
| 205 | /* If it's not ours, can't be delete race, (we hold lock). */ | ||
| 206 | goto no_kprobe; | 204 | goto no_kprobe; |
| 207 | } | 205 | } |
| 208 | 206 | ||
| 209 | lock_kprobes(); | ||
| 210 | p = get_kprobe(addr); | 207 | p = get_kprobe(addr); |
| 211 | if (!p) { | 208 | if (!p) { |
| 212 | unlock_kprobes(); | ||
| 213 | if (regs->eflags & VM_MASK) { | 209 | if (regs->eflags & VM_MASK) { |
| 214 | /* We are in virtual-8086 mode. Return 0 */ | 210 | /* We are in virtual-8086 mode. Return 0 */ |
| 215 | goto no_kprobe; | 211 | goto no_kprobe; |
| @@ -232,8 +228,8 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
| 232 | goto no_kprobe; | 228 | goto no_kprobe; |
| 233 | } | 229 | } |
| 234 | 230 | ||
| 235 | kprobe_status = KPROBE_HIT_ACTIVE; | 231 | set_current_kprobe(p, regs, kcb); |
| 236 | set_current_kprobe(p, regs); | 232 | kcb->kprobe_status = KPROBE_HIT_ACTIVE; |
| 237 | 233 | ||
| 238 | if (p->pre_handler && p->pre_handler(p, regs)) | 234 | if (p->pre_handler && p->pre_handler(p, regs)) |
| 239 | /* handler has already set things up, so skip ss setup */ | 235 | /* handler has already set things up, so skip ss setup */ |
| @@ -241,7 +237,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
| 241 | 237 | ||
| 242 | ss_probe: | 238 | ss_probe: |
| 243 | prepare_singlestep(p, regs); | 239 | prepare_singlestep(p, regs); |
| 244 | kprobe_status = KPROBE_HIT_SS; | 240 | kcb->kprobe_status = KPROBE_HIT_SS; |
| 245 | return 1; | 241 | return 1; |
| 246 | 242 | ||
| 247 | no_kprobe: | 243 | no_kprobe: |
| @@ -269,9 +265,10 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | |||
| 269 | struct kretprobe_instance *ri = NULL; | 265 | struct kretprobe_instance *ri = NULL; |
| 270 | struct hlist_head *head; | 266 | struct hlist_head *head; |
| 271 | struct hlist_node *node, *tmp; | 267 | struct hlist_node *node, *tmp; |
| 272 | unsigned long orig_ret_address = 0; | 268 | unsigned long flags, orig_ret_address = 0; |
| 273 | unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; | 269 | unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; |
| 274 | 270 | ||
| 271 | spin_lock_irqsave(&kretprobe_lock, flags); | ||
| 275 | head = kretprobe_inst_table_head(current); | 272 | head = kretprobe_inst_table_head(current); |
| 276 | 273 | ||
| 277 | /* | 274 | /* |
| @@ -310,14 +307,15 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | |||
| 310 | BUG_ON(!orig_ret_address || (orig_ret_address == trampoline_address)); | 307 | BUG_ON(!orig_ret_address || (orig_ret_address == trampoline_address)); |
| 311 | regs->eip = orig_ret_address; | 308 | regs->eip = orig_ret_address; |
| 312 | 309 | ||
| 313 | unlock_kprobes(); | 310 | reset_current_kprobe(); |
| 311 | spin_unlock_irqrestore(&kretprobe_lock, flags); | ||
| 314 | preempt_enable_no_resched(); | 312 | preempt_enable_no_resched(); |
| 315 | 313 | ||
| 316 | /* | 314 | /* |
| 317 | * By returning a non-zero value, we are telling | 315 | * By returning a non-zero value, we are telling |
| 318 | * kprobe_handler() that we have handled unlocking | 316 | * kprobe_handler() that we don't want the post_handler |
| 319 | * and re-enabling preemption. | 317 | * to run (and have re-enabled preemption) |
| 320 | */ | 318 | */ |
| 321 | return 1; | 319 | return 1; |
| 322 | } | 320 | } |
| 323 | 321 | ||
| @@ -343,7 +341,8 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | |||
| 343 | * that is atop the stack is the address following the copied instruction. | 341 | * that is atop the stack is the address following the copied instruction. |
| 344 | * We need to make it the address following the original instruction. | 342 | * We need to make it the address following the original instruction. |
| 345 | */ | 343 | */ |
| 346 | static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) | 344 | static void __kprobes resume_execution(struct kprobe *p, |
| 345 | struct pt_regs *regs, struct kprobe_ctlblk *kcb) | ||
| 347 | { | 346 | { |
| 348 | unsigned long *tos = (unsigned long *)®s->esp; | 347 | unsigned long *tos = (unsigned long *)®s->esp; |
| 349 | unsigned long next_eip = 0; | 348 | unsigned long next_eip = 0; |
| @@ -353,7 +352,7 @@ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) | |||
| 353 | switch (p->ainsn.insn[0]) { | 352 | switch (p->ainsn.insn[0]) { |
| 354 | case 0x9c: /* pushfl */ | 353 | case 0x9c: /* pushfl */ |
| 355 | *tos &= ~(TF_MASK | IF_MASK); | 354 | *tos &= ~(TF_MASK | IF_MASK); |
| 356 | *tos |= kprobe_old_eflags; | 355 | *tos |= kcb->kprobe_old_eflags; |
| 357 | break; | 356 | break; |
| 358 | case 0xc3: /* ret/lret */ | 357 | case 0xc3: /* ret/lret */ |
| 359 | case 0xcb: | 358 | case 0xcb: |
| @@ -394,27 +393,30 @@ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) | |||
| 394 | 393 | ||
| 395 | /* | 394 | /* |
| 396 | * Interrupts are disabled on entry as trap1 is an interrupt gate and they | 395 | * Interrupts are disabled on entry as trap1 is an interrupt gate and they |
| 397 | * remain disabled thoroughout this function. And we hold kprobe lock. | 396 | * remain disabled thoroughout this function. |
| 398 | */ | 397 | */ |
| 399 | static inline int post_kprobe_handler(struct pt_regs *regs) | 398 | static inline int post_kprobe_handler(struct pt_regs *regs) |
| 400 | { | 399 | { |
| 401 | if (!kprobe_running()) | 400 | struct kprobe *cur = kprobe_running(); |
| 401 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | ||
| 402 | |||
| 403 | if (!cur) | ||
| 402 | return 0; | 404 | return 0; |
| 403 | 405 | ||
| 404 | if ((kprobe_status != KPROBE_REENTER) && current_kprobe->post_handler) { | 406 | if ((kcb->kprobe_status != KPROBE_REENTER) && cur->post_handler) { |
| 405 | kprobe_status = KPROBE_HIT_SSDONE; | 407 | kcb->kprobe_status = KPROBE_HIT_SSDONE; |
| 406 | current_kprobe->post_handler(current_kprobe, regs, 0); | 408 | cur->post_handler(cur, regs, 0); |
| 407 | } | 409 | } |
| 408 | 410 | ||
| 409 | resume_execution(current_kprobe, regs); | 411 | resume_execution(cur, regs, kcb); |
| 410 | regs->eflags |= kprobe_saved_eflags; | 412 | regs->eflags |= kcb->kprobe_saved_eflags; |
| 411 | 413 | ||
| 412 | /*Restore back the original saved kprobes variables and continue. */ | 414 | /*Restore back the original saved kprobes variables and continue. */ |
| 413 | if (kprobe_status == KPROBE_REENTER) { | 415 | if (kcb->kprobe_status == KPROBE_REENTER) { |
| 414 | restore_previous_kprobe(); | 416 | restore_previous_kprobe(kcb); |
| 415 | goto out; | 417 | goto out; |
| 416 | } | 418 | } |
| 417 | unlock_kprobes(); | 419 | reset_current_kprobe(); |
| 418 | out: | 420 | out: |
| 419 | preempt_enable_no_resched(); | 421 | preempt_enable_no_resched(); |
| 420 | 422 | ||
| @@ -429,18 +431,19 @@ out: | |||
| 429 | return 1; | 431 | return 1; |
| 430 | } | 432 | } |
| 431 | 433 | ||
| 432 | /* Interrupts disabled, kprobe_lock held. */ | ||
| 433 | static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) | 434 | static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) |
| 434 | { | 435 | { |
| 435 | if (current_kprobe->fault_handler | 436 | struct kprobe *cur = kprobe_running(); |
| 436 | && current_kprobe->fault_handler(current_kprobe, regs, trapnr)) | 437 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); |
| 438 | |||
| 439 | if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr)) | ||
| 437 | return 1; | 440 | return 1; |
| 438 | 441 | ||
| 439 | if (kprobe_status & KPROBE_HIT_SS) { | 442 | if (kcb->kprobe_status & KPROBE_HIT_SS) { |
| 440 | resume_execution(current_kprobe, regs); | 443 | resume_execution(cur, regs, kcb); |
| 441 | regs->eflags |= kprobe_old_eflags; | 444 | regs->eflags |= kcb->kprobe_old_eflags; |
| 442 | 445 | ||
| 443 | unlock_kprobes(); | 446 | reset_current_kprobe(); |
| 444 | preempt_enable_no_resched(); | 447 | preempt_enable_no_resched(); |
| 445 | } | 448 | } |
| 446 | return 0; | 449 | return 0; |
| @@ -453,39 +456,41 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, | |||
| 453 | unsigned long val, void *data) | 456 | unsigned long val, void *data) |
| 454 | { | 457 | { |
| 455 | struct die_args *args = (struct die_args *)data; | 458 | struct die_args *args = (struct die_args *)data; |
| 459 | int ret = NOTIFY_DONE; | ||
| 460 | |||
| 456 | switch (val) { | 461 | switch (val) { |
| 457 | case DIE_INT3: | 462 | case DIE_INT3: |
| 458 | if (kprobe_handler(args->regs)) | 463 | if (kprobe_handler(args->regs)) |
| 459 | return NOTIFY_STOP; | 464 | ret = NOTIFY_STOP; |
| 460 | break; | 465 | break; |
| 461 | case DIE_DEBUG: | 466 | case DIE_DEBUG: |
| 462 | if (post_kprobe_handler(args->regs)) | 467 | if (post_kprobe_handler(args->regs)) |
| 463 | return NOTIFY_STOP; | 468 | ret = NOTIFY_STOP; |
| 464 | break; | 469 | break; |
| 465 | case DIE_GPF: | 470 | case DIE_GPF: |
| 466 | if (kprobe_running() && | ||
| 467 | kprobe_fault_handler(args->regs, args->trapnr)) | ||
| 468 | return NOTIFY_STOP; | ||
| 469 | break; | ||
| 470 | case DIE_PAGE_FAULT: | 471 | case DIE_PAGE_FAULT: |
| 472 | /* kprobe_running() needs smp_processor_id() */ | ||
| 473 | preempt_disable(); | ||
| 471 | if (kprobe_running() && | 474 | if (kprobe_running() && |
| 472 | kprobe_fault_handler(args->regs, args->trapnr)) | 475 | kprobe_fault_handler(args->regs, args->trapnr)) |
| 473 | return NOTIFY_STOP; | 476 | ret = NOTIFY_STOP; |
| 477 | preempt_enable(); | ||
| 474 | break; | 478 | break; |
| 475 | default: | 479 | default: |
| 476 | break; | 480 | break; |
| 477 | } | 481 | } |
| 478 | return NOTIFY_DONE; | 482 | return ret; |
| 479 | } | 483 | } |
| 480 | 484 | ||
| 481 | int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | 485 | int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) |
| 482 | { | 486 | { |
| 483 | struct jprobe *jp = container_of(p, struct jprobe, kp); | 487 | struct jprobe *jp = container_of(p, struct jprobe, kp); |
| 484 | unsigned long addr; | 488 | unsigned long addr; |
| 489 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | ||
| 485 | 490 | ||
| 486 | jprobe_saved_regs = *regs; | 491 | kcb->jprobe_saved_regs = *regs; |
| 487 | jprobe_saved_esp = ®s->esp; | 492 | kcb->jprobe_saved_esp = ®s->esp; |
| 488 | addr = (unsigned long)jprobe_saved_esp; | 493 | addr = (unsigned long)(kcb->jprobe_saved_esp); |
| 489 | 494 | ||
| 490 | /* | 495 | /* |
| 491 | * TBD: As Linus pointed out, gcc assumes that the callee | 496 | * TBD: As Linus pointed out, gcc assumes that the callee |
| @@ -494,7 +499,8 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | |||
| 494 | * we also save and restore enough stack bytes to cover | 499 | * we also save and restore enough stack bytes to cover |
| 495 | * the argument area. | 500 | * the argument area. |
| 496 | */ | 501 | */ |
| 497 | memcpy(jprobes_stack, (kprobe_opcode_t *) addr, MIN_STACK_SIZE(addr)); | 502 | memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr, |
| 503 | MIN_STACK_SIZE(addr)); | ||
| 498 | regs->eflags &= ~IF_MASK; | 504 | regs->eflags &= ~IF_MASK; |
| 499 | regs->eip = (unsigned long)(jp->entry); | 505 | regs->eip = (unsigned long)(jp->entry); |
| 500 | return 1; | 506 | return 1; |
| @@ -502,36 +508,40 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | |||
| 502 | 508 | ||
| 503 | void __kprobes jprobe_return(void) | 509 | void __kprobes jprobe_return(void) |
| 504 | { | 510 | { |
| 505 | preempt_enable_no_resched(); | 511 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); |
| 512 | |||
| 506 | asm volatile (" xchgl %%ebx,%%esp \n" | 513 | asm volatile (" xchgl %%ebx,%%esp \n" |
| 507 | " int3 \n" | 514 | " int3 \n" |
| 508 | " .globl jprobe_return_end \n" | 515 | " .globl jprobe_return_end \n" |
| 509 | " jprobe_return_end: \n" | 516 | " jprobe_return_end: \n" |
| 510 | " nop \n"::"b" | 517 | " nop \n"::"b" |
| 511 | (jprobe_saved_esp):"memory"); | 518 | (kcb->jprobe_saved_esp):"memory"); |
| 512 | } | 519 | } |
| 513 | 520 | ||
| 514 | int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | 521 | int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) |
| 515 | { | 522 | { |
| 523 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | ||
| 516 | u8 *addr = (u8 *) (regs->eip - 1); | 524 | u8 *addr = (u8 *) (regs->eip - 1); |
| 517 | unsigned long stack_addr = (unsigned long)jprobe_saved_esp; | 525 | unsigned long stack_addr = (unsigned long)(kcb->jprobe_saved_esp); |
| 518 | struct jprobe *jp = container_of(p, struct jprobe, kp); | 526 | struct jprobe *jp = container_of(p, struct jprobe, kp); |
| 519 | 527 | ||
| 520 | if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) { | 528 | if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) { |
| 521 | if (®s->esp != jprobe_saved_esp) { | 529 | if (®s->esp != kcb->jprobe_saved_esp) { |
| 522 | struct pt_regs *saved_regs = | 530 | struct pt_regs *saved_regs = |
| 523 | container_of(jprobe_saved_esp, struct pt_regs, esp); | 531 | container_of(kcb->jprobe_saved_esp, |
| 532 | struct pt_regs, esp); | ||
| 524 | printk("current esp %p does not match saved esp %p\n", | 533 | printk("current esp %p does not match saved esp %p\n", |
| 525 | ®s->esp, jprobe_saved_esp); | 534 | ®s->esp, kcb->jprobe_saved_esp); |
| 526 | printk("Saved registers for jprobe %p\n", jp); | 535 | printk("Saved registers for jprobe %p\n", jp); |
| 527 | show_registers(saved_regs); | 536 | show_registers(saved_regs); |
| 528 | printk("Current registers\n"); | 537 | printk("Current registers\n"); |
| 529 | show_registers(regs); | 538 | show_registers(regs); |
| 530 | BUG(); | 539 | BUG(); |
| 531 | } | 540 | } |
| 532 | *regs = jprobe_saved_regs; | 541 | *regs = kcb->jprobe_saved_regs; |
| 533 | memcpy((kprobe_opcode_t *) stack_addr, jprobes_stack, | 542 | memcpy((kprobe_opcode_t *) stack_addr, kcb->jprobes_stack, |
| 534 | MIN_STACK_SIZE(stack_addr)); | 543 | MIN_STACK_SIZE(stack_addr)); |
| 544 | preempt_enable_no_resched(); | ||
| 535 | return 1; | 545 | return 1; |
| 536 | } | 546 | } |
| 537 | return 0; | 547 | return 0; |
diff --git a/arch/i386/kernel/ldt.c b/arch/i386/kernel/ldt.c index fe1ffa55587d..983f95707e11 100644 --- a/arch/i386/kernel/ldt.c +++ b/arch/i386/kernel/ldt.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <asm/system.h> | 18 | #include <asm/system.h> |
| 19 | #include <asm/ldt.h> | 19 | #include <asm/ldt.h> |
| 20 | #include <asm/desc.h> | 20 | #include <asm/desc.h> |
| 21 | #include <asm/mmu_context.h> | ||
| 21 | 22 | ||
| 22 | #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ | 23 | #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ |
| 23 | static void flush_ldt(void *null) | 24 | static void flush_ldt(void *null) |
diff --git a/arch/i386/kernel/mca.c b/arch/i386/kernel/mca.c index 8600faeea29d..558bb207720f 100644 --- a/arch/i386/kernel/mca.c +++ b/arch/i386/kernel/mca.c | |||
| @@ -132,7 +132,7 @@ static struct resource mca_standard_resources[] = { | |||
| 132 | { .start = 0x100, .end = 0x107, .name = "POS (MCA)" } | 132 | { .start = 0x100, .end = 0x107, .name = "POS (MCA)" } |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | #define MCA_STANDARD_RESOURCES (sizeof(mca_standard_resources)/sizeof(struct resource)) | 135 | #define MCA_STANDARD_RESOURCES ARRAY_SIZE(mca_standard_resources) |
| 136 | 136 | ||
| 137 | /** | 137 | /** |
| 138 | * mca_read_and_store_pos - read the POS registers into a memory buffer | 138 | * mca_read_and_store_pos - read the POS registers into a memory buffer |
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 7a14fdfd3af9..1cb261f225d5 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c | |||
| @@ -99,14 +99,22 @@ EXPORT_SYMBOL(enable_hlt); | |||
| 99 | */ | 99 | */ |
| 100 | void default_idle(void) | 100 | void default_idle(void) |
| 101 | { | 101 | { |
| 102 | local_irq_enable(); | ||
| 103 | |||
| 102 | if (!hlt_counter && boot_cpu_data.hlt_works_ok) { | 104 | if (!hlt_counter && boot_cpu_data.hlt_works_ok) { |
| 103 | local_irq_disable(); | 105 | clear_thread_flag(TIF_POLLING_NRFLAG); |
| 104 | if (!need_resched()) | 106 | smp_mb__after_clear_bit(); |
| 105 | safe_halt(); | 107 | while (!need_resched()) { |
| 106 | else | 108 | local_irq_disable(); |
| 107 | local_irq_enable(); | 109 | if (!need_resched()) |
| 110 | safe_halt(); | ||
| 111 | else | ||
| 112 | local_irq_enable(); | ||
| 113 | } | ||
| 114 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
| 108 | } else { | 115 | } else { |
| 109 | cpu_relax(); | 116 | while (!need_resched()) |
| 117 | cpu_relax(); | ||
| 110 | } | 118 | } |
| 111 | } | 119 | } |
| 112 | #ifdef CONFIG_APM_MODULE | 120 | #ifdef CONFIG_APM_MODULE |
| @@ -120,29 +128,14 @@ EXPORT_SYMBOL(default_idle); | |||
| 120 | */ | 128 | */ |
| 121 | static void poll_idle (void) | 129 | static void poll_idle (void) |
| 122 | { | 130 | { |
| 123 | int oldval; | ||
| 124 | |||
| 125 | local_irq_enable(); | 131 | local_irq_enable(); |
| 126 | 132 | ||
| 127 | /* | 133 | asm volatile( |
| 128 | * Deal with another CPU just having chosen a thread to | 134 | "2:" |
| 129 | * run here: | 135 | "testl %0, %1;" |
| 130 | */ | 136 | "rep; nop;" |
| 131 | oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); | 137 | "je 2b;" |
| 132 | 138 | : : "i"(_TIF_NEED_RESCHED), "m" (current_thread_info()->flags)); | |
| 133 | if (!oldval) { | ||
| 134 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
| 135 | asm volatile( | ||
| 136 | "2:" | ||
| 137 | "testl %0, %1;" | ||
| 138 | "rep; nop;" | ||
| 139 | "je 2b;" | ||
| 140 | : : "i"(_TIF_NEED_RESCHED), "m" (current_thread_info()->flags)); | ||
| 141 | |||
| 142 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
| 143 | } else { | ||
| 144 | set_need_resched(); | ||
| 145 | } | ||
| 146 | } | 139 | } |
| 147 | 140 | ||
| 148 | #ifdef CONFIG_HOTPLUG_CPU | 141 | #ifdef CONFIG_HOTPLUG_CPU |
| @@ -179,7 +172,9 @@ static inline void play_dead(void) | |||
| 179 | */ | 172 | */ |
| 180 | void cpu_idle(void) | 173 | void cpu_idle(void) |
| 181 | { | 174 | { |
| 182 | int cpu = raw_smp_processor_id(); | 175 | int cpu = smp_processor_id(); |
| 176 | |||
| 177 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
| 183 | 178 | ||
| 184 | /* endless idle loop with no priority at all */ | 179 | /* endless idle loop with no priority at all */ |
| 185 | while (1) { | 180 | while (1) { |
| @@ -201,7 +196,9 @@ void cpu_idle(void) | |||
| 201 | __get_cpu_var(irq_stat).idle_timestamp = jiffies; | 196 | __get_cpu_var(irq_stat).idle_timestamp = jiffies; |
| 202 | idle(); | 197 | idle(); |
| 203 | } | 198 | } |
| 199 | preempt_enable_no_resched(); | ||
| 204 | schedule(); | 200 | schedule(); |
| 201 | preempt_disable(); | ||
| 205 | } | 202 | } |
| 206 | } | 203 | } |
| 207 | 204 | ||
| @@ -244,15 +241,12 @@ static void mwait_idle(void) | |||
| 244 | { | 241 | { |
| 245 | local_irq_enable(); | 242 | local_irq_enable(); |
| 246 | 243 | ||
| 247 | if (!need_resched()) { | 244 | while (!need_resched()) { |
| 248 | set_thread_flag(TIF_POLLING_NRFLAG); | 245 | __monitor((void *)¤t_thread_info()->flags, 0, 0); |
| 249 | do { | 246 | smp_mb(); |
| 250 | __monitor((void *)¤t_thread_info()->flags, 0, 0); | 247 | if (need_resched()) |
| 251 | if (need_resched()) | 248 | break; |
| 252 | break; | 249 | __mwait(0, 0); |
| 253 | __mwait(0, 0); | ||
| 254 | } while (!need_resched()); | ||
| 255 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
| 256 | } | 250 | } |
| 257 | } | 251 | } |
| 258 | 252 | ||
diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c index efd11f09c996..5ffbb4b7ad05 100644 --- a/arch/i386/kernel/ptrace.c +++ b/arch/i386/kernel/ptrace.c | |||
| @@ -354,49 +354,12 @@ ptrace_set_thread_area(struct task_struct *child, | |||
| 354 | return 0; | 354 | return 0; |
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | asmlinkage long sys_ptrace(long request, long pid, long addr, long data) | 357 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
| 358 | { | 358 | { |
| 359 | struct task_struct *child; | ||
| 360 | struct user * dummy = NULL; | 359 | struct user * dummy = NULL; |
| 361 | int i, ret; | 360 | int i, ret; |
| 362 | unsigned long __user *datap = (unsigned long __user *)data; | 361 | unsigned long __user *datap = (unsigned long __user *)data; |
| 363 | 362 | ||
| 364 | lock_kernel(); | ||
| 365 | ret = -EPERM; | ||
| 366 | if (request == PTRACE_TRACEME) { | ||
| 367 | /* are we already being traced? */ | ||
| 368 | if (current->ptrace & PT_PTRACED) | ||
| 369 | goto out; | ||
| 370 | ret = security_ptrace(current->parent, current); | ||
| 371 | if (ret) | ||
| 372 | goto out; | ||
| 373 | /* set the ptrace bit in the process flags. */ | ||
| 374 | current->ptrace |= PT_PTRACED; | ||
| 375 | ret = 0; | ||
| 376 | goto out; | ||
| 377 | } | ||
| 378 | ret = -ESRCH; | ||
| 379 | read_lock(&tasklist_lock); | ||
| 380 | child = find_task_by_pid(pid); | ||
| 381 | if (child) | ||
| 382 | get_task_struct(child); | ||
| 383 | read_unlock(&tasklist_lock); | ||
| 384 | if (!child) | ||
| 385 | goto out; | ||
| 386 | |||
| 387 | ret = -EPERM; | ||
| 388 | if (pid == 1) /* you may not mess with init */ | ||
| 389 | goto out_tsk; | ||
| 390 | |||
| 391 | if (request == PTRACE_ATTACH) { | ||
| 392 | ret = ptrace_attach(child); | ||
| 393 | goto out_tsk; | ||
| 394 | } | ||
| 395 | |||
| 396 | ret = ptrace_check_attach(child, request == PTRACE_KILL); | ||
| 397 | if (ret < 0) | ||
| 398 | goto out_tsk; | ||
| 399 | |||
| 400 | switch (request) { | 363 | switch (request) { |
| 401 | /* when I and D space are separate, these will need to be fixed. */ | 364 | /* when I and D space are separate, these will need to be fixed. */ |
| 402 | case PTRACE_PEEKTEXT: /* read word at location addr. */ | 365 | case PTRACE_PEEKTEXT: /* read word at location addr. */ |
| @@ -663,10 +626,7 @@ asmlinkage long sys_ptrace(long request, long pid, long addr, long data) | |||
| 663 | ret = ptrace_request(child, request, addr, data); | 626 | ret = ptrace_request(child, request, addr, data); |
| 664 | break; | 627 | break; |
| 665 | } | 628 | } |
| 666 | out_tsk: | 629 | out_tsk: |
| 667 | put_task_struct(child); | ||
| 668 | out: | ||
| 669 | unlock_kernel(); | ||
| 670 | return ret; | 630 | return ret; |
| 671 | } | 631 | } |
| 672 | 632 | ||
diff --git a/arch/i386/kernel/reboot_fixups.c b/arch/i386/kernel/reboot_fixups.c index c9b87330aeea..10e21a4773dd 100644 --- a/arch/i386/kernel/reboot_fixups.c +++ b/arch/i386/kernel/reboot_fixups.c | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include <asm/delay.h> | 11 | #include <asm/delay.h> |
| 12 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
| 13 | #include <linux/reboot_fixups.h> | ||
| 13 | 14 | ||
| 14 | static void cs5530a_warm_reset(struct pci_dev *dev) | 15 | static void cs5530a_warm_reset(struct pci_dev *dev) |
| 15 | { | 16 | { |
| @@ -42,7 +43,7 @@ void mach_reboot_fixups(void) | |||
| 42 | struct pci_dev *dev; | 43 | struct pci_dev *dev; |
| 43 | int i; | 44 | int i; |
| 44 | 45 | ||
| 45 | for (i=0; i < (sizeof(fixups_table)/sizeof(fixups_table[0])); i++) { | 46 | for (i=0; i < ARRAY_SIZE(fixups_table); i++) { |
| 46 | cur = &(fixups_table[i]); | 47 | cur = &(fixups_table[i]); |
| 47 | dev = pci_get_device(cur->vendor, cur->device, NULL); | 48 | dev = pci_get_device(cur->vendor, cur->device, NULL); |
| 48 | if (!dev) | 49 | if (!dev) |
diff --git a/arch/i386/kernel/scx200.c b/arch/i386/kernel/scx200.c index 69e203a0d330..9c968ae67c43 100644 --- a/arch/i386/kernel/scx200.c +++ b/arch/i386/kernel/scx200.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
| 13 | 13 | ||
| 14 | #include <linux/scx200.h> | 14 | #include <linux/scx200.h> |
| 15 | #include <linux/scx200_gpio.h> | ||
| 15 | 16 | ||
| 16 | /* Verify that the configuration block really is there */ | 17 | /* Verify that the configuration block really is there */ |
| 17 | #define scx200_cb_probe(base) (inw((base) + SCx200_CBA) == (base)) | 18 | #define scx200_cb_probe(base) (inw((base) + SCx200_CBA) == (base)) |
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index b48ac635f3c1..fdfcb0cba9b4 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
| @@ -129,9 +129,7 @@ struct drive_info_struct { char dummy[32]; } drive_info; | |||
| 129 | EXPORT_SYMBOL(drive_info); | 129 | EXPORT_SYMBOL(drive_info); |
| 130 | #endif | 130 | #endif |
| 131 | struct screen_info screen_info; | 131 | struct screen_info screen_info; |
| 132 | #ifdef CONFIG_VT | ||
| 133 | EXPORT_SYMBOL(screen_info); | 132 | EXPORT_SYMBOL(screen_info); |
| 134 | #endif | ||
| 135 | struct apm_info apm_info; | 133 | struct apm_info apm_info; |
| 136 | EXPORT_SYMBOL(apm_info); | 134 | EXPORT_SYMBOL(apm_info); |
| 137 | struct sys_desc_table_struct { | 135 | struct sys_desc_table_struct { |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 01b618e73ecd..bc5a9d97466b 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
| @@ -68,11 +68,9 @@ EXPORT_SYMBOL(smp_num_siblings); | |||
| 68 | 68 | ||
| 69 | /* Package ID of each logical CPU */ | 69 | /* Package ID of each logical CPU */ |
| 70 | int phys_proc_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID}; | 70 | int phys_proc_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID}; |
| 71 | EXPORT_SYMBOL(phys_proc_id); | ||
| 72 | 71 | ||
| 73 | /* Core ID of each logical CPU */ | 72 | /* Core ID of each logical CPU */ |
| 74 | 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}; |
| 75 | EXPORT_SYMBOL(cpu_core_id); | ||
| 76 | 74 | ||
| 77 | cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; | 75 | cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; |
| 78 | EXPORT_SYMBOL(cpu_sibling_map); | 76 | EXPORT_SYMBOL(cpu_sibling_map); |
| @@ -487,6 +485,7 @@ static void __devinit start_secondary(void *unused) | |||
| 487 | * things done here to the most necessary things. | 485 | * things done here to the most necessary things. |
| 488 | */ | 486 | */ |
| 489 | cpu_init(); | 487 | cpu_init(); |
| 488 | preempt_disable(); | ||
| 490 | smp_callin(); | 489 | smp_callin(); |
| 491 | while (!cpu_isset(smp_processor_id(), smp_commenced_mask)) | 490 | while (!cpu_isset(smp_processor_id(), smp_commenced_mask)) |
| 492 | rep_nop(); | 491 | rep_nop(); |
| @@ -612,7 +611,7 @@ static inline void __inquire_remote_apic(int apicid) | |||
| 612 | 611 | ||
| 613 | printk("Inquiring remote APIC #%d...\n", apicid); | 612 | printk("Inquiring remote APIC #%d...\n", apicid); |
| 614 | 613 | ||
| 615 | for (i = 0; i < sizeof(regs) / sizeof(*regs); i++) { | 614 | for (i = 0; i < ARRAY_SIZE(regs); i++) { |
| 616 | printk("... APIC #%d %s: ", apicid, names[i]); | 615 | printk("... APIC #%d %s: ", apicid, names[i]); |
| 617 | 616 | ||
| 618 | /* | 617 | /* |
diff --git a/arch/i386/oprofile/Kconfig b/arch/i386/oprofile/Kconfig index 5ade19801b97..d8a84088471a 100644 --- a/arch/i386/oprofile/Kconfig +++ b/arch/i386/oprofile/Kconfig | |||
| @@ -1,7 +1,3 @@ | |||
| 1 | |||
| 2 | menu "Profiling support" | ||
| 3 | depends on EXPERIMENTAL | ||
| 4 | |||
| 5 | config PROFILING | 1 | config PROFILING |
| 6 | bool "Profiling support (EXPERIMENTAL)" | 2 | bool "Profiling support (EXPERIMENTAL)" |
| 7 | help | 3 | help |
| @@ -19,5 +15,3 @@ config OPROFILE | |||
| 19 | 15 | ||
| 20 | If unsure, say N. | 16 | If unsure, say N. |
| 21 | 17 | ||
| 22 | endmenu | ||
| 23 | |||
diff --git a/arch/i386/power/cpu.c b/arch/i386/power/cpu.c index 1f1572692e0b..50a0bef8c85f 100644 --- a/arch/i386/power/cpu.c +++ b/arch/i386/power/cpu.c | |||
| @@ -118,6 +118,7 @@ void __restore_processor_state(struct saved_context *ctxt) | |||
| 118 | fix_processor_context(); | 118 | fix_processor_context(); |
| 119 | do_fpu_end(); | 119 | do_fpu_end(); |
| 120 | mtrr_ap_init(); | 120 | mtrr_ap_init(); |
| 121 | mcheck_init(&boot_cpu_data); | ||
| 121 | } | 122 | } |
| 122 | 123 | ||
| 123 | void restore_processor_state(void) | 124 | void restore_processor_state(void) |
