From owner-freebsd-current Mon Mar 3 11:49:14 2003 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 F305737B401 for ; Mon, 3 Mar 2003 11:49:11 -0800 (PST) Received: from mail.speakeasy.net (mail12.speakeasy.net [216.254.0.212]) by mx1.FreeBSD.org (Postfix) with ESMTP id D910443FBD for ; Mon, 3 Mar 2003 11:49:10 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 24104 invoked from network); 3 Mar 2003 19:49:15 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail12.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 3 Mar 2003 19:49:15 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.6/8.12.6) with ESMTP id h23JkmhT042183; Mon, 3 Mar 2003 14:46:49 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20030301200615.A63428@FreeBSD.org> Date: Mon, 03 Mar 2003 14:49:21 -0500 (EST) From: John Baldwin To: Juli Mallett Subject: Re: Possible patch for limiting APs at startup Cc: current@FreeBSD.org, Hiten Pandya Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 02-Mar-2003 Juli Mallett wrote: > * De: Hiten Pandya [ Data: 2003-03-01 ] > [ Subjecte: Possible patch for limiting APs at startup ] >> Hello. >> >> Just as the topic says, do you think this patch is good enough, or gets >> even close to it? I have tested the patch, and it seems to do it's job >> in the right way. Some might call it hackery, but it's better than >> nothing I would suppose. > > I think your use of "cpus" to refer to APs only is silly, and also that > overriding mp_naps instead of using a real cpus value and using it as > a bounds check akin to MAXCPU, is a bit of the wrong direction. As you > know, the following is my patch, and it does not work, but I think, > personally, the behaviour is saner, in theory at least :) You should set mp_maxcpus prior to the mp_naps test so it isn't left invalid in the common case. Also, this patch doesn't limit HT cpu's at all. I could have a 4 cpu system with HTT and maxcpus=2, and I will end up with 4 CPU's due to 2 logical CPU's per processor. Perhaps this is intentional? > %%% > Index: mp_machdep.c > =================================================================== > RCS file: /home/ncvs/src/sys/i386/i386/mp_machdep.c,v > retrieving revision 1.203 > diff -d -c -r1.203 mp_machdep.c > *** mp_machdep.c 24 Feb 2003 14:36:03 -0000 1.203 > --- mp_machdep.c 2 Mar 2003 00:22:58 -0000 > *************** > *** 249,254 **** > --- 249,259 ---- > /** XXX FIXME: what system files declare these??? */ > extern struct region_descriptor r_gdt, r_idt; > > + int mp_maxcpus = 0; /* max CPUs; not in BSS so it can be hacked. */ > + TUNABLE_INT("machdep.smp_max_cpus", &mp_maxcpus); > + SYSCTL_INT(_machdep, OID_AUTO, smp_max_cpus, CTLFLAG_RD, > + &mp_maxcpus, 1, "Maximum number of CPUs to use."); > + > int bsp_apic_ready = 0; /* flags useability of BSP apic */ > int mp_naps; /* # of Applications processors */ > int mp_nbusses; /* # of busses */ > *************** > *** 864,874 **** > } > } > > ! /* qualify the numbers */ > ! if (mp_naps > MAXCPU) { > printf("Warning: only using %d of %d available CPUs!\n", > ! MAXCPU, mp_naps); > ! mp_naps = MAXCPU; > } > > /* See if we need to fixup HT logical CPUs. */ > --- 869,881 ---- > } > } > > ! /* use the smallest number of requested CPUs or CPUs we support. */ > ! if ((mp_maxcpus > 0 && mp_naps > mp_maxcpus) || mp_naps > MAXCPU) { > ! if (mp_maxcpus <= 0) > ! mp_maxcpus = MAXCPU; > printf("Warning: only using %d of %d available CPUs!\n", > ! mp_maxcpus, mp_naps); > ! mp_naps = mp_maxcpus; > } > > /* See if we need to fixup HT logical CPUs. */ > %%% > > Thanx, > juli. > -- > Juli Mallett - AIM: BSDFlata -- IRC: juli on EFnet > OpenDarwin, Mono, FreeBSD Developer - ircd-hybrid Developer, EFnet addict > FreeBSD on MIPS-Anything on FreeBSD - /* XXX Nothing to see here, now. */ > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message