From owner-freebsd-mips@FreeBSD.ORG Thu Jan 28 22:28:24 2010 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A04061065784 for ; Thu, 28 Jan 2010 22:28:24 +0000 (UTC) (envelope-from neelnatu@gmail.com) Received: from mail-px0-f183.google.com (mail-px0-f183.google.com [209.85.216.183]) by mx1.freebsd.org (Postfix) with ESMTP id 787F88FC21 for ; Thu, 28 Jan 2010 22:28:24 +0000 (UTC) Received: by pxi13 with SMTP id 13so878858pxi.3 for ; Thu, 28 Jan 2010 14:28:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=1u4OtgowkhFbl+8+S1yU5civuBQSA/dkrOvp7jAEt3E=; b=SI8uoSb5DaicdPf/WVcc3VJOuSqNnoGrsz7GTYe50J2XVNsdXX4gFR2EYdqJPK7RHd yJycW8i/Zo8qI30F3UvEbZDoVGwK90vWjOskfbkldC883jr72HWIMyUBw1Dl5xlanE2a HdxAHMYf4tEd6GTlU9q+DBlSjmC41M5fvUlSY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=tGTmHHFrMdiwZ1u5tnChchphlzRUbavyacMeU89D7IRRUASjqYF7j2HN9JsGBbHcZB 1kdQ246mRMTp4JPU0iU1IOm/1LK+MLKnh+5+YuESAiBwJ+hR2vgxz4vQNfmP6MUVQSvD mv0r6M+9IMcirAcZDX8TChyjoWUdZPAbJALpI= MIME-Version: 1.0 Received: by 10.142.3.28 with SMTP id 28mr1641614wfc.106.1264716100606; Thu, 28 Jan 2010 14:01:40 -0800 (PST) In-Reply-To: <20100128.132114.1004138037722505681.imp@bsdimp.com> References: <20100128.132114.1004138037722505681.imp@bsdimp.com> Date: Thu, 28 Jan 2010 14:01:40 -0800 Message-ID: From: Neel Natu To: freebsd-mips@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Code review: groundwork for SMP X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jan 2010 22:28:24 -0000 Forwarding to freebsd-mips as suggested by Warner. This is a patch to provide access to pcpu structures for SMP kernels. The basic idea is to use a the same virtual address as a window onto distinct physical memory locations - one per processor. The physical address that you access through this mapping depends on which cpu you are currently executing on. We can now use the virtual address on any processor to access its per-cpu area. The details are: 1. The virtual address for 'struct pcpu *pcpup' is obtained by stealing 2 pages worth of KVA in pmap_bootstrap(). 2. The mapping from the constant virtual address to a distinct physical page is done in cpu_pcpu_init() through a wired TLB entry. 3. A side-effect of this is that we reserve 2 pages worth of memory for the pcpu but in reality it needs much less than that. The unused memory is now used as the boot stack for the BSP and APs. I also cleaned up locore.S to remove the SMP-specific bits from it. I plan to use a separate mpboot.S for the AP bootstrap. Please review. The patch is available here: http://people.freebsd.org/~neel/smp_groundwork.diff best Neel