From owner-freebsd-current@FreeBSD.ORG Mon Jan 2 20:23:15 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4655E16A41F for ; Mon, 2 Jan 2006 20:23:15 +0000 (GMT) (envelope-from antoine@peanut.dreadbsd.org) Received: from barton.dreadbsd.org (peanut.dreadbsd.org [82.67.196.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4721543D49 for ; Mon, 2 Jan 2006 20:23:13 +0000 (GMT) (envelope-from antoine@peanut.dreadbsd.org) Received: from barton.dreadbsd.org (localhost [127.0.0.1]) by barton.dreadbsd.org (8.13.4/8.13.4) with ESMTP id k02KNAQg000744; Mon, 2 Jan 2006 21:23:10 +0100 (CET) (envelope-from antoine@peanut.dreadbsd.org) Received: (from antoine@localhost) by barton.dreadbsd.org (8.13.4/8.13.1/Submit) id k02KN94Q000743; Mon, 2 Jan 2006 21:23:09 +0100 (CET) (envelope-from antoine) Date: Mon, 2 Jan 2006 21:23:09 +0100 From: Antoine Brodin To: Alexander Leidinger Message-Id: <20060102212309.6ebcf836.antoine.brodin@laposte.net> In-Reply-To: <20060102200347.2bumr7okkkgossww@netchild.homeip.net> References: <20060102101653.GA65178@stud.fit.vutbr.cz> <20060102200347.2bumr7okkkgossww@netchild.homeip.net> X-Mailer: Sylpheed version 2.0.4 (GTK+ 2.8.9; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: xdivac02@stud.fit.vutbr.cz, current@freebsd.org Subject: Re: AMD cache values for page colouring X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2006 20:23:15 -0000 Alexander Leidinger wrote: > Divacky Roman wrote: > [no cachesize detection] > > my CPU is: > > CPU: AMD Athlon(tm) XP 2500+ (1834.88-MHz 686-class CPU) > > Origin = "AuthenticAMD" Id = 0x6a0 Stepping = 0 > > Features=0x383fbff > > AMD Features=0xc0400800 > > So the AMD64 code works (on AMD processors) but the IA32 (on AMD) fails. > Either I did something completely wrong, or it's a small typo I do overlook > (tomatoes on the eyes...). Can someone with a little bit of AMD feature > detection knowledge have a look at: Hi Alexander, The detection doesn't work because the cpu_exthigh variable isn't initialized. And if you and *ways with 0x0f, it will never be 255. Cheers, Antoine PS: with the attached path I've got > sysctl vm.stats.pagequeue vm.stats.pagequeue.page_colors: 16 vm.stats.pagequeue.cachesize: 512 vm.stats.pagequeue.cachenways: 8 vm.stats.pagequeue.prime1: 5 vm.stats.pagequeue.prime2: 3 Index: i386/i386/identcpu.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/identcpu.c,v retrieving revision 1.152 diff -u -p -r1.152 identcpu.c --- i386/i386/identcpu.c 31 Dec 2005 14:39:17 -0000 1.152 +++ i386/i386/identcpu.c 2 Jan 2006 20:09:48 -0000 @@ -1425,14 +1425,15 @@ print_INTEL_TLB(u_int data) static void setPQL2_AMD(int *const size, int *const ways) { - if (cpu_exthigh >= 0x80000006) { - u_int regs[4]; + u_int regs[4]; + do_cpuid(0x80000000, regs); + if (regs[0] >= 0x80000000) + cpu_exthigh = regs[0]; + if (cpu_exthigh >= 0x80000006) { do_cpuid(0x80000006, regs); *size = regs[2] >> 16; *ways = (regs[2] >> 12) & 0x0f; - if(*ways == 255) /* fully associative */ - *ways = 1; } }