From owner-freebsd-arch@FreeBSD.ORG Sat Jul 9 07:02:43 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE7AF1065670; Sat, 9 Jul 2011 07:02:43 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx08.syd.optusnet.com.au (fallbackmx08.syd.optusnet.com.au [211.29.132.10]) by mx1.freebsd.org (Postfix) with ESMTP id E1C0F8FC13; Sat, 9 Jul 2011 07:02:42 +0000 (UTC) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by fallbackmx08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p694qGIZ009713; Sat, 9 Jul 2011 14:52:16 +1000 Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p694qBaM014651 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 9 Jul 2011 14:52:13 +1000 Date: Sat, 9 Jul 2011 14:52:11 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Peter Wemm In-Reply-To: Message-ID: <20110709143840.X873@besplex.bde.org> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Attilio Rao , Sergey Kandaurov , freebsd-arch@freebsd.org Subject: Re: [PATCH] Add MAXCPU as a kernel config option and quality discussion on this X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jul 2011 07:02:43 -0000 On Fri, 8 Jul 2011, Peter Wemm wrote: > On Fri, Jul 8, 2011 at 8:37 AM, Attilio Rao wrote: >> I've made this patch for making MAXCPU a kernel config option: >> http://www.freebsd.org/~attilio/maxcpu_kernel_opt.diff > > The problem with this is now you have to update all the kernel module > build glue to create opt_maxcpu.h, including 3rd party modules. > > What about userland? > > We have constructs like this: > > amd64/include/reg.h: > #if defined(_KERNEL) && !defined(_STANDALONE) > #include "opt_compat.h" > #endif > > Or even: > #if defined(SMP) || defined(KLD_MODULE) > #define MAXCPU 32 > #else > #define MAXCPU 1 > #endif /* SMP || KLD_MODULE */ > > Putting opt_*.h references in include files is an invasive change and > something we've gone to a great deal of effort to avoid. Putting them in opt_global.h is less invasive, but works little better since (actually modular) modules can't depend on options but opt_global.h gives options. This is handled well mainly for the SMP option since it is so important, and I'm not sure if it still works for that either. E.g., on amd64 and i386, modules use pessimized non-inline versions of all atomic ops. Other arches don't bother with the non-inlining. They also don't use SMP ifdefs in atomic.h, so this doesn't seem to break modules but just loses any possible optimizations for the non-SMP case. Bruce