rpms/kernel/devel linux-2.6-highres-timers.patch, NONE, 1.1 kernel-2.6.spec, 1.3266, 1.3267 linux-2.6-x86_64-vdso.patch, 1.1, 1.2

Dave Jones (davej) fedora-extras-commits at redhat.com
Wed Jul 4 18:04:35 UTC 2007


Author: davej

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11500

Modified Files:
	kernel-2.6.spec linux-2.6-x86_64-vdso.patch 
Added Files:
	linux-2.6-highres-timers.patch 
Log Message:
* Wed Jul 04 2007 Dave Jones <davej at redhat.com>
- x86-64 tickless support.


linux-2.6-highres-timers.patch:

--- NEW FILE linux-2.6-highres-timers.patch ---
Index: linux-2.6.22-rc7/kernel/time/ntp.c
===================================================================
--- linux-2.6.22-rc7.orig/kernel/time/ntp.c	2007-07-03 20:27:54.000000000 +0200
+++ linux-2.6.22-rc7/kernel/time/ntp.c	2007-07-03 20:27:59.000000000 +0200
@@ -8,11 +8,12 @@
  * changelogs.
  */
 
+#include <linux/hrtimer.h>
+#include <linux/jiffies.h>
 #include <linux/mm.h>
 #include <linux/time.h>
+#include <linux/timer.h>
 #include <linux/timex.h>
-#include <linux/jiffies.h>
-#include <linux/hrtimer.h>
 
 #include <asm/div64.h>
 #include <asm/timex.h>
@@ -122,7 +123,6 @@ void second_overflow(void)
 			 */
 			time_interpolator_update(-NSEC_PER_SEC);
 			time_state = TIME_OOP;
-			clock_was_set();
 			printk(KERN_NOTICE "Clock: inserting leap second "
 					"23:59:60 UTC\n");
 		}
@@ -137,7 +137,6 @@ void second_overflow(void)
 			 */
 			time_interpolator_update(NSEC_PER_SEC);
 			time_state = TIME_WAIT;
-			clock_was_set();
 			printk(KERN_NOTICE "Clock: deleting leap second "
 					"23:59:59 UTC\n");
 		}
@@ -187,12 +186,64 @@ u64 current_tick_length(void)
 	return tick_length;
 }
 
+#ifdef CONFIG_GENERIC_CMOS_UPDATE
+
+/* Disable the cmos update - used by virtualization and embedded */
+int no_sync_cmos_clock  __read_mostly;
 
