High resolution timer updates and x86_64 support - V3
Subsystems (14)
cover High resolution timer updates and x86_64 support - V3
The following patch series contains:
- dyntick bugfixes for -mm (caused by the cpuidle changes in ACPI)
- updates and improvements to high resolution timer / dynticks
- high resolution timer / dynticks support for x86_64
The x86_64 support is based on an initial patch from Chris Wright. Thanks Chris !
The overall diffstat of the patchset is:
50 files changed, 843 insertions(+), 1477 deletions(-)
The patch set has been tested in the -hrt and -rt trees for quite a while and the initial problems have been sorted out. Thanks to the folks from the PowerTop project for testing and feedback.
Changes since V2:
- dropped clocksource settimeofday hook for PPC
- fixed compile breakage of vmiclock
- coding style fixups
- better patch split
The patch series is also available from the hrtimers project site:
http://www.tglx.de/projects/hrtimers/2.6.22-rc4-mm2/patch-2.6.22-rc4-mm2-hrt6.patch
http://www.tglx.de/projects/hrtimers/2.6.22-rc4-mm2/patch-2.6.22-rc4-mm2-hrt6.patches.tar.bz2
Note: these patches also contain the recently posted HPET force enable series from Venki.
Thanks,
tglx
PATCH 1/28 NOHZ: Fix nox x86 dyntick idle handling
The cpuidle patches moved the tick nohz handling from irq_exit into the inner idle loop. The change is correct as it covers non interrupt based wakeups (e.g DMA) on x86 as well, but the move breaks ARM, SH and SPARC64.
Keep the original implementation and deselet the irq exit code for those architectures which have idle wakeups without interrupts.
This way the non affected architectures are not burdened with the extra changes in the idle implementation.
--- arch/i386/Kconfig | 4 ++++ kernel/softirq.c | 5 +++++ 2 files changed, 9 insertions(+)
arch/i386/Kconfig +4 -0
@@ -31,6 +31,10 @@ config GENERIC_CLOCKEVENTS_BROADCAST default y depends on X86_LOCAL_APIC +config NONIRQ_WAKEUP + bool + default y + config LOCKDEP_SUPPORT bool default y
kernel/softirq.c +5 -0
@@ -304,6 +304,11 @@ void irq_exit(void)if (!in_interrupt () &&local_softirq_pending ())invoke_softirq (); +#if defined(CONFIG_NO_HZ ) && !defined(CONFIG_NONIRQ_WAKEUP ) +/* Make sure that timer wheel updates are propagated */ +if (!in_interrupt () &&idle_cpu (smp_processor_id ()) && !need_resched ()) +tick_nohz_stop_sched_tick (); +#endif preempt_enable_no_resched (); }
PATCH 2/28 ACPI: Move timer broadcast and pmtimer access before C3 arbiter shutdown
In reply to Thomas GleixnerFrom: Udo A. Steinberg <[email protected]>
The chipset doc for IHC4 tells us:
1.In general, software should not attempt any non-posted accesses during arbiter disable except to the ICH4's power management registers. This implies that interrupt handlers for any unmasked hardware interrupts and SMI/NMI should check ARB_DIS status before reading from ICH devices.
So it's not a good idea to access ICH devices after arbiter shut down.
--- drivers/acpi/processor_idle.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/acpi/processor_idle.c +6 -1
@@ -978,6 +978,12 @@ static int acpi_idle_enter_c3(struct cpureturn 0 ; } +/* +* Must be done before busmaster disable as we might need to +* access HPET ! +*/ +acpi_state_timer_broadcast (pr, cx,1 ); +/* disable bus master */ if (pr->flags.bm_check) {spin_lock (&c3_lock);
@@ -997,7 +1003,6 @@ static int acpi_idle_enter_c3(struct cpu/* Get start time (ticks) */ t1 =inl (acpi_gbl_FADT.xpm_timer_block.address); -acpi_state_timer_broadcast (pr, cx,1 );acpi_idle_do_entry (cx); t2 =inl (acpi_gbl_FADT.xpm_timer_block.address);
PATCH 3/28 clockevents: fix typo in acpi_pm.c
In reply to Thomas GleixnerFrom: Alessio Igor Bogani <[email protected]>
--- drivers/clocksource/acpi_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/acpi_pm.c +1 -1
@@ -71,7 +71,7 @@ static struct clocksource clocksource_ac .rating = 200, .read = acpi_pm_read, .mask = (cycle_t)ACPI_PM_MASK, - .mult = 0, /*to be caluclated*/ + .mult = 0, /*to be calculated*/ .shift = 22, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
PATCH 4/28 Timekeeping: Fixup shadow variable argument
In reply to Thomas Gleixnerclocksource_adjust() has a clock argument, which shadows the file global clock variable. Fix this up.
--- kernel/time/timekeeping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/time/timekeeping.c +2 -2
@@ -401,7 +401,7 @@ static __always_inline int clocksource_b* this is optimized for the most common adjustments of -1,0,1, * for other values we can do a bit more work. */ -static void clocksource_adjust (struct clocksource *clock,s64 offset) +static void clocksource_adjust (s64 offset) {s64 error, interval = clock->cycle_interval;int adj;
@@ -476,7 +476,7 @@ void update_wall_time(void) }/* correct the clock when NTP error is too big */ -clocksource_adjust (clock, offset); +clocksource_adjust (offset);/* store full nanoseconds into xtime */ xtime.tv_nsec = (s64 )clock->xtime_nsec >> clock->shift;
PATCH 5/28 timer.c cleanup recently introduced whitespace damage
In reply to Thomas Gleixner--- kernel/timer.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
kernel/timer.c +12 -12
@@ -103,14 +103,14 @@ static inline tvec_base_t *tbase_get_basstatic inline void timer_set_deferrable (struct timer_list *timer) { timer->base = ((tvec_base_t *)((unsigned long )(timer->base) | -TBASE_DEFERRABLE_FLAG )); +TBASE_DEFERRABLE_FLAG )); }static inline void timer_set_base (struct timer_list *timer,tvec_base_t *new_base) { timer->base = (tvec_base_t *)((unsigned long )(new_base) | -tbase_get_deferrable (timer->base)); +tbase_get_deferrable (timer->base)); }/**
@@ -445,10 +445,10 @@ EXPORT_SYMBOL(__mod_timer);void add_timer_on (struct timer_list *timer,int cpu) {tvec_base_t *base =per_cpu (tvec_bases, cpu); -unsigned long flags; +unsigned long flags;timer_stats_timer_set_start_info (timer); -BUG_ON (timer_pending (timer) || !timer->function); +BUG_ON (timer_pending (timer) || !timer->function);spin_lock_irqsave (&base->lock, flags);timer_set_base (timer, base);internal_add_timer (base, timer);
@@ -627,7 +627,7 @@ static inline void __run_timers(tvec_baswhile (time_after_eq (jiffies, base->timer_jiffies)) {struct list_head work_list;struct list_head *head = &work_list; -int index = base->timer_jiffies &TVR_MASK ; +int index = base->timer_jiffies &TVR_MASK ;/* * Cascade timers:
@@ -644,8 +644,8 @@ static inline void __run_timers(tvec_basunsigned long data; timer = list_first_entry(head, struct timer_list,entry); - fn = timer->function; - data = timer->data; + fn = timer->function; + data = timer->data;timer_stats_account_timer (timer);
@@ -689,8 +689,8 @@ static unsigned long __next_timer_interr index = slot = timer_jiffies &TVR_MASK ; do { list_for_each_entry(nte, base->tv1.vec + slot, entry) { - if (tbase_get_deferrable(nte->base)) - continue; + if (tbase_get_deferrable(nte->base)) + continue; found = 1; expires = nte->expires;
@@ -834,7 +834,7 @@ void update_process_times(int user_tick)if (rcu_pending (cpu))rcu_check_callbacks (cpu, user_tick);scheduler_tick (); -run_posix_cpu_timers (p); +run_posix_cpu_timers (p); }/*
@@ -909,7 +909,7 @@ static inline void update_times(unsignedupdate_wall_time ();calc_load (ticks); } - +/* * The 64-bit jiffies value is not atomic - you MUST NOT read it * without sampling the sequence number in xtime_lock.
@@ -1105,7 +1105,7 @@ asmlinkage long sys_gettid(void)/** * do_sysinfo - fill in sysinfo struct * @info: pointer to buffer to fill -*/ +*/ int do_sysinfo (struct sysinfo *info) {unsigned long mem_total, sav_total;
PATCH 6/28 Clockevents remove prototypes of removed functions
In reply to Thomas Gleixner--- include/linux/clockchips.h | 4 ---- 1 file changed, 4 deletions(-)
include/linux/clockchips.h +0 -4
@@ -119,10 +119,6 @@ extern void clockevents_register_device(extern void clockevents_exchange_device (struct clock_event_device *old,struct clock_event_device *new); -extern -struct clock_event_device *clockevents_request_device (unsigned int features, -cpumask_t cpumask); -extern void clockevents_release_device (struct clock_event_device *dev);extern void clockevents_set_mode (struct clock_event_device *dev,enum clock_event_mode mode);extern int clockevents_register_notifier (struct notifier_block *nb);
PATCH 7/28 clockevents: Fix resume logic
In reply to Thomas GleixnerWe need to make sure, that the clockevent devices are resumed, before the tick is resumed. The current resume logic does not guarantee this.
Add CLOCK_EVT_MODE_RESUME and call the set mode functions of the clock event devices before resuming the tick / oneshot functionality.
Fixup the existing users.
Thanks to Nigel Cunningham for tracking down a long standing thinko, which affected the jinxed VAIO.
--- arch/arm/mach-davinci/time.c | 2 + arch/arm/mach-imx/time.c | 1 arch/arm/mach-ixp4xx/common.c | 2 + arch/arm/mach-omap1/time.c | 1 arch/arm/plat-omap/timer32k.c | 2 + arch/i386/kernel/apic.c | 3 + arch/i386/kernel/hpet.c | 71 ++------------------------------------ arch/i386/kernel/i8253.c | 26 ++++++------- arch/i386/kernel/vmiclock.c | 1 arch/i386/xen/time.c | 1 arch/sh/kernel/timers/timer-tmu.c | 1 arch/sparc64/kernel/time.c | 1 include/linux/clockchips.h | 1 kernel/time/tick-broadcast.c | 6 ++- kernel/time/tick-common.c | 16 +++++--- 15 files changed, 47 insertions(+), 88 deletions(-)
arch/i386/kernel/apic.c +3 -0
@@ -263,6 +263,9 @@ static void lapic_timer_setup(enum clock v |= (APIC_LVT_MASKED |LOCAL_TIMER_VECTOR );apic_write_around (APIC_LVTT , v);break ; +case CLOCK_EVT_MODE_RESUME : +/* Nothing to do here */ +break ; }local_irq_restore (flags);
arch/i386/kernel/hpet.c +5 -66
92 lines not on this page · raw message
arch/i386/kernel/i8253.c +12 -14
@@ -3,11 +3,11 @@* */ #include <linux/clockchips.h> -#include <linux/spinlock.h> +#include <linux/init.h> +#include <linux/interrupt.h> #include <linux/jiffies.h> -#include <linux/sysdev.h> #include <linux/module.h> -#include <linux/init.h> +#include <linux/spinlock.h> #include <asm/smp.h> #include <asm/delay.h>
@@ -42,26 +42,24 @@ static void init_pit_timer(enum clock_evcase CLOCK_EVT_MODE_PERIODIC :/* binary, mode 2, LSB/MSB, ch 0 */ outb_p (0x34 ,PIT_MODE ); -udelay (10 );outb_p (LATCH &0xff ,PIT_CH0 );/* LSB */ -udelay (10 );outb (LATCH >>8 ,PIT_CH0 );/* MSB */ break ; -/* -* Avoid unnecessary state transitions, as it confuses -* Geode / Cyrix based boxen. -*/ case CLOCK_EVT_MODE_SHUTDOWN : -if (evt->mode ==CLOCK_EVT_MODE_UNUSED ) -break ;case CLOCK_EVT_MODE_UNUSED : -if (evt->mode ==CLOCK_EVT_MODE_SHUTDOWN ) -break ; +outb_p (0x30 ,PIT_MODE ); +outb_p (0 ,PIT_CH0 );/* LSB */ +outb_p (0 ,PIT_CH0 );/* MSB */ +break ; +case CLOCK_EVT_MODE_ONESHOT :/* One shot setup */ outb_p (0x38 ,PIT_MODE ); -udelay (10 ); +break ; + +case CLOCK_EVT_MODE_RESUME : +/* Nothing to do here */ break ; }spin_unlock_irqrestore (&i8253_lock, flags);
include/linux/clockchips.h +1 -0
@@ -23,6 +23,7 @@ enum clock_event_mode {CLOCK_EVT_MODE_SHUTDOWN ,CLOCK_EVT_MODE_PERIODIC ,CLOCK_EVT_MODE_ONESHOT , + CLOCK_EVT_MODE_RESUME, };/* Clock event notification values */
kernel/time/tick-broadcast.c +4 -2
@@ -49,7 +49,7 @@ cpumask_t *tick_get_broadcast_mask(void)*/ static void tick_broadcast_start_periodic (struct clock_event_device *bc) { -if (bc && bc->mode ==CLOCK_EVT_MODE_SHUTDOWN ) +if (bc)tick_setup_periodic (bc,1 ); }
@@ -299,7 +299,7 @@ void tick_suspend_broadcast(void)spin_lock_irqsave (&tick_broadcast_lock, flags); bc = tick_broadcast_device.evtdev; -if (bc && tick_broadcast_device.mode ==TICKDEV_MODE_PERIODIC ) +if (bc)clockevents_set_mode (bc,CLOCK_EVT_MODE_SHUTDOWN );spin_unlock_irqrestore (&tick_broadcast_lock, flags);
@@ -316,6 +316,8 @@ int tick_resume_broadcast(void) bc = tick_broadcast_device.evtdev;if (bc) { +clockevents_set_mode (bc,CLOCK_EVT_MODE_RESUME ); +switch (tick_broadcast_device.mode) {case TICKDEV_MODE_PERIODIC :if (!cpus_empty (tick_broadcast_mask))
kernel/time/tick-common.c +10 -6
@@ -318,12 +318,17 @@ static void tick_resume(void) {struct tick_device *td = &__get_cpu_var (tick_cpu_device);unsigned long flags; +int broadcast =tick_resume_broadcast ();spin_lock_irqsave (&tick_device_lock, flags); -if (td->mode ==TICKDEV_MODE_PERIODIC ) -tick_setup_periodic (td->evtdev,0 ); -else -tick_resume_oneshot (); +clockevents_set_mode (td->evtdev,CLOCK_EVT_MODE_RESUME ); + +if (!broadcast) { +if (td->mode ==TICKDEV_MODE_PERIODIC ) +tick_setup_periodic (td->evtdev,0 ); +else +tick_resume_oneshot (); + }spin_unlock_irqrestore (&tick_device_lock, flags); }
@@ -360,8 +365,7 @@ static int tick_notify(struct notifier_bbreak ;case CLOCK_EVT_NOTIFY_RESUME : -if (!tick_resume_broadcast ()) -tick_resume (); +tick_resume ();break ;default :
arch/arm/mach-davinci/time.c +2 -0
@@ -285,6 +285,8 @@ static void davinci_set_mode(enum clock_case CLOCK_EVT_MODE_SHUTDOWN : t->opts =TIMER_OPTS_DISABLED ;break ; +case CLOCK_EVT_MODE_RESUME : +break ; } }
arch/arm/mach-imx/time.c +1 -0
@@ -159,6 +159,7 @@ static void imx_set_mode(enum clock_evenbreak ;case CLOCK_EVT_MODE_SHUTDOWN :case CLOCK_EVT_MODE_UNUSED : +case CLOCK_EVT_MODE_RESUME :/* Left event sources disabled, no more interrupts appears */ break ; }
arch/arm/mach-ixp4xx/common.c +2 -0
@@ -459,6 +459,8 @@ static void ixp4xx_set_mode(enum clock_edefault : osrt = opts =0 ;break ; +case CLOCK_EVT_MODE_RESUME : +break ; } *IXP4XX_OSRT1 = osrt | opts;
arch/arm/mach-omap1/time.c +1 -0
@@ -156,6 +156,7 @@ static void omap_mpu_set_mode(enum clockbreak ;case CLOCK_EVT_MODE_UNUSED :case CLOCK_EVT_MODE_SHUTDOWN : +case CLOCK_EVT_MODE_RESUME :break ; } }
arch/arm/plat-omap/timer32k.c +2 -0
@@ -156,6 +156,8 @@ static void omap_32k_timer_set_mode(enumcase CLOCK_EVT_MODE_SHUTDOWN :omap_32k_timer_stop ();break ; +case CLOCK_EVT_MODE_RESUME : +break ; } }
arch/i386/kernel/vmiclock.c +1 -0
@@ -142,6 +142,7 @@ static void vmi_timer_set_mode(enum clocswitch (mode) {case CLOCK_EVT_MODE_ONESHOT : +case CLOCK_EVT_MODE_RESUME :break ;case CLOCK_EVT_MODE_PERIODIC : cycles_per_hz = vmi_timer_ops.get_cycle_frequency ();
arch/i386/xen/time.c +1 -0
@@ -407,6 +407,7 @@ static void xen_timerop_set_mode(enum clbreak ;case CLOCK_EVT_MODE_ONESHOT : +case CLOCK_EVT_MODE_RESUME :break ;case CLOCK_EVT_MODE_UNUSED :
arch/sh/kernel/timers/timer-tmu.c +1 -0
@@ -80,6 +80,7 @@ static void tmu_set_mode(enum clock_evenbreak ;case CLOCK_EVT_MODE_UNUSED :case CLOCK_EVT_MODE_SHUTDOWN : +case CLOCK_EVT_MODE_RESUME :break ; } }
arch/sparc64/kernel/time.c +1 -0
@@ -938,6 +938,7 @@ static void sparc64_timer_setup(enum clo {switch (mode) {case CLOCK_EVT_MODE_ONESHOT : +case CLOCK_EVT_MODE_RESUME :break ;case CLOCK_EVT_MODE_SHUTDOWN :
PATCH 8/28 clockevents: Fix device replacement
In reply to Thomas GleixnerWhen a device is replaced by a better rated device, then the broadcast mode needs to be evaluated again. When the new device has no requirement for broadcasting, then the broadcast bits for the CPU must be cleared.
--- kernel/time/tick-broadcast.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
kernel/time/tick-broadcast.c +28 -1
@@ -31,6 +31,12 @@ struct tick_device tick_broadcast_devicestatic cpumask_t tick_broadcast_mask;static DEFINE_SPINLOCK (tick_broadcast_lock); +#ifdef CONFIG_TICK_ONESHOT +static void tick_broadcast_clear_oneshot (int cpu); +#else +static inline void tick_broadcast_clear_oneshot (int cpu) { } +#endif +/* * Debugging: see timer_list.c */
@@ -99,8 +105,19 @@ int tick_device_uses_broadcast(struct clcpu_set (cpu, tick_broadcast_mask);tick_broadcast_start_periodic (tick_broadcast_device.evtdev); ret =1 ; - } + }else { +/* +* When the new device is not affected by the stop +* feature and the cpu is marked in the broadcast mask +* then clear the broadcast bit. +*/ +if (!(dev->features &CLOCK_EVT_FEAT_C3STOP )) { +int cpu =smp_processor_id (); +cpu_clear (cpu, tick_broadcast_mask); +tick_broadcast_clear_oneshot (cpu); + } + }spin_unlock_irqrestore (&tick_broadcast_lock, flags);return ret; }
@@ -487,6 +504,16 @@ out:spin_unlock_irqrestore (&tick_broadcast_lock, flags); } +/* +* Reset the one shot broadcast for a cpu +* +* Called with tick_broadcast_lock held +*/ +static void tick_broadcast_clear_oneshot (int cpu) +{ +cpu_clear (cpu, tick_broadcast_oneshot_mask); +} +/** * tick_broadcast_setup_highres - setup the broadcast device for highres */
PATCH 9/28 Tick management: spread timer interrupt
In reply to Thomas GleixnerFrom: john stultz <[email protected]>
After discussing w/ Thomas over IRC, it seems the issue is the sched tick fires on every cpu at the same time, causing extra lock contention.
This smaller change, adds an extra offset per cpu so the ticks don't line up. This patch also drops the idle latency from 40us down to under 20us.
--- kernel/time/tick-sched.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/time/tick-sched.c +6 -1
@@ -573,6 +573,7 @@ void tick_setup_sched_timer(void) {struct tick_sched *ts = &__get_cpu_var (tick_cpu_sched);ktime_t now =ktime_get (); +u64 offset;/* * Emulate tick processing via per-CPU hrtimers:
@@ -581,8 +582,12 @@ void tick_setup_sched_timer(void) ts->sched_timer.function = tick_sched_timer; ts->sched_timer.cb_mode =HRTIMER_CB_IRQSAFE_NO_SOFTIRQ ; -/* Get the next period */ +/* Get the next period (per cpu) */ ts->sched_timer.expires =tick_init_jiffy_update (); + offset =ktime_to_ns (tick_period) >>1 ; +do_div (offset,NR_CPUS ); + offset *=smp_processor_id (); + ts->sched_timer.expires =ktime_add_ns (ts->sched_timer.expires, offset);for (;;) {hrtimer_forward (&ts->sched_timer, now, tick_period);
Re: [patch -mm 09/28] Tick management: spread timer interrupt
Quoted 29 lines · On Sat, 23 Jun 2007 13:32:34 -0000 Thomas Gleixner <[email protected]> wrote:
From: john stultz <[email protected]>
After discussing w/ Thomas over IRC, it seems the issue is the sched tick fires on every cpu at the same time, causing extra lock contention.
This smaller change, adds an extra offset per cpu so the ticks don't line up. This patch also drops the idle latency from 40us down to under 20us.
Signed-off-by john stultz <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>--- kernel/time/tick-sched.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)Index:
linux-2.6.22-rc4-mm/kernel/time/tick-sched.c
===================================================================kernel/time/tick-sched.c +1
-0@@ -573,6 +573,7 @@ void tick_setup_sched_timer(void) {struct tick_sched *ts = &__get_cpu_var (tick_cpu_sched);ktime_t now =ktime_get (); +u64 offset;/* * Emulate tick processing via per-CPU hrtimers:
kernel/time/tick-sched.c void tick_setup_sched_timer(void) · line 588
Quoted 8 lines
kernel/time/tick-sched.c +3
-1@@ -581,8 +582,12 @@ void tick_setup_sched_timer(void) ts->sched_timer.function = tick_sched_timer; ts->sched_timer.cb_mode =HRTIMER_CB_IRQSAFE_NO_SOFTIRQ ; -/* Get the next period */ +/* Get the next period (per cpu) */ ts->sched_timer.expires =tick_init_jiffy_update (); + offset =ktime_to_ns (tick_period) >>1 ; +do_div (offset,NR_CPUS );
With CONFIG_NR_CPUS=128 on a 2-way this'll be a pretty lumpy spreading? Perhaps it woud be better to use num_possible_cpus() here?
Quoted 7 lines
kernel/time/tick-sched.c +2
-0+ offset *=smp_processor_id (); + ts->sched_timer.expires =ktime_add_ns (ts->sched_timer.expires, offset);for (;;) {hrtimer_forward (&ts->sched_timer, now, tick_period);Signature · 1 line
--
PATCH 10/28 highres: Improve debug output
In reply to Thomas GleixnerFrom: Ingo Molnar <[email protected]>
Add some more debug information to the hrtimer and clock events code.
--- arch/i386/kernel/apic.c | 3 +++ kernel/hrtimer.c | 5 ++++- kernel/time/tick-oneshot.c | 15 ++++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-)
arch/i386/kernel/apic.c +3 -0
@@ -524,6 +524,9 @@ void __init setup_boot_APIC_clock(void)*/ if (nmi_watchdog !=NMI_IO_APIC ) lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY ; +else +printk (KERN_WARNING "APIC timer registered as dummy," +" due to nmi_watchdog=1!\n" ); }/* Setup the lapic or request the broadcast */
kernel/hrtimer.c +4 -1
@@ -558,7 +558,8 @@ static inline int hrtimer_enqueue_reprog*/ static int hrtimer_switch_to_hres (void ) { -struct hrtimer_cpu_base *base = &__get_cpu_var (hrtimer_bases); +int cpu =smp_processor_id (); +struct hrtimer_cpu_base *base = &per_cpu (hrtimer_bases, cpu);unsigned long flags;if (base->hres_active)
@@ -568,6 +569,8 @@ static int hrtimer_switch_to_hres(void)if (tick_init_highres ()) {local_irq_restore (flags); +printk (KERN_WARNING "Could not switch to high resolution " +"mode on CPU %d\n" , cpu);return 0 ; } base->hres_active =1 ;
kernel/time/tick-oneshot.c +14 -1
@@ -73,8 +73,21 @@ int tick_switch_to_oneshot(void (*handlestruct clock_event_device *dev = td->evtdev;if (!dev || !(dev->features &CLOCK_EVT_FEAT_ONESHOT ) || - !tick_device_is_functional (dev)) + !tick_device_is_functional (dev)) { + +printk (KERN_INFO "Clockevents: " +"could not switch to one-shot mode:" ); +if (!dev) { +printk (" no tick device\n" ); + }else { +if (!tick_device_is_functional (dev)) +printk (" %s is not functional.\n" , dev->name); +else if (!(dev->features &CLOCK_EVT_FEAT_ONESHOT )) +printk (" %s does not support one-shot mode.\n" , + dev->name); + }return -EINVAL ; + } td->mode =TICKDEV_MODE_ONESHOT ; dev->event_handler = handler;
Re: [patch -mm 10/28] highres: Improve debug output
Quoted 5 lines · On Sat, 23 Jun 2007 13:32:35 -0000 Thomas Gleixner <[email protected]> wrote:
kernel/time/tick-oneshot.c +3
-1if (!dev || !(dev->features &CLOCK_EVT_FEAT_ONESHOT ) || - !tick_device_is_functional (dev)) + !tick_device_is_functional (dev)) { + + printk(KERN_INFO "Clockevents: "
kernel/time/tick-oneshot.c int tick_switch_to_oneshot(void (*handle · line 88
Quoted 10 lines
kernel/time/tick-oneshot.c +10
-0+ "could not switch to one-shot mode:"); +if (!dev) { +printk (" no tick device\n" ); + }else { +if (!tick_device_is_functional (dev)) +printk (" %s is not functional.\n" , dev->name); +else if (!(dev->features &CLOCK_EVT_FEAT_ONESHOT )) +printk (" %s does not support one-shot mode.\n" , + dev->name); + }
There is a logic path through here where the printk doesn't get its \n termination? And it will fail to print the reason for the failure, too.
Maybe that's a can't-happen, in which case the CLOCK_EVT_FEAT_ONESHOT test is superfluous?
Re: [patch -mm 10/28] highres: Improve debug output
Quoted 22 lines · Andrew Morton
Quoted 5 lines · On Sat, 23 Jun 2007 13:32:35 -0000 Thomas Gleixner <[email protected]> wrote:
kernel/time/tick-oneshot.c +3
-1if (!dev || !(dev->features &CLOCK_EVT_FEAT_ONESHOT ) || - !tick_device_is_functional (dev)) + !tick_device_is_functional (dev)) { + + printk(KERN_INFO "Clockevents: "kernel/time/tick-oneshot.c int tick_switch_to_oneshot(void (*handle · line 88
Quoted 10 lines
kernel/time/tick-oneshot.c +10
-0+ "could not switch to one-shot mode:"); +if (!dev) { +printk (" no tick device\n" ); + }else { +if (!tick_device_is_functional (dev)) +printk (" %s is not functional.\n" , dev->name); +else if (!(dev->features &CLOCK_EVT_FEAT_ONESHOT )) +printk (" %s does not support one-shot mode.\n" , + dev->name); + }There is a logic path through here where the printk doesn't get its \n termination? And it will fail to print the reason for the failure, too.
Quoted 2 lines
Maybe that's a can't-happen, in which case the
CLOCK_EVT_FEAT_ONESHOTtest is superfluous?
Right, the "else if (...)" test is bogus. A simple "else" is sufficient.
tglx
PATCH 11/28 hrtimer: speedup hrtimer_enqueue
In reply to Thomas GleixnerFrom: Ingo Molnar <[email protected]>
Speedup hrtimer_enqueue by evaluating the rbtree insertion result.
--- kernel/hrtimer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
kernel/hrtimer.c +6 -4
@@ -686,6 +686,7 @@ static void enqueue_hrtimer(struct hrtimstruct rb_node **link = &base->active.rb_node;struct rb_node *parent =NULL ;struct hrtimer *entry; +int leftmost =1 ;/* * Find the right place in the rbtree:
@@ -697,18 +698,19 @@ static void enqueue_hrtimer(struct hrtim* We dont care about collisions. Nodes with * the same expiry time stay together. */ -if (timer->expires.tv64 < entry->expires.tv64) +if (timer->expires.tv64 < entry->expires.tv64) { link = &(*link)->rb_left; -else + }else { link = &(*link)->rb_right; + leftmost =0 ; + } }/* * Insert the timer to the rbtree and check whether it * replaces the first pending timer */ -if (!base->first || timer->expires.tv64 < - rb_entry(base->first, struct hrtimer, node)->expires.tv64) { +if (leftmost) {/* * Reprogram the clock event device. When the timer is already * expired hrtimer_enqueue_reprogram has either called the
PATCH 12/28 pcspkr: use the global PIT lock
In reply to Thomas GleixnerReplace the pcspkr private PIT lock by the global PIT lock to serialize the PIT access all over the place.
--- arch/x86_64/kernel/time.c | 2 ++ drivers/input/misc/pcspkr.c | 11 ++++++++--- include/asm-x86_64/i8253.h | 6 ++++++ 3 files changed, 16 insertions(+), 3 deletions(-)
arch/x86_64/kernel/time.c +2 -0
@@ -33,6 +33,7 @@#include <acpi/acpi_bus.h> #endif #include <asm/8253pit.h> +#include <asm/i8253.h> #include <asm/pgtable.h> #include <asm/vsyscall.h> #include <asm/timex.h>
@@ -51,6 +52,7 @@ static char *timename = NULL;DEFINE_SPINLOCK (rtc_lock);EXPORT_SYMBOL (rtc_lock);DEFINE_SPINLOCK (i8253_lock); +EXPORT_SYMBOL (i8253_lock);volatile unsigned long __jiffies __section_jiffies =INITIAL_JIFFIES ;
drivers/input/misc/pcspkr.c +8 -3
@@ -24,7 +24,12 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@uMODULE_DESCRIPTION ("PC Speaker beeper driver" );MODULE_LICENSE ("GPL" ); -static DEFINE_SPINLOCK (i8253_beep_lock); +#ifdef CONFIG_X86 +/* Use the global PIT lock ! */ +#include <asm/i8253.h> +#else +static DEFINE_SPINLOCK (i8253_lock); +#endif static int pcspkr_event (struct input_dev *dev,unsigned int type,unsigned int code,int value) {
@@ -43,7 +48,7 @@ static int pcspkr_event(struct input_devif (value >20 && value <32767 ) count =PIT_TICK_RATE / value; -spin_lock_irqsave (&i8253_beep_lock, flags); +spin_lock_irqsave (&i8253_lock, flags);if (count) {/* enable counter 2 */
@@ -58,7 +63,7 @@ static int pcspkr_event(struct input_devoutb (inb_p (0x61 ) &0xFC ,0x61 ); } -spin_unlock_irqrestore (&i8253_beep_lock, flags); +spin_unlock_irqrestore (&i8253_lock, flags);return 0 ; }
include/asm-x86_64/i8253.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef __ASM_I8253_H__ +#define __ASM_I8253_H__ + +extern spinlock_t i8253_lock; + +#endif /* __ASM_I8253_H__ */
PATCH 13/28 NTP: Move the cmos update code into ntp.c
In reply to Thomas Gleixneri386 and sparc64 have the identical code to update the cmos clock. Move it into kernel/time/ntp.c as there are other architectures coming along with the same requirements.
--- arch/i386/Kconfig | 4 +++ arch/i386/kernel/time.c | 50 +------------------------------------- arch/sparc64/Kconfig | 4 +++ arch/sparc64/kernel/time.c | 53 +--------------------------------------- include/asm-i386/timer.h | 1 include/linux/time.h | 2 + kernel/time/ntp.c | 59 ++++++++++++++++++++++++++++++++++++++++++--- 7 files changed, 70 insertions(+), 103 deletions(-)
arch/i386/Kconfig +4 -0
@@ -18,6 +18,10 @@ config GENERIC_TIME bool default y +config GENERIC_CMOS_UPDATE + bool + default y + config CLOCKSOURCE_WATCHDOG bool default y
arch/i386/kernel/time.c +2 -48
57 lines not on this page · raw message
arch/sparc64/kernel/time.c +2 -51
60 lines not on this page · raw message
include/linux/time.h +2 -0
@@ -93,6 +93,8 @@ extern struct timespec wall_to_monotonic extern seqlock_t xtime_lock __attribute__((weak));extern unsigned long read_persistent_clock (void ); +extern int update_persistent_clock (struct timespec now); +extern int no_sync_cmos_clock__read_mostly ;void timekeeping_init (void );static inline unsigned long get_seconds (void )
kernel/time/ntp.c +56 -3
80 lines not on this page · raw message
arch/sparc64/Kconfig +4 -0
@@ -23,6 +23,10 @@ config GENERIC_TIME bool default y +config GENERIC_CMOS_UPDATE + bool + default y + config GENERIC_CLOCKEVENTS bool default y
include/asm-i386/timer.h +0 -1
@@ -12,7 +12,6 @@ unsigned long native_calculate_cpu_khz(vextern int timer_ack;extern int no_timer_check; -extern int no_sync_cmos_clock;extern int recalibrate_cpu_khz (void );#ifndef CONFIG_PARAVIRT
PATCH 14/28 i386: PIT stop only, when in periodic or oneshot mode
In reply to Thomas GleixnerThe patch is necessary on one of my boxen, where programming the stop sequence twice leads to PIT malfunction.
Sigh !
--- arch/i386/kernel/i8253.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/i386/kernel/i8253.c +6 -3
@@ -48,9 +48,12 @@ static void init_pit_timer(enum clock_evcase CLOCK_EVT_MODE_SHUTDOWN :case CLOCK_EVT_MODE_UNUSED : -outb_p (0x30 ,PIT_MODE ); -outb_p (0 ,PIT_CH0 );/* LSB */ -outb_p (0 ,PIT_CH0 );/* MSB */ +if (evt->mode ==CLOCK_EVT_MODE_PERIODIC || + evt->mode ==CLOCK_EVT_MODE_ONESHOT ) { +outb_p (0x30 ,PIT_MODE ); +outb_p (0 ,PIT_CH0 ); +outb_p (0 ,PIT_CH0 ); + }break ;case CLOCK_EVT_MODE_ONESHOT :
PATCH 15/28 i386: remove volatile in apic.c
In reply to Thomas GleixnerRemove the volatile in apic. We have a cpu_relax() in the wait loop. Fix a coding style issue while at it.
--- arch/i386/kernel/apic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/i386/kernel/apic.c +2 -2
@@ -318,7 +318,7 @@ static void __devinit setup_APIC_timer(v#define LAPIC_CAL_LOOPS (HZ/10) -static __initdata volatile int lapic_cal_loops =-1 ; +static __initdata int lapic_cal_loops =-1 ;static __initdata long lapic_cal_t1, lapic_cal_t2;static __initdata unsigned long long lapic_cal_tsc1, lapic_cal_tsc2;static __initdata unsigned long lapic_cal_pm1, lapic_cal_pm2;
@@ -488,7 +488,7 @@ void __init setup_boot_APIC_clock(void)/* Let the interrupts run */ local_irq_enable (); -while (lapic_cal_loops <=LAPIC_CAL_LOOPS ) +while (lapic_cal_loops <=LAPIC_CAL_LOOPS )cpu_relax ();local_irq_disable ();
PATCH 16/28 i386: hpet assumes boot cpu is 0
In reply to Thomas GleixnerFrom: Chris Wright <[email protected]>
I fixed this in x86_64. Looks like the kind of thing that will break voyager on i386.
--- arch/i386/kernel/hpet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/i386/kernel/hpet.c +1 -1
@@ -325,7 +325,7 @@ int __init hpet_enable(void)* Start hpet with the boot cpu mask and make it * global after the IO_APIC has been initialized. */ - hpet_clockevent.cpumask =cpumask_of_cpu (0 ); + hpet_clockevent.cpumask =cpumask_of_cpu (smp_processor_id ());clockevents_register_device (&hpet_clockevent); global_clock_event = &hpet_clockevent;return 1 ;
PATCH 17/28 i386: move PIT function declarations and constants to correct header file
In reply to Thomas Gleixnersetup_pit_timer is declared in asm-i386/timer.h. Move it to the pit header file, so it can be used by x86_64 as well.
Move also the PIT constants.
--- arch/i386/kernel/i8253.c | 2 -- arch/i386/kernel/vmiclock.c | 1 + include/asm-i386/i8253.h | 7 +++++++ include/asm-i386/mach-default/io_ports.h | 5 ----- include/asm-i386/timer.h | 1 - 5 files changed, 8 insertions(+), 8 deletions(-)
include/asm-i386/i8253.h +7 -0
@@ -3,6 +3,11 @@#include <linux/clockchips.h> +/* i8253A PIT registers */ +#define PIT_MODE 0x43 +#define PIT_CH0 0x40 +#define PIT_CH2 0x42 +extern spinlock_t i8253_lock;extern struct clock_event_device *global_clock_event;
@@ -18,4 +23,6 @@ static inline void pit_interrupt_hook(vo global_clock_event->event_handler(global_clock_event); } +extern void setup_pit_timer (void ); +#endif /* __ASM_I8253_H__ */
include/asm-i386/timer.h +0 -1
@@ -6,7 +6,6 @@#define TICK_SIZE (tick_nsec / 1000) -void setup_pit_timer (void );unsigned long long native_sched_clock (void );unsigned long native_calculate_cpu_khz (void );
arch/i386/kernel/i8253.c +0 -2
@@ -15,8 +15,6 @@#include <asm/io.h> #include <asm/timer.h> -#include "io_ports.h" -DEFINE_SPINLOCK (i8253_lock);EXPORT_SYMBOL (i8253_lock);
arch/i386/kernel/vmiclock.c +1 -0
@@ -32,6 +32,7 @@#include <asm/apicdef.h> #include <asm/apic.h> #include <asm/timer.h> +#include <asm/i8253.h> #include <irq_vectors.h> #include "io_ports.h"
include/asm-i386/mach-default/io_ports.h +0 -5
@@ -7,11 +7,6 @@#ifndef _MACH_IO_PORTS_H#define _MACH_IO_PORTS_H -/* i8253A PIT registers */ -#define PIT_MODE 0x43 -#define PIT_CH0 0x40 -#define PIT_CH2 0x42 -/* i8259A PIC registers */ #define PIC_MASTER_CMD 0x20#define PIC_MASTER_IMR 0x21
PATCH 18/28 x86_64: untangle asm/hpet.h from asm/timex.h
In reply to Thomas GleixnerFrom: Chris Wright <[email protected]>
When making changes to x86_64 timers, I noticed that touching hpet.h triggered an unreasonably large rebuild. Untangling it from timex.h quiets the extra rebuild quite a bit.
--- drivers/char/rtc.c | 2 +- include/asm-x86_64/apic.h | 2 ++ include/asm-x86_64/hpet.h | 1 - include/asm-x86_64/timex.h | 1 - 4 files changed, 3 insertions(+), 3 deletions(-)
drivers/char/rtc.c +1 -1
@@ -82,7 +82,7 @@#include <asm/uaccess.h> #include <asm/system.h> -#if defined(__i386__) +#ifdef CONFIG_X86 #include <asm/hpet.h> #endif
include/asm-x86_64/timex.h +0 -1
@@ -9,7 +9,6 @@#include <asm/8253pit.h> #include <asm/msr.h> #include <asm/vsyscall.h> -#include <asm/hpet.h> #include <asm/system.h> #include <asm/processor.h> #include <asm/tsc.h>
include/asm-x86_64/apic.h +2 -0
@@ -86,6 +86,8 @@ extern void setup_apic_routing(void);extern void setup_APIC_extened_lvt (unsigned char lvt_off,unsigned char vector,unsigned char msg_type,unsigned char mask); +extern int apic_is_clustered_box (void ); +#define K8_APIC_EXT_LVT_BASE 0x500#define K8_APIC_EXT_INT_MSG_FIX 0x0#define K8_APIC_EXT_INT_MSG_SMI 0x2
include/asm-x86_64/hpet.h +0 -1
@@ -55,7 +55,6 @@extern int is_hpet_enabled (void );extern int hpet_rtc_timer_init (void ); -extern int apic_is_clustered_box (void );extern int hpet_arch_init (void );extern int hpet_timer_stop_set_go (unsigned long tick);extern int hpet_reenable (void );
PATCH 19/28 x86_64: Use generic cmos update
In reply to Thomas GleixnerUse the generic cmos update function in kernel/time/ntp.c
--- arch/x86_64/Kconfig | 4 ++++ arch/x86_64/kernel/time.c | 25 +++++++++---------------- 2 files changed, 13 insertions(+), 16 deletions(-)
arch/x86_64/kernel/time.c +9 -16
@@ -82,8 +82,9 @@ EXPORT_SYMBOL(profile_pc);* sheet for details. */ -static void set_rtc_mmss (unsigned long nowtime) +static int set_rtc_mmss (unsigned long nowtime) { +int retval =0 ;int real_seconds, real_minutes, cmos_minutes;unsigned char control, freq_select;
@@ -123,6 +124,7 @@ static void set_rtc_mmss(unsigned long nif (abs (real_minutes - cmos_minutes) >=30 ) {printk (KERN_WARNING "time.c: can't update CMOS clock " "from %d to %d\n" , cmos_minutes, real_minutes); + retval =-1 ; }else {BIN_TO_BCD (real_seconds);BIN_TO_BCD (real_minutes);
@@ -142,12 +144,17 @@ static void set_rtc_mmss(unsigned long nCMOS_WRITE (freq_select,RTC_FREQ_SELECT );spin_unlock (&rtc_lock); + +return retval; } +int update_persistent_clock (struct timespec now) +{ +return set_rtc_mmss (now.tv_sec); +}void main_timer_handler (void ) { -static unsigned long rtc_update =0 ;/* * Here we are in the timer irq handler. We have irqs locally disabled (so we * don't need spin_lock_irqsave()) but we don't know if the timer_bh is running
@@ -175,20 +182,6 @@ void main_timer_handler(void)if (!using_apic_timer)smp_local_timer_interrupt (); -/* -* If we have an externally synchronized Linux clock, then update CMOS clock -* accordingly every ~11 minutes. set_rtc_mmss() will be called in the jiffy -* closest to exactly 500 ms before the next second. If the update fails, we -* don't care, as it'll be updated on the next turn, and the problem (time way -* off) isn't likely to go away much sooner anyway. -*/ - -if (ntp_synced () && xtime.tv_sec > rtc_update && -abs (xtime.tv_nsec -500000000 ) <= tick_nsec /2 ) { -set_rtc_mmss (xtime.tv_sec); - rtc_update = xtime.tv_sec +660 ; - } -write_sequnlock (&xtime_lock); }
arch/x86_64/Kconfig +4 -0
@@ -32,6 +32,10 @@ config GENERIC_TIME_VSYSCALL bool default y +config GENERIC_CMOS_UPDATE + bool + default y + config ZONE_DMA32 bool default y
PATCH 20/28 x86-64: remove dead code and other janitor work in tsc.c
In reply to Thomas GleixnerRemove unused code and variables and do some codingstyle / whitespace cleanups while at it.
--- arch/x86_64/kernel/tsc.c | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-)
arch/x86_64/kernel/tsc.c +11 -30
@@ -35,25 +35,9 @@ static inline int check_tsc_unstable(voi* first tick after the change will be slightly wrong. */ -#include <linux/workqueue.h> - -static unsigned int cpufreq_delayed_issched =0 ; -static unsigned int cpufreq_init =0 ; -static struct work_struct cpufreq_delayed_get_work; - -static void handle_cpufreq_delayed_get (struct work_struct *v) -{ -unsigned int cpu; -for_each_online_cpu (cpu) { -cpufreq_get (cpu); - } - cpufreq_delayed_issched =0 ; -} - -static unsigned int ref_freq =0 ; -static unsigned long loops_per_jiffy_ref =0 ; - -static unsigned long tsc_khz_ref =0 ; +static unsigned int ref_freq; +static unsigned long loops_per_jiffy_ref; +static unsigned long tsc_khz_ref;static int time_cpufreq_notifier (struct notifier_block *nb,unsigned long val,void *data)
@@ -97,10 +81,8 @@ static struct notifier_block time_cpufrestatic int __init cpufreq_tsc (void ) { -INIT_WORK (&cpufreq_delayed_get_work, handle_cpufreq_delayed_get); -if (!cpufreq_register_notifier (&time_cpufreq_notifier_block, -CPUFREQ_TRANSITION_NOTIFIER )) - cpufreq_init =1 ; +cpufreq_register_notifier (&time_cpufreq_notifier_block, +CPUFREQ_TRANSITION_NOTIFIER );return 0 ; }
@@ -108,8 +90,6 @@ core_initcall(cpufreq_tsc);#endif -static int tsc_unstable =0 ; -/* * Make an educated guess if the TSC is trustworthy and synchronized * over all CPUs.
@@ -122,17 +102,18 @@ __cpuinit int unsynchronized_tsc(void)#endif /* Most intel systems have synchronized TSCs except for multi node systems */ -if (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL ) { +if (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL ) {#ifdef CONFIG_ACPI /* But TSC doesn't tick in C3 so don't use it there */ -if (acpi_gbl_FADT.header.length >0 && acpi_gbl_FADT.C3latency <1000 ) +if (acpi_gbl_FADT.header.length >0 && + acpi_gbl_FADT.C3latency <1000 )return 1 ;#endif -return 0 ; +return 0 ; } -/* Assume multi socket systems are not synchronized */ -return num_present_cpus () >1 ; +/* Assume multi socket systems are not synchronized */ +return num_present_cpus () >1 ; }int __init notsc_setup (char *s)
PATCH 21/28 x86-64: Fix APIC typo
In reply to Thomas Gleixner--- arch/x86_64/kernel/apic.c | 4 ++-- arch/x86_64/kernel/mce_amd.c | 6 +++--- include/asm-x86_64/apic.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
arch/x86_64/kernel/apic.c +2 -2
@@ -990,8 +990,8 @@ int setup_profiling_timer(unsigned int mreturn -EINVAL ; } -void setup_APIC_extened_lvt (unsigned char lvt_off,unsigned char vector, -unsigned char msg_type,unsigned char mask) +void setup_APIC_extended_lvt (unsigned char lvt_off,unsigned char vector, +unsigned char msg_type,unsigned char mask) {unsigned long reg = (lvt_off <<4 ) +K8_APIC_EXT_LVT_BASE ;unsigned int v = (mask <<16 ) | (msg_type <<8 ) | vector;
arch/x86_64/kernel/mce_amd.c +3 -3
@@ -157,9 +157,9 @@ void __cpuinit mce_amd_feature_init(stru high |=K8_APIC_EXT_LVT_ENTRY_THRESHOLD <<20 ;wrmsr (address, low, high); -setup_APIC_extened_lvt (K8_APIC_EXT_LVT_ENTRY_THRESHOLD , -THRESHOLD_APIC_VECTOR , -K8_APIC_EXT_INT_MSG_FIX ,0 ); +setup_APIC_extended_lvt (K8_APIC_EXT_LVT_ENTRY_THRESHOLD , +THRESHOLD_APIC_VECTOR , +K8_APIC_EXT_INT_MSG_FIX ,0 ); threshold_defaults.address = address;threshold_restart_bank (&threshold_defaults,0 ,0 );
include/asm-x86_64/apic.h +2 -2
@@ -83,8 +83,8 @@ extern void disable_APIC_timer(void);extern void enable_APIC_timer (void );extern void setup_apic_routing (void ); -extern void setup_APIC_extened_lvt (unsigned char lvt_off,unsigned char vector, -unsigned char msg_type,unsigned char mask); +extern void setup_APIC_extended_lvt (unsigned char lvt_off,unsigned char vector, +unsigned char msg_type,unsigned char mask);extern int apic_is_clustered_box (void );
PATCH 22/28 x86_64: Convert to cleckevents
In reply to Thomas GleixnerConvert x86_64 to the clockevents code. Share code with i386 for hpet and PIT.
Build and whitespace fixups from:
Venki Pallipadi <[email protected]>
and
Chris Wright <[email protected]>
Based on an initial patch from Chris Wright <[email protected]>
--- arch/i386/kernel/hpet.c | 50 +++ arch/i386/kernel/i8253.c | 3 arch/x86_64/Kconfig | 12 arch/x86_64/kernel/Makefile | 4 arch/x86_64/kernel/apic.c | 563 ++++++++++++++++++++++++------------------- arch/x86_64/kernel/hpet.c | 493 ------------------------------------- arch/x86_64/kernel/i8259.c | 47 --- arch/x86_64/kernel/smpboot.c | 4 arch/x86_64/kernel/time.c | 253 ++----------------- arch/x86_64/kernel/tsc.c | 90 ++++++ include/asm-i386/hpet.h | 125 +++------ include/asm-i386/tsc.h | 4 include/asm-x86_64/apic.h | 6 include/asm-x86_64/hpet.h | 77 ----- include/asm-x86_64/i8253.h | 8 include/asm-x86_64/proto.h | 3 16 files changed, 557 insertions(+), 1185 deletions(-)
arch/x86_64/kernel/time.c +29 -224
@@ -28,11 +28,11 @@#include <linux/cpu.h> #include <linux/kallsyms.h> #include <linux/acpi.h> +#include <linux/clockchips.h> #ifdef CONFIG_ACPI #include <acpi/achware.h> /* for PM timer frequency */ #include <acpi/acpi_bus.h> #endif -#include <asm/8253pit.h> #include <asm/i8253.h> #include <asm/pgtable.h> #include <asm/vsyscall.h>
@@ -47,12 +47,8 @@#include <asm/nmi.h> #include <asm/vgtod.h> -static char *timename =NULL ; -DEFINE_SPINLOCK (rtc_lock);EXPORT_SYMBOL (rtc_lock); -DEFINE_SPINLOCK (i8253_lock); -EXPORT_SYMBOL (i8253_lock);volatile unsigned long __jiffies __section_jiffies =INITIAL_JIFFIES ;
@@ -153,49 +149,14 @@ int update_persistent_clock(struct timesreturn set_rtc_mmss (now.tv_sec); } -void main_timer_handler (void ) -{ -/* -* Here we are in the timer irq handler. We have irqs locally disabled (so we -* don't need spin_lock_irqsave()) but we don't know if the timer_bh is running -* on the other CPU, so we need a lock. We also need to lock the vsyscall -* variables, because both do_timer() and us change them -arca+vojtech -*/ - -write_seqlock (&xtime_lock); - -/* -* Do the timer stuff. -*/ - -do_timer (1 ); -#ifndef CONFIG_SMP -update_process_times (user_mode (get_irq_regs ())); -#endif - -/* -* In the SMP case we use the local APIC timer interrupt to do the profiling, -* except when we simulate SMP mode on a uniprocessor system, in that case we -* have to call the local interrupt handler. -*/ - -if (!using_apic_timer) -smp_local_timer_interrupt (); - -write_sequnlock (&xtime_lock); -} -static irqreturn_t timer_interrupt (int irq,void *dev_id) { -if (apic_runs_main_timer >1 ) -return IRQ_HANDLED ; -main_timer_handler (); -if (using_apic_timer) -smp_send_timer_broadcast_ipi (); + global_clock_event->event_handler (global_clock_event); +return IRQ_HANDLED ; } -static unsigned long get_cmos_time (void ) +unsigned long read_persistent_clock (void ) {unsigned int year, mon, day, hour, min, sec;unsigned long flags;
@@ -222,7 +183,7 @@ static unsigned long get_cmos_time(void)/* * We know that x86-64 always uses BCD format, no need to check the * config register. -*/ +*/ BCD_TO_BIN (sec);BCD_TO_BIN (min);
@@ -235,11 +196,11 @@ static unsigned long get_cmos_time(void)BCD_TO_BIN (century); year += century *100 ;printk (KERN_INFO "Extended CMOS year: %d\n" , century *100 ); - }else { + }else {/* * x86-64 systems only exists since 2002. * This will work up to Dec 31, 2100 -*/ +*/ year +=2000 ; }
@@ -257,17 +218,17 @@ static unsigned int __init tsc_calibrateunsigned long flags;for (i =0 ; i <4 ; i++) -if (avail_to_resrv_perfctr_nmi_bit (i)) -break ; +if (avail_to_resrv_perfctr_nmi_bit (i)) +break ; no_ctr_free = (i ==4 );if (no_ctr_free) { - i =3 ; -rdmsrl (MSR_K7_EVNTSEL3 , evntsel3); -wrmsrl (MSR_K7_EVNTSEL3 ,0 ); -rdmsrl (MSR_K7_PERFCTR3 , pmc3); + i =3 ; +rdmsrl (MSR_K7_EVNTSEL3 , evntsel3); +wrmsrl (MSR_K7_EVNTSEL3 ,0 ); +rdmsrl (MSR_K7_PERFCTR3 , pmc3); }else { -reserve_perfctr_nmi (MSR_K7_PERFCTR0 + i); -reserve_evntsel_nmi (MSR_K7_EVNTSEL0 + i); +reserve_perfctr_nmi (MSR_K7_PERFCTR0 + i); +reserve_evntsel_nmi (MSR_K7_EVNTSEL0 + i); }local_irq_save (flags);/* start meauring cycles, incrementing from 0 */
@@ -275,119 +236,38 @@ static unsigned int __init tsc_calibratewrmsrl (MSR_K7_EVNTSEL0 + i,1 <<22 |3 <<16 |0x76 );rdtscl (tsc_start);do { -rdmsrl (MSR_K7_PERFCTR0 + i, pmc_now); - tsc_now =get_cycles_sync (); +rdmsrl (MSR_K7_PERFCTR0 + i, pmc_now); + tsc_now =get_cycles_sync (); }while ((tsc_now - tsc_start) <TICK_COUNT );local_irq_restore (flags);if (no_ctr_free) { -wrmsrl (MSR_K7_EVNTSEL3 ,0 ); -wrmsrl (MSR_K7_PERFCTR3 , pmc3); -wrmsrl (MSR_K7_EVNTSEL3 , evntsel3); +wrmsrl (MSR_K7_EVNTSEL3 ,0 ); +wrmsrl (MSR_K7_PERFCTR3 , pmc3); +wrmsrl (MSR_K7_EVNTSEL3 , evntsel3); }else { -release_perfctr_nmi (MSR_K7_PERFCTR0 + i); -release_evntsel_nmi (MSR_K7_EVNTSEL0 + i); +release_perfctr_nmi (MSR_K7_PERFCTR0 + i); +release_evntsel_nmi (MSR_K7_EVNTSEL0 + i); }return pmc_now * tsc_khz / (tsc_now - tsc_start); } -/* -* pit_calibrate_tsc() uses the speaker output (channel 2) of -* the PIT. This is better than using the timer interrupt output, -* because we can read the value of the speaker with just one inb(), -* where we need three i/o operations for the interrupt channel. -* We count how many ticks the TSC does in 50 ms. -*/ - -static unsigned int __init pit_calibrate_tsc (void ) -{ -unsigned long start, end; -unsigned long flags; - -spin_lock_irqsave (&i8253_lock, flags); - -outb ((inb (0x61 ) & ~0x02 ) |0x01 ,0x61 ); - -outb (0xb0 ,0x43 ); -outb ((PIT_TICK_RATE / (1000 /50 )) &0xff ,0x42 ); -outb ((PIT_TICK_RATE / (1000 /50 )) >>8 ,0x42 ); - start =get_cycles_sync (); -while ((inb (0x61 ) &0x20 ) ==0 ); - end =get_cycles_sync (); - -spin_unlock_irqrestore (&i8253_lock, flags); - -return (end - start) /50 ; -} - -#define PIT_MODE 0x43 -#define PIT_CH0 0x40 - -static void __pit_init (int val,u8 mode) -{ -unsigned long flags; - -spin_lock_irqsave (&i8253_lock, flags); -outb_p (mode,PIT_MODE ); -outb_p (val &0xff ,PIT_CH0 );/* LSB */ -outb_p (val >>8 ,PIT_CH0 );/* MSB */ -spin_unlock_irqrestore (&i8253_lock, flags); -} - -void __init pit_init (void ) -{ -__pit_init (LATCH ,0x34 );/* binary, mode 2, LSB/MSB, ch 0 */ -} - -void pit_stop_interrupt (void ) -{ -__pit_init (0 ,0x30 );/* mode 0 */ -} - -void stop_timer_interrupt (void ) -{ -char *name; -if (hpet_address) { - name ="HPET" ; -hpet_timer_stop_set_go (0 ); - }else { - name ="PIT" ; -pit_stop_interrupt (); - } -printk (KERN_INFO "timer: %s interrupt stopped.\n" , name); -} -static struct irqaction irq0 = { .handler = timer_interrupt, .flags =IRQF_DISABLED |IRQF_IRQPOLL , .mask =CPU_MASK_NONE , - .name ="timer" + .name ="timer" };void __init time_init (void ) { -if (nohpet) - hpet_address =0 ; - xtime.tv_sec =get_cmos_time (); - xtime.tv_nsec =0 ; - -set_normalized_timespec (&wall_to_monotonic, - -xtime.tv_sec, -xtime.tv_nsec); - -if (hpet_arch_init ()) - hpet_address =0 ; - -if (hpet_use_timer) { -/* set tick_nsec to use the proper rate for HPET */ - tick_nsec =TICK_NSEC_HPET ; - tsc_khz =hpet_calibrate_tsc (); - timename ="HPET" ; - }else { -pit_init (); - tsc_khz =pit_calibrate_tsc (); - timename ="PIT" ; - } +if (!hpet_enable ()) +setup_pit_timer (); + +setup_irq (0 , &irq0); + +tsc_calibrate (); cpu_khz = tsc_khz; if (cpu_has(&boot_cpu_data, X86_FEATURE_CONSTANT_TSC) &&
@@ -406,79 +286,4 @@ void __init time_init(void)printk (KERN_INFO "time.c: Detected %d.%03d MHz processor.\n" , cpu_khz /1000 , cpu_khz %1000 );init_tsc_clocksource (); - -setup_irq (0 , &irq0); } - - -static long clock_cmos_diff; -static unsigned long sleep_start; - -/* -* sysfs support for the timer. -*/ - -static int timer_suspend (struct sys_device *dev,pm_message_t state) -{ -/* -* Estimate time zone so that set_time can update the clock -*/ -long cmos_time =get_cmos_time (); - - clock_cmos_diff = -cmos_time; - clock_cmos_diff +=get_seconds (); - sleep_start = cmos_time; -return 0 ; -} - -static int timer_resume (struct sys_device *dev) -{ -unsigned long flags; -unsigned long sec; -unsigned long ctime =get_cmos_time (); -long sleep_length = (ctime - sleep_start) *HZ ; - -if (sleep_length <0 ) { -printk (KERN_WARNING "Time skew detected in timer resume!\n" ); -/* The time after the resume must not be earlier than the time -* before the suspend or some nasty things will happen -*/ - sleep_length =0 ; - ctime = sleep_start; - } -if (hpet_address) -hpet_reenable (); -else -i8254_timer_resume (); - - sec = ctime + clock_cmos_diff; -write_seqlock_irqsave (&xtime_lock,flags); - xtime.tv_sec = sec; - xtime.tv_nsec =0 ; - jiffies += sleep_length; -write_sequnlock_irqrestore (&xtime_lock,flags); -touch_softlockup_watchdog (); -return 0 ; -} - -static struct sysdev_class timer_sysclass = { - .resume = timer_resume, - .suspend = timer_suspend, -set_kset_name ("timer" ), -}; - -/* XXX this sysfs stuff should probably go elsewhere later -john */ -static struct sys_device device_timer = { - .id =0 , - .cls = &timer_sysclass, -}; - -static int time_init_device (void ) -{ -int error =sysdev_class_register (&timer_sysclass); -if (!error) - error =sysdev_register (&device_timer); -return error; -} - -device_initcall (time_init_device);
arch/x86_64/kernel/hpet.c deleted +0 -493
493 lines not on this page · raw message
arch/x86_64/Kconfig +12 -0
@@ -28,6 +28,18 @@ config GENERIC_TIME bool default y +config GENERIC_CLOCKEVENTS + bool + default y + +config GENERIC_CLOCKEVENTS_BROADCAST + bool + default y + +config NONIRQ_WAKEUP + bool + default y + config GENERIC_TIME_VSYSCALL bool default y
include/asm-x86_64/hpet.h +1 -76
78 lines not on this page · raw message
include/asm-i386/hpet.h +50 -75
162 lines not on this page · raw message
arch/i386/kernel/hpet.c +45 -5
97 lines not on this page · raw message
arch/x86_64/kernel/smpboot.c +0 -4
@@ -223,8 +223,6 @@ void __cpuinit smp_callin(void)local_irq_disable ();Dprintk ("Stack at about %p\n" ,&cpuid); -disable_APIC_timer (); -/* * Save our processor parameters */
@@ -348,8 +346,6 @@ void __cpuinit start_secondary(void)enable_8259A_irq (0 ); } -enable_APIC_timer (); -/* * The sibling maps must be set before turing the online map on for * this cpu
include/asm-x86_64/i8253.h +2 -6
@@ -1,6 +1,2 @@ -#ifndef __ASM_I8253_H__ -#define __ASM_I8253_H__ - -extern spinlock_t i8253_lock; - -#endif /* __ASM_I8253_H__ */ +#include <asm-i386/i8253.h> +#include <asm/8253pit.h>
include/asm-x86_64/proto.h +0 -3
@@ -51,9 +51,6 @@ extern void reserve_bootmem_generic(unsiextern void load_gs_index (unsigned gs); -extern void stop_timer_interrupt (void ); -extern void main_timer_handler (void ); -extern unsigned long end_pfn_map;extern void show_trace (struct task_struct *,struct pt_regs *,unsigned long * rsp);
arch/i386/kernel/i8253.c +3 -0
@@ -120,6 +120,7 @@ void __init setup_pit_timer(void) global_clock_event = &pit_clockevent; } +#ifndef CONFIG_X86_64 /* * Since the PIT overflows every tick, its not very useful * to just read by itself. So use jiffies to emulate a free
@@ -204,3 +205,5 @@ static int __init init_pit_clocksource(v return clocksource_register(&clocksource_pit); }arch_initcall (init_pit_clocksource); + +#endif
arch/x86_64/kernel/tsc.c +90 -0
103 lines not on this page · raw message
include/asm-i386/tsc.h +4 -0
@@ -71,4 +71,8 @@ extern void init_tsc_clocksource(void);extern void check_tsc_sync_source (int cpu);extern void check_tsc_sync_target (void ); +#ifdef CONFIG_X86_64 +extern void tsc_calibrate (void ); +#endif +#endif
arch/x86_64/kernel/i8259.c +0 -47
59 lines not on this page · raw message
arch/x86_64/kernel/Makefile +3 -1
@@ -9,7 +9,7 @@ obj-y := process.o signal.o entry.o trap x8664_ksyms.o i387.o syscall.o vsyscall.o \ setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o \ pci-dma.o pci-nommu.o alternative.o hpet.o tsc.o bugs.o \ - perfctr-watchdog.o sched-clock.o + perfctr-watchdog.o sched-clock.o i8253.o obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_X86_MCE) += mce.o therm_throt.o
@@ -49,6 +49,8 @@ obj-y += pcspeaker.o CFLAGS_vsyscall.o := $(PROFILING) -g0 +i8253-y += ../../i386/kernel/i8253.o +hpet-y += ../../i386/kernel/hpet.o therm_throt-y += ../../i386/kernel/cpu/mcheck/therm_throt.o bootflag-y += ../../i386/kernel/bootflag.o legacy_serial-y += ../../i386/kernel/legacy_serial.o
arch/x86_64/kernel/apic.c +318 -245
751 lines not on this page · raw message
include/asm-x86_64/apic.h +0 -6
@@ -79,8 +79,6 @@ extern void smp_local_timer_interrupt (vextern void setup_boot_APIC_clock (void );extern void setup_secondary_APIC_clock (void );extern int APIC_init_uniprocessor (void ); -extern void disable_APIC_timer (void ); -extern void enable_APIC_timer (void );extern void setup_apic_routing (void ); extern void setup_APIC_extended_lvt(unsigned char lvt_off, unsigned char vector,
@@ -95,10 +93,6 @@ extern int apic_is_clustered_box(void);#define K8_APIC_EXT_INT_MSG_EXT 0x7#define K8_APIC_EXT_LVT_ENTRY_THRESHOLD 0 -void smp_send_timer_broadcast_ipi (void ); -void switch_APIC_timer_to_ipi (void *cpumask); -void switch_ipi_to_APIC_timer (void *cpumask); -#define ARCH_APICTIMER_STOPS_ON_C3 1extern unsigned boot_cpu_id;
Re: [patch -mm 22/28] x86_64: Convert to cleckevents
Quoted 7 lines · On Sat, 23 Jun 2007 13:32:47 -0000 Thomas Gleixner <[email protected]> wrote:
Convert
x86_64to the clockevents code. Share code with i386 for hpet and PIT.Build and whitespace fixups from:
Venki Pallipadi <[email protected]>
and
Chris Wright <[email protected]>
semi-fixes.
Quoted 31 lines
if (no_ctr_free) {arch/x86_64/kernel/time.c +8
-10- i =3 ; -rdmsrl (MSR_K7_EVNTSEL3 , evntsel3); -wrmsrl (MSR_K7_EVNTSEL3 ,0 ); -rdmsrl (MSR_K7_PERFCTR3 , pmc3); + i =3 ; +rdmsrl (MSR_K7_EVNTSEL3 , evntsel3); +wrmsrl (MSR_K7_EVNTSEL3 ,0 ); +rdmsrl (MSR_K7_PERFCTR3 , pmc3); }else { -reserve_perfctr_nmi (MSR_K7_PERFCTR0 + i); -reserve_evntsel_nmi (MSR_K7_EVNTSEL0 + i); +reserve_perfctr_nmi (MSR_K7_PERFCTR0 + i); +reserve_evntsel_nmi (MSR_K7_EVNTSEL0 + i); }local_irq_save (flags);/* start meauring cycles, incrementing from 0 */ @@ -275,119 +236,38 @@ static unsigned int __init tsc_calibratewrmsrl (MSR_K7_EVNTSEL0 + i,1 <<22 |3 <<16 |0x76 );rdtscl (tsc_start);do { -rdmsrl (MSR_K7_PERFCTR0 + i, pmc_now); - tsc_now =get_cycles_sync (); +rdmsrl (MSR_K7_PERFCTR0 + i, pmc_now); + tsc_now =get_cycles_sync (); }while ((tsc_now - tsc_start) <TICK_COUNT );local_irq_restore (flags);if (no_ctr_free) { -wrmsrl (MSR_K7_EVNTSEL3 ,0 ); -wrmsrl (MSR_K7_PERFCTR3 , pmc3);
arch/x86_64/kernel/time.c static unsigned int __init tsc_calibrate · line 251
Quoted 10 lines
arch/x86_64/kernel/time.c +5
-3-wrmsrl (MSR_K7_EVNTSEL3 , evntsel3); +wrmsrl (MSR_K7_EVNTSEL3 ,0 ); +wrmsrl (MSR_K7_PERFCTR3 , pmc3); +wrmsrl (MSR_K7_EVNTSEL3 , evntsel3); }else { -release_perfctr_nmi (MSR_K7_PERFCTR0 + i); -release_evntsel_nmi (MSR_K7_EVNTSEL0 + i); +release_perfctr_nmi (MSR_K7_PERFCTR0 + i); +release_evntsel_nmi (MSR_K7_EVNTSEL0 + i); }
There's still bulk whitespace bustage in here.
(However checkpatch only says
Use #include <linux/hpet.h> instead of <asm/hpet.h> #1913: FILE: arch/x86_64/kernel/tsc.c:11:
+#include <asm/hpet.h>
)
<edits the diff, fixes it>
PATCH 23/28 ACPI: Remove the useless ifdef code
In reply to Thomas GleixnerThe conversion of x86-64 to clock events makes the
#ifdef CONFIG_GENERIC_CLOCKEVENTS
n the timer broadcast functions useless. Remove it.
--- drivers/acpi/processor_idle.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/acpi/processor_idle.c +0 -12
@@ -203,21 +203,12 @@ static void acpi_timer_check_state(int sstatic void acpi_propagate_timer_broadcast (struct acpi_processor *pr) { -#ifdef CONFIG_GENERIC_CLOCKEVENTS unsigned long reason; reason = pr->power.timer_broadcast_on_state <INT_MAX ?CLOCK_EVT_NOTIFY_BROADCAST_ON :CLOCK_EVT_NOTIFY_BROADCAST_OFF ;clockevents_notify (reason, &pr->id); -#else -cpumask_t mask =cpumask_of_cpu (pr->id); - -if (pr->power.timer_broadcast_on_state <INT_MAX ) -on_each_cpu (switch_APIC_timer_to_ipi, &mask,1 ,1 ); -else -on_each_cpu (switch_ipi_to_APIC_timer, &mask,1 ,1 ); -#endif }/* Power(C) State timer broadcast control */
@@ -225,8 +216,6 @@ static void acpi_state_timer_broadcast(sstruct acpi_processor_cx *cx, int broadcast) { -#ifdef CONFIG_GENERIC_CLOCKEVENTS - int state = cx - pr->power.states;if (state >= pr->power.timer_broadcast_on_state) {
@@ -236,7 +225,6 @@ static void acpi_state_timer_broadcast(sCLOCK_EVT_NOTIFY_BROADCAST_EXIT ; clockevents_notify(reason, &pr->id); } -#endif }#else
PATCH 24/28 x86_64: hpet restore vread
In reply to Thomas GleixnerQuoted 1 line
From [email protected]
It seems the hpet clocksource's vread method was lost in the x86_64 conversion to clockevents. So here it is.
arch/i386/kernel/hpet.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/i386/kernel/hpet.c +10 -0
@@ -255,6 +255,13 @@ static cycle_t read_hpet(void)return (cycle_t )hpet_readl (HPET_COUNTER ); } +#ifdef CONFIG_X86_64 +static cycle_t __vsyscall_fn vread_hpet(void) +{ +return readl ((const void __iomem *)fix_to_virt (VSYSCALL_HPET ) +0xf0 ); +} +#endif +static struct clocksource clocksource_hpet = { .name ="hpet" , .rating =250 ,
@@ -263,6 +270,9 @@ static struct clocksource clocksource_hp .shift = HPET_SHIFT, .flags = CLOCK_SOURCE_IS_CONTINUOUS, .resume = hpet_start_counter, +#ifdef CONFIG_X86_64 + .vread = vread_hpet, +#endif };/*
PATCH 25/28 x86_64: restore restore nohpet cmdline
In reply to Thomas GleixnerFrom: Chris Wright <[email protected]>
Lost when merged with i386. Happy to drop, but I suspect Andi would rather not break existing users (I noticed because it was part of my testing). If dropped, Documentation needs updating.
--- arch/i386/kernel/hpet.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/i386/kernel/hpet.c +7 -0
@@ -89,6 +89,13 @@ static int __init hpet_setup(char* str) }__setup ("hpet=" , hpet_setup); +static int __init disable_hpet (char *str) +{ + boot_hpet_disable =1 ; +return 1 ; +} +__setup ("nohpet" , disable_hpet); +static inline int is_hpet_capable (void ) {return (!boot_hpet_disable && hpet_address);
PATCH 26/28 x86-64 block irq balancing for timer
In reply to Thomas GleixnerFrom: Venki Pallipadi <[email protected]>
Disable irq balancing on IRQ0.
--- arch/x86_64/kernel/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86_64/kernel/time.c +1 -1
@@ -255,7 +255,7 @@ static unsigned int __init tsc_calibratestatic struct irqaction irq0 = { .handler = timer_interrupt, - .flags =IRQF_DISABLED |IRQF_IRQPOLL , + .flags =IRQF_DISABLED |IRQF_IRQPOLL |IRQF_NOBALANCING , .mask =CPU_MASK_NONE , .name ="timer" };
Re: [patch -mm 26/28] x86-64 block irq balancing for timer
Quoted 5 lines · Thomas Gleixner
plain text document attachment (x86-64-clockevents-irq-balancing.patch)
From: Venki Pallipadi <[email protected]>Disable irq balancing on IRQ0.
this patch is missing some rationale....
Signature · 2 lines
if you want to mail me at work (you don't), use arjan (at) linux.intel.com Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org
Re: [patch -mm 26/28] x86-64 block irq balancing for timer
Am Sat 23 Jun 2007 11:27:20 PM CEST schrieb Arjan van de Ven <[email protected]>:
Quoted 9 lines · Thomas Gleixner
Quoted 5 lines
plain text document attachment (x86-64-clockevents-irq-balancing.patch)
From: Venki Pallipadi <[email protected]>Disable irq balancing on IRQ0.
this patch is missing some rationale....
Several SIS chipsets lock up when you try to change affinity of IRQ #0
-Andi
Re: [patch -mm 26/28] x86-64 block irq balancing for timer
Quoted 8 lines · Andreas Kleen
Am Sat 23 Jun 2007 11:27:20 PM CEST schrieb Arjan van de Ven <[email protected]>:
Quoted 5 lines · Thomas Gleixner
Quoted 4 lines
plain text document attachment (x86-64-clockevents-irq-balancing.patch)
From: Venki Pallipadi <[email protected]>
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Disable irq balancing on IRQ0.
this patch is missing some rationale....
Several SIS chipsets lock up when you try to change affinity of IRQ #0
so we're protecting root against himself.. fair enough. probably wants a comment in the code
Signature · 2 lines
if you want to mail me at work (you don't), use arjan (at) linux.intel.com Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org
PATCH 27/28 x86_64: prep idle loop for dynticks
In reply to Thomas GleixnerFrom: Chris Wright <[email protected]>
Add tick_nohz_{stop,restart}_sched_tick to idle loop in prepartion for turning on dynticks. These are just noops until NO_HZ is enabled in next patch.
--- arch/x86_64/kernel/process.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86_64/kernel/process.c +4 -0
@@ -37,6 +37,7 @@#include <linux/notifier.h> #include <linux/kprobes.h> #include <linux/kdebug.h> +#include <linux/tick.h> #include <asm/uaccess.h> #include <asm/pgtable.h>
@@ -207,6 +208,8 @@ void cpu_idle (void)if (__get_cpu_var (cpu_idle_state))__get_cpu_var (cpu_idle_state) =0 ; +tick_nohz_stop_sched_tick (); +check_pgt_cache ();rmb (); idle = pm_idle;
@@ -228,6 +231,7 @@ void cpu_idle (void)__exit_idle (); } +tick_nohz_restart_sched_tick ();preempt_enable_no_resched ();schedule ();preempt_disable ();
PATCH 28/28 x86_64: enable high resolution timers and dynticks
In reply to Thomas GleixnerFrom: Chris Wright <[email protected]>
Everything is in place, enable the HIGHRES andf NO_HZ config options.
--- arch/x86_64/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/x86_64/Kconfig +2 -0
@@ -150,6 +150,8 @@ source "init/Kconfig" menu "Processor type and features" +source "kernel/time/Kconfig" + choice prompt "Subarchitecture Type" default X86_PC
Quoted 7 lines · On Sat, 23 Jun 2007 13:32:25 -0000 Thomas Gleixner <[email protected]> wrote:
The following patch series contains:
- dyntick bugfixes for -mm (caused by the cpuidle changes in ACPI)
- updates and improvements to high resolution timer / dynticks
- high resolution timer / dynticks support for
x86_64
Blam. http://userweb.kernel.org/~akpm/hpet-crash.jpg
time_init() is called before slab is set up. We cannot do memory allocations inside time_init().
Quoted 3 lines
The patch set has been tested in the -hrt and -rt trees for quite a while and the initial problems have been sorted out. Thanks to the folks from the PowerTop project for testing and feedback.
hrm. Looks like none of your testers have HPET_ID_LEGSUP hardware. This:
arch/i386/kernel/hpet.c renamed from arch/i386/kernel/hpet.c~a +1 -1
@@ -376,7 +376,7 @@ int __init hpet_enable(void)clocksource_register (&clocksource_hpet); -if (id &HPET_ID_LEGSUP ) { +if (0 && (id &HPET_ID_LEGSUP )) {hpet_enable_int ();hpet_reserve_platform_timers (id);/*
_
gets it working. It basically nobbles the hpet and the kernel chose the TSC clocksource instead.
btw, if you want to know why I go on and on about crappy commenting, try to work out from the kernel source code what HPET_ID_LEGSUP is, and why it gets special treatment. It is not possible. This is not maintainable code.
Quoted 5 lines · On Thursday 28 June 2007 11:42:33 Andrew Morton wrote:
Quoted 3 lines
The patch set has been tested in the -hrt and -rt trees for quite a while and the initial problems have been sorted out. Thanks to the folks from the PowerTop project for testing and feedback.
hrm. Looks like none of your testers have
HPET_ID_LEGSUPhardware.
AFAIK it's only on IBM Summit. You have such a box?
Quoted 4 lines
btw, if you want to know why I go on and on about crappy commenting, try to work out from the kernel source code what
HPET_ID_LEGSUPis, and why it gets special treatment. It is not possible. This is not maintainable code.
We have a reference somewhere to the HPET spec.
-Andi
Quoted 9 lines · On Thu, 28 Jun 2007 11:47:04 +0200 Andi Kleen <[email protected]> wrote:
Quoted 5 lines · On Thursday 28 June 2007 11:42:33 Andrew Morton wrote:
Quoted 3 lines
The patch set has been tested in the -hrt and -rt trees for quite a while and the initial problems have been sorted out. Thanks to the folks from the PowerTop project for testing and feedback.
hrm. Looks like none of your testers have
HPET_ID_LEGSUPhardware.AFAIK it's only on IBM Summit. You have such a box?
Intel Nocona SDV thing. Old.
Quoted 6 lines
Quoted 4 lines
btw, if you want to know why I go on and on about crappy commenting, try to work out from the kernel source code what
HPET_ID_LEGSUPis, and why it gets special treatment. It is not possible. This is not maintainable code.We have a reference somewhere to the HPET spec.
The HPET spec won't tell me why HPET_ID_LEGSUP hpets get a kmalloc in Linux but the !HPET_ID_LEGSUP ones don't.