Skip to contentSkip to conversation

More last minute bug fixes for x86

PATCH In review Andi Kleen 2 participants 5 messages Sep 11, 2007 – Sep 13, 2007

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

cover More last minute bug fixes for x86

Linus,

Some more x86 bug fixes for .23rc6

- Fix the infamous "5 minutes" vdso problem on 32bit HPET with new glibc
- Error handling fix in cpuid4 handling (Jan Beulich)
- Fix leak of ../kernel out of build dir (Ben LaHaise & Sam Ravnborg)

Please merge.

-Andi

author
#1 lore raw

PATCH 1/3 x86_64: Add missing mask operation to vdso

vdso vgetns() didn't mask the time source offset calculation, which could lead to time problems with 32bit HPET. Add the masking.

Thanks to Chuck Ebbert for tracking down.

arch/x86_64/vdso/vclock_gettime.c +3 -2
Index: linux/arch/x86_64/vdso/vclock_gettime.c
===================================================================
@@ -34,10 +34,11 @@ static long vdso_fallback_gettime(long c
 
 static inline long vgetns(void)
 {
+	long v;
 	cycles_t (*vread)(void);
 	vread = gtod->clock.vread;
-	return ((vread() - gtod->clock.cycle_last) * gtod->clock.mult) >>
-		gtod->clock.shift;
+	v = (vread() - gtod->clock.cycle_last) & gtod->clock.mask;
+	return (v * gtod->clock.mult) >> gtod->clock.shift;
 }
 
 static noinline int do_realtime(struct timespec *ts)
author
#2 lore raw

PATCH 2/3 x86_64: Prevent doing anything from cache_remove_dev() when info setup failed.

In reply to Andi Kleen

AK: Removed the unlikelies because gcc heuristics default to unlikely for test
AK: == NULL and for negative returns.

Cc Venkatesh Pallipadi <[email protected]>
Cc Ashok Raj <[email protected]>
Cc Akinobu Mita <[email protected]>
arch/i386/kernel/cpu/intel_cacheinfo.c +3 -1
Index: linux/arch/i386/kernel/cpu/intel_cacheinfo.c
===================================================================
@@ -515,7 +515,7 @@ static int __cpuinit detect_cache_attrib
 
 	cpuid4_info[cpu] = kzalloc(
 	    sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL);
-	if (unlikely(cpuid4_info[cpu] == NULL))
+	if (cpuid4_info[cpu] == NULL)
 		return -ENOMEM;
 
 	oldmask = current->cpus_allowed;
@@ -748,6 +748,8 @@ static void __cpuinit cache_remove_dev(s
 	unsigned int cpu = sys_dev->id;
 	unsigned long i;
 
+	if (cpuid4_info[cpu] == NULL)
+		return;
 	for (i = 0; i < num_cache_leaves; i++) {
 		cache_remove_shared_cpu_map(cpu, i);
 		kobject_unregister(&(INDEX_KOBJECT_PTR(cpu,i)->kobj));
author
#4 lore raw

PATCH 3/3 i386: Fix leak of ../kernel from top level

In reply to Andi Kleen

Fix a compile error when the directory above the kernel source contains a file named "kernel". Originally from Ben La Haise, modified based on feedback from Sam Ravnborg

arch/i386/mach-generic/Makefile +1 -1
Index: linux/arch/i386/mach-generic/Makefile
===================================================================
@@ -2,6 +2,6 @@
 # Makefile for the generic architecture
 #
 
-EXTRA_CFLAGS	+= -I../kernel
+EXTRA_CFLAGS	:= -Iarch/i386/kernel
 
 obj-y				:= probe.o summit.o bigsmp.o es7000.o default.o ../mach-es7000/
arch/i386/mach-voyager/Makefile +1 -1
Index: linux/arch/i386/mach-voyager/Makefile
===================================================================
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-EXTRA_CFLAGS	+= -I../kernel
+EXTRA_CFLAGS	:= -Iarch/i386/kernel
 obj-y			:= setup.o voyager_basic.o voyager_thread.o
 
 obj-$(CONFIG_SMP)	+= voyager_smp.o voyager_cat.o
#3 lore raw

Re: [PATCH for 2.6.23] [2/3] x86_64: Prevent doing anything from cache_remove_dev() when info setup failed.

In reply to Andi Kleen
Quoted 2 lines · Andi Kleen

AK: Removed the unlikelies because gcc heuristics default to unlikely for tes
AK: == NULL and for negative returns.

This patch was actually from Jan Beulich, but somehow the attribution got dropped. Sorry for that.

-Andi