-void __attribute__ ((weak)) notify_arch_cmos_timer(void)
+static void sync_cmos_clock(unsigned long dummy);
+
+static DEFINE_TIMER(sync_cmos_timer, sync_cmos_clock, 0, 0);
+
+static void sync_cmos_clock(unsigned long dummy)
 {
-	return;
+	struct timespec now, next;
+	int fail = 1;
+
+	/*
+	 * If we have an externally synchronized Linux clock, then update
+	 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
+	 * called as close as possible to 500 ms before the new second starts.
+	 * This code is run on a timer.  If the clock is set, that timer
+	 * may not expire at the correct time.  Thus, we adjust...
+	 */
+	if (!ntp_synced())
+		/*
+		 * Not synced, exit, do not restart a timer (if one is
+		 * running, let it run out).
+		 */
+		return;
+
+	getnstimeofday(&now);
+	if (abs(xtime.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2)
+		fail = update_persistent_clock(now);
+
+	next.tv_nsec = (NSEC_PER_SEC / 2) - now.tv_nsec;
+	if (next.tv_nsec <= 0)
+		next.tv_nsec += NSEC_PER_SEC;
+
+	if (!fail)
+		next.tv_sec = 659;
+	else
+		next.tv_sec = 0;
+
+	if (next.tv_nsec >= NSEC_PER_SEC) {
+		next.tv_sec++;
+		next.tv_nsec -= NSEC_PER_SEC;
+	}
+	mod_timer(&sync_cmos_timer, jiffies + timespec_to_jiffies(&next));
 }
 
+static void notify_cmos_timer(void)
+{
+	if (no_sync_cmos_clock)
+		mod_timer(&sync_cmos_timer, jiffies + 1);
+}
+
+#else
+static inline void notify_cmos_timer(void) { }
+#endif
+
 /* adjtimex mainly allows reading (and writing, if superuser) of
  * kernel time-keeping variables. used by xntpd.
  */
@@ -357,6 +408,6 @@ leave:	if ((time_status & (STA_UNSYNC|ST
 	txc->stbcnt	   = 0;
 	write_sequnlock_irq(&xtime_lock);
 	do_gettimeofday(&txc->time);
-	notify_arch_cmos_timer();
+	notify_cmos_timer();
 	return(result);
 }
Index: linux-2.6.22-rc7/arch/i386/Kconfig
===================================================================
--- linux-2.6.22-rc7.orig/arch/i386/Kconfig	2007-07-03 20:27:53.000000000 +0200
+++ linux-2.6.22-rc7/arch/i386/Kconfig	2007-07-03 20:27:59.000000000 +0200
@@ -18,6 +18,10 @@ config GENERIC_TIME
 	bool
 	default y
 
+config GENERIC_CMOS_UPDATE
+	bool
+	default y
+
 config CLOCKSOURCE_WATCHDOG
 	bool
 	default y
@@ -1053,6 +1057,8 @@ endif # APM
 
 source "arch/i386/kernel/cpu/cpufreq/Kconfig"
 
+source "drivers/cpuidle/Kconfig"
+
 endmenu
 
 menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)"
Index: linux-2.6.22-rc7/arch/x86_64/Kconfig
===================================================================
--- linux-2.6.22-rc7.orig/arch/x86_64/Kconfig	2007-07-03 20:27:53.000000000 +0200
+++ linux-2.6.22-rc7/arch/x86_64/Kconfig	2007-07-03 20:28:01.000000000 +0200
@@ -28,10 +28,22 @@ config GENERIC_TIME
 	bool
 	default y
 
+config GENERIC_CLOCKEVENTS_BROADCAST
+	bool
+	default y
+
+config GENERIC_CLOCKEVENTS
+	bool
+	default y
+
 config GENERIC_TIME_VSYSCALL
 	bool
 	default y
 
+config GENERIC_CMOS_UPDATE
+	bool
+	default y
+
 config ZONE_DMA32
 	bool
 	default y
@@ -126,6 +138,8 @@ source "init/Kconfig"
 
 menu "Processor type and features"
 
+source "kernel/time/Kconfig"
+
 choice
 	prompt "Subarchitecture Type"
 	default X86_PC
@@ -698,6 +712,8 @@ source "drivers/acpi/Kconfig"
 
 source "arch/x86_64/kernel/cpufreq/Kconfig"
 
+source "drivers/cpuidle/Kconfig"
+
 endmenu
 
 menu "Bus options (PCI etc.)"
Index: linux-2.6.22-rc7/drivers/Makefile
===================================================================
--- linux-2.6.22-rc7.orig/drivers/Makefile	2007-07-03 20:27:53.000000000 +0200
+++ linux-2.6.22-rc7/drivers/Makefile	2007-07-03 20:27:54.000000000 +0200
@@ -70,6 +70,7 @@ obj-$(CONFIG_EDAC)		+= edac/
 obj-$(CONFIG_MCA)		+= mca/
 obj-$(CONFIG_EISA)		+= eisa/
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
+obj-$(CONFIG_CPU_IDLE)		+= cpuidle/
 obj-$(CONFIG_MMC)		+= mmc/
 obj-$(CONFIG_NEW_LEDS)		+= leds/
 obj-$(CONFIG_INFINIBAND)	+= infiniband/
Index: linux-2.6.22-rc7/drivers/cpuidle/Kconfig
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.22-rc7/drivers/cpuidle/Kconfig	2007-07-03 20:27:56.000000000 +0200
@@ -0,0 +1,39 @@
+menu "CPU idle PM support"
+
+config CPU_IDLE
[...7142 lines suppressed...]
+
+	if (err) {
+		force_hpet_address = 0;
+		iounmap(rcba_base);
+		printk(KERN_DEBUG "Failed to force enable HPET\n");
+	} else {
+		force_hpet_resume_type = ICH_FORCE_HPET_RESUME;
+		printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n",
+			       force_hpet_address);
+	}
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0,
+                         ich_force_enable_hpet);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1,
+                         ich_force_enable_hpet);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1,
+                         ich_force_enable_hpet);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31,
+                         ich_force_enable_hpet);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1,
+                         ich_force_enable_hpet);
+
+
+static struct pci_dev *cached_dev;
+
+static void old_ich_force_hpet_resume(void)
+{
+	u32 val, gen_cntl;
+
+	if (!force_hpet_address || !cached_dev)
+		return;
+
+	pci_read_config_dword(cached_dev, 0xD0, &gen_cntl);
+	gen_cntl &= (~(0x7 << 15));
+	gen_cntl |= (0x4 << 15);
+
+	pci_write_config_dword(cached_dev, 0xD0, gen_cntl);
+	pci_read_config_dword(cached_dev, 0xD0, &gen_cntl);
+	val = gen_cntl >> 15;
+	val &= 0x7;
+	if (val == 0x4)
+		printk(KERN_DEBUG "Force enabled HPET at resume\n");
+	else
+		BUG();
+}
+
+static void old_ich_force_enable_hpet(struct pci_dev *dev)
+{
+	u32 val, gen_cntl;
+
+	if (hpet_address || force_hpet_address)
+		return;
+
+	pci_read_config_dword(dev, 0xD0, &gen_cntl);
+	/*
+	 * Bit 17 is HPET enable bit.
+	 * Bit 16:15 control the HPET base address.
+	 */
+	val = gen_cntl >> 15;
+	val &= 0x7;
+	if (val & 0x4) {
+		val &= 0x3;
+		force_hpet_address = 0xFED00000 | (val << 12);
+		printk(KERN_DEBUG "HPET at base address 0x%lx\n",
+			       force_hpet_address);
+		return;
+	}
+
+	/*
+	 * HPET is disabled. Trying enabling at FED00000 and check
+	 * whether it sticks
+	 */
+	gen_cntl &= (~(0x7 << 15));
+	gen_cntl |= (0x4 << 15);
+	pci_write_config_dword(dev, 0xD0, gen_cntl);
+
+	pci_read_config_dword(dev, 0xD0, &gen_cntl);
+
+	val = gen_cntl >> 15;
+	val &= 0x7;
+	if (val & 0x4) {
+		/* HPET is enabled in HPTC. Just not reported by BIOS */
+		val &= 0x3;
+		force_hpet_address = 0xFED00000 | (val << 12);
+		printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n",
+			       force_hpet_address);
+		cached_dev = dev;
+		force_hpet_resume_type = OLD_ICH_FORCE_HPET_RESUME;
+		return;
+	}
+
+	printk(KERN_DEBUG "Failed to force enable HPET\n");
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0,
+                         old_ich_force_enable_hpet);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12,
+                         old_ich_force_enable_hpet);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0,
+                         old_ich_force_enable_hpet);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12,
+                         old_ich_force_enable_hpet);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0,
+                         old_ich_force_enable_hpet);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_12,
+                         old_ich_force_enable_hpet);
+
+
+static void vt8237_force_hpet_resume(void)
+{
+	u32 val;
+
+	if (!force_hpet_address || !cached_dev)
+		return;
+
+	val = 0xfed00000 | 0x80;
+	pci_write_config_dword(cached_dev, 0x68, val);
+
+	pci_read_config_dword(cached_dev, 0x68, &val);
+	if (val & 0x80)
+		printk(KERN_DEBUG "Force enabled HPET at resume\n");
+	else
+		BUG();
+}
+
+static void vt8237_force_enable_hpet(struct pci_dev *dev)
+{
+	u32 val;
+
+	if (hpet_address || force_hpet_address)
+		return;
+
+	pci_read_config_dword(dev, 0x68, &val);
+	/*
+	 * Bit 7 is HPET enable bit.
+	 * Bit 31:10 is HPET base address (contrary to what datasheet claims)
+	 */
+	if (val & 0x80) {
+		force_hpet_address = (val & ~0x3ff);
+		printk(KERN_DEBUG "HPET at base address 0x%lx\n",
+			       force_hpet_address);
+		return;
+	}
+
+	/*
+	 * HPET is disabled. Trying enabling at FED00000 and check
+	 * whether it sticks
+	 */
+	val = 0xfed00000 | 0x80;
+	pci_write_config_dword(dev, 0x68, val);
+
+	pci_read_config_dword(dev, 0x68, &val);
+	if (val & 0x80) {
+		force_hpet_address = (val & ~0x3ff);
+		printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n",
+			       force_hpet_address);
+		cached_dev = dev;
+		force_hpet_resume_type = VT8237_FORCE_HPET_RESUME;
+		return;
+	}
+
+	printk(KERN_DEBUG "Failed to force enable HPET\n");
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235,
+			 vt8237_force_enable_hpet);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237,
+			 vt8237_force_enable_hpet);
+
+void force_hpet_resume(void)
+{
+	switch (force_hpet_resume_type) {
+	    case ICH_FORCE_HPET_RESUME:
+		return ich_force_hpet_resume();
+
+	    case OLD_ICH_FORCE_HPET_RESUME:
+		return old_ich_force_hpet_resume();
+
+	    case VT8237_FORCE_HPET_RESUME:
+		return vt8237_force_hpet_resume();
+
+	    default:
+		break;
+	}
+}
+
+#endif
Index: linux-2.6.22-rc7/include/linux/pci_ids.h
===================================================================
--- linux-2.6.22-rc7.orig/include/linux/pci_ids.h	2007-07-03 20:27:46.000000000 +0200
+++ linux-2.6.22-rc7/include/linux/pci_ids.h	2007-07-03 20:28:01.000000000 +0200
@@ -2220,6 +2220,7 @@
 #define PCI_DEVICE_ID_INTEL_82801EB_5	0x24d5
 #define PCI_DEVICE_ID_INTEL_82801EB_6	0x24d6
 #define PCI_DEVICE_ID_INTEL_82801EB_11	0x24db
