[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#490542: base-installer: improve kernel selection for AMD64



Package: base-installer
Version: 1.91
Severity: important
Tags: patch

Dann complained about D-I selecting 486 by default for modern AMD64 
processors and suggested to just select 686 in all cases. This resulted 
in a discussion on IRC with some people saying "686 should be fine for 
k7" while earlier discussions had suggested that some older k7 systems 
might not work with 686.

With the k7 flavor having been dropped by the kernel team, this has become 
more urgent though.

The actual problem is that the selection code is rather coarse for AMD, 
and basically always has been if you also consider that we often used the 
fall-back kernel even when there still was a k7 flavor (most CD-based 
installs). It currently does not even distinguish between k7 and k8 
systems.

From a later discussion with some other people on IRC, it looks like SSE 
support is probably the deciding factor. According to section 2.2 in [1] 
and especially the note "Enabling SSE support" just above section 2.3, 
models 0-5 for family 6 AMD processors may not have SSE support and thus 
should continue to default to the 486 flavor.

As I have no idea if the above is correct or complete, some confirmation 
would be most welcome. If it is correct, the attached patch should 
improve kernel selection for AMD-based systems. If it is not correct, 
additional info and references would be most welcome.

[1]http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/20734.pdf
commit a581b82b1938029c0f79055658a6e4e852e377ee
Author: Frans Pop <fjp@debian.org>
Date:   Sat Jul 12 14:59:06 2008 +0200

    Improve kernel selection for AMD processors
    
    Most k7 processors should support 686 kernels and having 486 as default
    for k8 processors is really not acceptable, especially now the k7 flavor
    has been dropped by the kernel team.
    
    Select 686 for "family 15" processors (k8) and "family 6" processors (k7)
    model 6 or higher. Models 0-5 for k7 may not have SSE support and
    therefore default to 486.
    
    As k7 flavor linux-image packages no longer exist, drop support for them.

diff --git a/packages/base-installer/kernel/i386.sh b/packages/base-installer/kernel/i386.sh
index f7387d0..341bd0f 100644
--- a/packages/base-installer/kernel/i386.sh
+++ b/packages/base-installer/kernel/i386.sh
@@ -5,7 +5,15 @@ arch_get_kernel_flavour () {
 	case "$VENDOR" in
 	    " AuthenticAMD"*)
 		case "$FAMILY" in
-		    " 6"|" 15")	echo k7 ;;
+		    " 15")	echo 686 ;;	# k8
+		    " 6")			# k7
+			case "$MODEL" in
+			    " 0"|" 1"|" 2"|" 3"|" 4"|" 5")
+				# May not have SSE support
+				echo 486 ;;
+			    *)	echo 686 ;;
+			esac
+			;;
 		    *)		echo 486 ;;
 		esac
 		;;
@@ -40,10 +48,6 @@ arch_check_usable_kernel () {
 	if [ "$2" = 486 ]; then return 1; fi
 	if echo "$1" | grep -Eq -- "-686(-.*)?$"; then return 0; fi
 	if [ "$2" = 686 ]; then return 1; fi
-	if [ "$2" = k7 ]; then
-		if echo "$1" | grep -Eq -- "-k7(-.*)?$"; then return 0; fi
-		return 1
-	fi
 
 	# default to usable in case of strangeness
 	warning "Unknown kernel usability: $1 / $2"
@@ -55,9 +59,7 @@ arch_get_kernel () {
 
 	# See older versions of script for more flexible code structure
 	# that allows multiple levels of fallbacks
-	if [ "$1" = k7 ]; then
-		echo "$imgbase-$KERNEL_MAJOR-k7"
-	elif [ "$1" = 686 ]; then
+	if [ "$1" = 686 ]; then
 		echo "$imgbase-$KERNEL_MAJOR-686"
 	fi
 	echo "$imgbase-$KERNEL_MAJOR-486"
diff --git a/packages/base-installer/kernel/tests/i386/amd-k7-old.cpuinfo b/packages/base-installer/kernel/tests/i386/amd-k7-old.cpuinfo
new file mode 100644
index 0000000..49126d9
--- /dev/null
+++ b/packages/base-installer/kernel/tests/i386/amd-k7-old.cpuinfo
@@ -0,0 +1,19 @@
+processor	: 0
+vendor_id	: AuthenticAMD
+cpu family	: 6
+model		: 2
+model name	: Fictual AMD Athlon system (mostly copied from cittagazze)
+stepping	: 0
+cpu MHz		: 2246.427
+cache size	: 512 KB
+fdiv_bug	: no
+hlt_bug		: no
+f00f_bug	: no
+coma_bug	: no
+fpu		: yes
+fpu_exception	: yes
+cpuid level	: 1
+wp		: yes
+flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr syscall nx mmxext 3dnowext 3dnow up ts fid vid ttp
+bogomips	: 4506.97
+
diff --git a/packages/base-installer/kernel/tests/i386/amd-k7-old.test b/packages/base-installer/kernel/tests/i386/amd-k7-old.test
new file mode 100644
index 0000000..3d20889
--- /dev/null
+++ b/packages/base-installer/kernel/tests/i386/amd-k7-old.test
@@ -0,0 +1,13 @@
+cpuinfo amd-k7-old.cpuinfo
+majors 2.6
+flavour 486
+kernel-2.6 \
+  linux-image-2.6-486
+usable \
+  linux-image-2.6-486 \
+  linux-image-2.6.25-1-486
+unusable \
+  linux-image-2.6-686 \
+  linux-image-2.6-686-bigmem \
+  linux-image-2.6.25-1-686 \
+  linux-image-2.6.25-1-686-bigmem
diff --git a/packages/base-installer/kernel/tests/i386/cittagazze.test b/packages/base-installer/kernel/tests/i386/cittagazze.test
index 15522eb..63d71ec 100644
--- a/packages/base-installer/kernel/tests/i386/cittagazze.test
+++ b/packages/base-installer/kernel/tests/i386/cittagazze.test
@@ -1,15 +1,13 @@
 cpuinfo cittagazze.cpuinfo
 majors 2.6
-flavour k7
+flavour 686
 kernel-2.6 \
-  linux-image-2.6-k7 \
+  linux-image-2.6-686 \
   linux-image-2.6-486
 usable \
   linux-image-2.6-486 \
   linux-image-2.6-686 \
   linux-image-2.6-686-bigmem \
-  linux-image-2.6-k7 \
-  linux-image-2.6.18-1-486 \
-  linux-image-2.6.18-1-686 \
-  linux-image-2.6.18-1-686-bigmem \
-  linux-image-2.6.18-1-k7
+  linux-image-2.6.25-1-486 \
+  linux-image-2.6.25-1-686 \
+  linux-image-2.6.25-1-686-bigmem

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: