From owner-cvs-src@FreeBSD.ORG Mon Dec 1 17:50:53 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1E60516A4CE; Mon, 1 Dec 2003 17:50:53 -0800 (PST) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id E344D43F85; Mon, 1 Dec 2003 17:50:44 -0800 (PST) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by canning.wemm.org (Postfix) with ESMTP id CA74E2A7EA; Mon, 1 Dec 2003 17:50:44 -0800 (PST) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.6.3 04/04/2003 with nmh-1.0.4 To: John Baldwin In-Reply-To: Date: Mon, 01 Dec 2003 17:50:44 -0800 From: Peter Wemm Message-Id: <20031202015044.CA74E2A7EA@canning.wemm.org> cc: Jeff Roberson cc: Jeff Roberson cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org cc: cvs-src@FreeBSD.org Subject: Re: cvs commit: src/sys/alpha/alpha mp_machdep.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2003 01:50:53 -0000 John Baldwin wrote: > > On 01-Dec-2003 Jeff Roberson wrote: > > > > On Mon, 1 Dec 2003, John Baldwin wrote: > > > >> > >> On 01-Dec-2003 Jeff Roberson wrote: > >> > On Mon, 1 Dec 2003, John Baldwin wrote: > >> > > >> >> > >> >> On 30-Nov-2003 Jeff Roberson wrote: > >> >> > jeff 2003/11/30 14:08:24 PST > >> >> > > >> >> > FreeBSD src repository > >> >> > > >> >> > Modified files: > >> >> > sys/alpha/alpha mp_machdep.c > >> >> > Log: > >> >> > - Set mp_maxid in a way that is consistent with every other arch. It is > >> >> > one more than the last valid 'cpuid'. > >> >> > > >> >> > Approved by: re (rwatson) > >> >> > >> >> Eh? No it's not. All that needs to be true is that for every processo r, > >> >> PCPU_GET(cpuid) <= mp_maxid. > >> >> > >> >> It can be equal to the highest ID and should be so for most cases. > >> > > >> > From x86's mp_machdep: > >> > mp_maxid = MAXCPU; > >> > >> That's a bug. > >> > >> > ia64 > >> > mp_maxid = min(mp_ncpus, MAXCPU) - 1; > >> > >> This is correct. Note - 1. > >> > >> > sparc64 > >> > cpus = 0; > >> > root = OF_peer(0); > >> > for (child = OF_child(root); child != 0; child = OF_peer(child)) { > >> > if (OF_getprop(child, "device_type", buf, sizeof(buf)) > 0 > >> > && > >> > strcmp(buf, "cpu") == 0) > >> > cpus++; > >> > } > >> > mp_maxid = cpus; > >> > >> This should be cpus - 1. > >> > >> > And I just changed amd64 and alpha to mean maxid + 1. Damn. it looks li ke > >> > just sparc64 and x86 were wrong. Maybe I should change those to mean th e > >> > right thing, and backout the changes to uma. yack. > >> > >> Heh. I am already waiting for approval from re@ to fix x86. That was > >> definitely my bug. > > > > Well, since ULE and UMA are the only two subsystems which make use of > > mp_maxid, can I request that it be one over the maximum id so that I can > > use it in loops like: > > for (i = 0; i < mp_maxid; i++) { > > > > Otherwise I guess I can do <=. If you fix x86, can you fix alpha and > > amd64, and uma and ule? :-) > > I'll fix all of them and work up a patch tomorrow, sure. :) Well, whatever happens, please do something promptly because the amd64 GENERIC kernel is broken by all this and panics on a UP machine. I think the problem is currently bandaid-able by doing this: +++ mp_machdep.c 2 Dec 2003 01:41:02 -0000 @@ -201,3 +201,3 @@ else if (mp_ncpus == 1) - mp_maxid = 0; + mp_maxid = 1; else @@ -234,3 +234,3 @@ */ - mp_maxid = 0; + mp_maxid = 1; return (0); In other words, the code sets it to 1 and then changes it back to 0 again. Cheers, -Peter -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5