+#define PCI_DEVICE_ID_INTEL_82801EB_12	0x24dc
 #define PCI_DEVICE_ID_INTEL_82801EB_13	0x24dd
 #define PCI_DEVICE_ID_INTEL_ESB_1	0x25a1
 #define PCI_DEVICE_ID_INTEL_ESB_2	0x25a2


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.3266
retrieving revision 1.3267
diff -u -r1.3266 -r1.3267
--- kernel-2.6.spec	3 Jul 2007 20:45:34 -0000	1.3266
+++ kernel-2.6.spec	4 Jul 2007 18:03:59 -0000	1.3267
@@ -546,7 +546,8 @@
 Patch670: linux-2.6-ata-quirk.patch
 Patch680: git-wireless-dev.patch
 Patch710: linux-2.6-bcm43xx-pci-neuter.patch
-Patch780: linux-2.6-clockevents-fix-resume-logic.patch
+#Patch780: linux-2.6-clockevents-fix-resume-logic.patch
+Patch780: linux-2.6-highres-timers.patch
 Patch790: linux-2.6-acpi-dock-oops.patch
 Patch800: linux-2.6-wakeups-hdaps.patch
 Patch820: linux-2.6-compile-fixes.patch
@@ -967,6 +968,10 @@
 # Ingo's new scheduler.
 ApplyPatch linux-2.6-sched-cfs.patch
 
