aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/apic.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/kernel/apic.c')
-rw-r--r--arch/x86_64/kernel/apic.c53
1 files changed, 2 insertions, 51 deletions
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 18691ce4c759..fa47ae731576 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -41,10 +41,6 @@ int disable_apic_timer __initdata;
41/* Using APIC to generate smp_local_timer_interrupt? */ 41/* Using APIC to generate smp_local_timer_interrupt? */
42int using_apic_timer = 0; 42int using_apic_timer = 0;
43 43
44static DEFINE_PER_CPU(int, prof_multiplier) = 1;
45static DEFINE_PER_CPU(int, prof_old_multiplier) = 1;
46static DEFINE_PER_CPU(int, prof_counter) = 1;
47
48static void apic_pm_activate(void); 44static void apic_pm_activate(void);
49 45
50void enable_NMI_through_LVT0 (void * dummy) 46void enable_NMI_through_LVT0 (void * dummy)
@@ -805,32 +801,9 @@ void enable_APIC_timer(void)
805 } 801 }
806} 802}
807 803
808/*
809 * the frequency of the profiling timer can be changed
810 * by writing a multiplier value into /proc/profile.
811 */
812int setup_profiling_timer(unsigned int multiplier) 804int setup_profiling_timer(unsigned int multiplier)
813{ 805{
814 int i; 806 return -EINVAL;
815
816 /*
817 * Sanity check. [at least 500 APIC cycles should be
818 * between APIC interrupts as a rule of thumb, to avoid
819 * irqs flooding us]
820 */
821 if ( (!multiplier) || (calibration_result/multiplier < 500))
822 return -EINVAL;
823
824 /*
825 * Set the new multiplier for each CPU. CPUs don't start using the
826 * new values until the next timer interrupt in which they do process
827 * accounting. At that time they also adjust their APIC timers
828 * accordingly.
829 */
830 for (i = 0; i < NR_CPUS; ++i)
831 per_cpu(prof_multiplier, i) = multiplier;
832
833 return 0;
834} 807}
835 808
836#ifdef CONFIG_X86_MCE_AMD 809#ifdef CONFIG_X86_MCE_AMD
@@ -857,32 +830,10 @@ void setup_threshold_lvt(unsigned long lvt_off)
857 830
858void smp_local_timer_interrupt(struct pt_regs *regs) 831void smp_local_timer_interrupt(struct pt_regs *regs)
859{ 832{
860 int cpu = smp_processor_id();
861
862 profile_tick(CPU_PROFILING, regs); 833 profile_tick(CPU_PROFILING, regs);
863 if (--per_cpu(prof_counter, cpu) <= 0) {
864 /*
865 * The multiplier may have changed since the last time we got
866 * to this point as a result of the user writing to
867 * /proc/profile. In this case we need to adjust the APIC
868 * timer accordingly.
869 *
870 * Interrupts are already masked off at this point.
871 */
872 per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu);
873 if (per_cpu(prof_counter, cpu) !=
874 per_cpu(prof_old_multiplier, cpu)) {
875 __setup_APIC_LVTT(calibration_result/
876 per_cpu(prof_counter, cpu));
877 per_cpu(prof_old_multiplier, cpu) =
878 per_cpu(prof_counter, cpu);
879 }
880
881#ifdef CONFIG_SMP 834#ifdef CONFIG_SMP
882 update_process_times(user_mode(regs)); 835 update_process_times(user_mode(regs));
883#endif 836#endif
884 }
885
886 /* 837 /*
887 * We take the 'long' return path, and there every subsystem 838 * We take the 'long' return path, and there every subsystem
888 * grabs the appropriate locks (kernel lock/ irq lock). 839 * grabs the appropriate locks (kernel lock/ irq lock).