From owner-freebsd-mips@FreeBSD.ORG Thu Aug 12 07:20:59 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 AA5AE106568C; Thu, 12 Aug 2010 07:20:59 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 19AC98FC08; Thu, 12 Aug 2010 07:20:58 +0000 (UTC) Received: by wyj26 with SMTP id 26so1342122wyj.13 for ; Thu, 12 Aug 2010 00:20:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=WaRxFJ9WhOyoTqn/en5NoKlwslIasbkrnMhUA+ogsvk=; b=vrdiy/eXtZLmQT27rstALwaZo9U/1M7L88FNeW/SH2CCxrQzpCEgI3XgoQZ6Epq03h hleRvIIaP98WYsnQ9TXrlQ9YURkX5c4E8WKpyu4f6US+cNWWrEq3++74I8DhjwxLcfqi pTT0Fi2MdnqYO4oT8UG1E0ViZaLxiAqz4zpsk= 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 :cc:content-type:content-transfer-encoding; b=ez3IYURtdR0Axtxye0Mu1d+YB5tnCYQMSX4j7EaV0fQB0A3Lw19bYP7HHFzcjD5Sm3 JzPhfTu4pmLjvboZ3YOr0FWgAxCfPC0dp8h4Li7zKOJcPXJV+HpBoMwYteWlJaQ9g7NL p3Vs3QmDx4Pv3uIXQKAGc6SoiiPLOPm1rvP/U= MIME-Version: 1.0 Received: by 10.227.129.12 with SMTP id m12mr17425195wbs.102.1281597657831; Thu, 12 Aug 2010 00:20:57 -0700 (PDT) Received: by 10.216.160.10 with HTTP; Thu, 12 Aug 2010 00:20:57 -0700 (PDT) In-Reply-To: <20100812.010121.123339447223515204.imp@bsdimp.com> References: <20100812.010121.123339447223515204.imp@bsdimp.com> Date: Thu, 12 Aug 2010 12:50:57 +0530 Message-ID: From: "Jayachandran C." To: "M. Warner Losh" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-mips@freebsd.org Subject: Re: SMP support for n64 patch. 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, 12 Aug 2010 07:20:59 -0000 On Thu, Aug 12, 2010 at 12:31 PM, M. Warner Losh wrote: > In message: > =A0 =A0 =A0 =A0 =A0 =A0"Jayachandran C." write= s: > : I've attached a patch that enables SMP support for N64 builds (I can > : get XLR come up multi-user with 32 cpus with this). > : > : I ended up making KX bit in status register set when you are in > : userspace, since the PCPU area is now mapped in XKSEG. =A0The PCPU area > : needs to be accessed in =A0I have reverted the earlier change that > : enabled KX on kernel entry from userspace since that is no longer > : needed. > : > : Please let me know your comments. > > If I understand correctly, and I'm sure the pedants will tell me > otherwise, the KX bit means that a legal reference to a kernel address > is made, it will be interpreted as a 64-bit address when KX is set, > and a 32-bit address when it is clear. > > It does not grant any additional access to the kernel memory that > isn't already granted by the TLB entries, correct? =A0It doesn't grant > access to the kernel memory, correct? My understanding is this, but I was not able to find any reference that says exactly that (so was not sure if some MIPS implementations have issues here). > But I'm a little confused. =A0I'm reading through section 4.5 of the > Privileged Resources Architecture document from mips > (MD00091-2B-MIPS74PRA-AFP-02.50.pdf) and table 4-1 suggests that > running with it in user mode won't change what can be accessed. =A0So > why would it need to be turned on at all in user mode? =A0Rather than > the xtlb routine being called for the refill for a kernel address, it > will fault instead. > > Or is this an optimization for the xtlb handler which needs to get to > pcpu data? Yes, otherwise I need to add code to the XTLB handler to enable KX (which will involve read and write to status register and the related hazards). Enabling KX everywhere, including userspace avoids this. JC.