+# Assorted dyntick/clock/timer fixes.
+#ApplyPatch linux-2.6-clockevents-fix-resume-logic.patch
+ApplyPatch linux-2.6-highres-timers.patch
+
 # Roland's utrace ptrace replacement.
 ApplyPatch linux-2.6-utrace.patch -F2
 # setuid /proc/self/maps fix. (dependent on utrace)
@@ -989,11 +994,11 @@
 # in that case
 ApplyPatch linux-2.6-x86-vga-vidfail.patch
 # Suppress APIC errors on UP x86-64.
-ApplyPatch linux-2.6-x86_64-silence-up-apic-errors.patch
+#ApplyPatch linux-2.6-x86_64-silence-up-apic-errors.patch
 # Add vDSO for x86-64 with gettimeofday/clock_gettime/getcpu
 ApplyPatch linux-2.6-x86_64-vdso.patch
 # Blacklist Dell Optiplex 320 from using the HPET
-ApplyPatch linux-2.6-x86-dell-hpet.patch
+#ApplyPatch linux-2.6-x86-dell-hpet.patch
 # patch to fix suspend with kvm loaded and guests running
 ApplyPatch linux-2.6-kvm-suspend.patch
 
@@ -1126,9 +1131,6 @@
 # avoid bcm3xx vs bcm43xx-mac80211 PCI ID conflicts
 ApplyPatch linux-2.6-bcm43xx-pci-neuter.patch
 
-# Assorted dyntick/clock/timer fixes.
-ApplyPatch linux-2.6-clockevents-fix-resume-logic.patch
-
 # ACPI patches
 # Fix ACPI dock oops (#238054)
 ApplyPatch linux-2.6-acpi-dock-oops.patch
@@ -2056,6 +2058,9 @@
 %endif
 
 %changelog
+* Wed Jul 04 2007 Dave Jones <davej at redhat.com>
+- x86-64 tickless support.
+
 * Tue Jul 03 2007 Dave Jones <davej at redhat.com>
 - Remove a redundant if in the specfile.
 

linux-2.6-x86_64-vdso.patch:

Index: linux-2.6-x86_64-vdso.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-x86_64-vdso.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux-2.6-x86_64-vdso.patch	21 Jun 2007 23:09:24 -0000	1.1
+++ linux-2.6-x86_64-vdso.patch	4 Jul 2007 18:03:59 -0000	1.2
@@ -792,18 +792,16 @@
  	write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
  }
  
-Index: linux/arch/x86_64/kernel/time.c
-===================================================================
---- linux.orig/arch/x86_64/kernel/time.c
-+++ linux/arch/x86_64/kernel/time.c
-@@ -44,6 +44,7 @@
+--- linux-2.6.21.noarch/arch/x86_64/kernel/time.c~	2007-07-04 13:58:26.000000000 -0400
++++ linux-2.6.21.noarch/arch/x86_64/kernel/time.c	2007-07-04 13:58:49.000000000 -0400
+@@ -45,6 +45,7 @@
  #include <asm/hpet.h>
  #include <asm/mpspec.h>
  #include <asm/nmi.h>
 +#include <asm/vgtod.h>
+ #include <asm/delay.h>
  
- static char *timename = NULL;
- 
+ DEFINE_SPINLOCK(rtc_lock);
 Index: linux/include/asm-x86_64/vgtod.h
 ===================================================================
 --- /dev/null




More information about the scm-commits mailing list