rpms/kernel-xen-2.6/devel linux-2.6-remove-unnecessary-cast-in-prefetch.patch, NONE, 1.1 kernel.spec, 1.11, 1.12

Mark McLoughlin (markmc) fedora-extras-commits at redhat.com
Mon Feb 25 00:35:53 UTC 2008


Author: markmc

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

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-remove-unnecessary-cast-in-prefetch.patch 
Log Message:
* Mon Feb 25 2008 Mark McLoughlin <markmc at redhat.com>
- Fix boot on x86_64 - gcc 4.3.0 related (#43556)


linux-2.6-remove-unnecessary-cast-in-prefetch.patch:

--- NEW FILE linux-2.6-remove-unnecessary-cast-in-prefetch.patch ---
>From 4ecbca8554d0f643351ee07d3284138a5e85ba81 Mon Sep 17 00:00:00 2001
From: Serge Belyshev <belyshev at depni.sinp.msu.ru>
Date: Thu, 4 Oct 2007 23:10:04 +0200
Subject: [PATCH] Remove unnecessary cast in prefetch()

It is ok to call prefetch() function with NULL argument, as specifically
commented in include/linux/prefetch.h.  But in standard C, it is invalid
to dereference NULL pointer (see C99 standard 6.5.3.2 paragraph 4 and
note #84).

prefetch() has a memory reference for its argument.

Newer gcc versions (4.3 and above) will use that to conclude that "x"
argument is non-null and thus wreaking havok everywhere prefetch() was
inlined.

Fixed by removing cast and changing asm constraint.

[ It seems in theory gcc 4.2 could miscompile this too; although no
  cases known.  In 2.6.24 we should probably switch to
  __builtin_prefetch() instead, but this is a simpler fix for now.
				-- AK ]

Signed-off-by: Serge Belyshev <belyshev at depni.sinp.msu.ru>
Signed-off-by: Andi Kleen <ak at suse.de>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
 include/asm-x86_64/processor.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index 1952517..31f579b 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -371,7 +371,7 @@ static inline void sync_core(void)
 #define ARCH_HAS_PREFETCH
 static inline void prefetch(void *x) 
 { 
-	asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x));
+	asm volatile("prefetcht0 (%0)" :: "r" (x));
 } 
 
 #define ARCH_HAS_PREFETCHW 1
-- 
1.5.4.2



Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/kernel.spec,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- kernel.spec	15 Feb 2008 15:03:30 -0000	1.11
+++ kernel.spec	25 Feb 2008 00:35:10 -0000	1.12
@@ -618,6 +618,8 @@
 
 # compile fix with latest glibc
 Patch1: linux-2.6-sumversion-limits-dot-h.patch
+# gcc 4.3 mis-compile on x86_64
+Patch2: linux-2.6-remove-unnecessary-cast-in-prefetch.patch
 
 # Patches 10 through 99 are for things that are going upstream really soon.
 Patch11: nouveau-drm.patch
@@ -1293,6 +1295,7 @@
 
 # compile fix
 %patch1 -p1
+%patch2 -p1
 
 # Patches 10 through 100 are meant for core subsystem upgrades
 %patch11 -p1
@@ -2311,6 +2314,9 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL} -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.conf %{with_xen} xen
 
 %changelog
+* Mon Feb 25 2008 Mark McLoughlin <markmc at redhat.com>
+- Fix boot on x86_64 - gcc 4.3.0 related (#43556)
+
 * Fri Feb 15 2008 Mark McLoughlin <markmc at redhat.com>
 - Add e1000e driver (bug #360691)
 - Fix build with new glibc




More information about the fedora-extras-commits mailing list