From owner-freebsd-mips@FreeBSD.ORG Wed Feb 19 17:52:22 2014 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2AA239A1 for ; Wed, 19 Feb 2014 17:52:22 +0000 (UTC) Received: from mail-oa0-f45.google.com (mail-oa0-f45.google.com [209.85.219.45]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DFCF111CD for ; Wed, 19 Feb 2014 17:52:21 +0000 (UTC) Received: by mail-oa0-f45.google.com with SMTP id i11so834727oag.32 for ; Wed, 19 Feb 2014 09:52:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=HwAB2AB1r55k+vA083rVbuxcxusCnmfCTKeevWTi3Tw=; b=IX9Gw7VOKom1lbKjVvZB7kXxf+MQ3YPTl+ATQi6NGgjCcexQ9SqTt4g9PSQbPj8Nyg GRR2dZpyVS0dDwtUK2URoPkPLCe7C7GbrdCgV3aqRizSelOEYbxP/Ddn0OP/ylF2GGgE iL4PQidqgllqvTvDcY7AtIF4DecTidido/3SrGY1v+LIwVD1Tc+1+4JNGo8p9jPJAymp WHO/fTLut7UPU8CfKi6PjycVjJOM5oGAeaiu6AFscQRPyLFOVkuB3ss1u2DFENO6FK27 erah0wP+B9uVnFnodUtj9DrYdXfddaZmVz7LcW8xU2AmTVYFoV+RHKzPRU1MqRFANDNJ P6ng== X-Gm-Message-State: ALoCoQmJLWoJL3KiffC5PyF3579B6vP74cfLtX4m2nMZxSaPpzfHRSABeA8b0J18KSR0ZbUjjbDJ X-Received: by 10.182.146.104 with SMTP id tb8mr3120560obb.54.1392832334719; Wed, 19 Feb 2014 09:52:14 -0800 (PST) Received: from macmini.bsdimp.com (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPSA id lg8sm2625813obc.14.2014.02.19.09.52.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Feb 2014 09:52:14 -0800 (PST) Subject: Re: [RFC] Enable use of UserLocal Register (ULRI) if detected (patches) Mime-Version: 1.0 (Apple Message framework v1085) From: Warner Losh In-Reply-To: Date: Wed, 19 Feb 2014 10:52:12 -0700 Message-Id: <092B0786-EA73-44D0-81FC-DFB56B14D4D7@bsdimp.com> References: To: Stacey Son X-Mailer: Apple Mail (2.1085) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Cc: "freebsd-mips@freebsd.org" X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Feb 2014 17:52:22 -0000 On Feb 18, 2014, at 11:03 AM, Stacey Son wrote: > Hi all: >=20 > Below are some links to patches that enables the use of the UserLocal = Register Implementation (ULRI) for the Thread Local Storage (TLS) = pointer. =20 I'm loving this. Work was done on this a while ago, but never completed. > The first code change is for the user level code to use the 'rdhwr = $29' instruction to retrieve the TLS pointer instead of using the = sysarch(MIPS_GET_TLS,...) system call. For hardware that supports this = instruction this should be much faster since it doesn't require the = overhead of a system call. For hardware that doesn't support this = instruction the 'rdhwr $29' instruction is emulated by the trap() = handler in sys/mips/mips/trap.c and the overhead should be about the = same. (Actually, some quick micro benchmarks indicate that emulating the = 'rdhwr' instruction is slightly faster than the sysarch() system call.) = For the patch, see:=20 >=20 > http://people.freebsd.org/~sson/mips/ulri/ulri_user.diff These changes look great! > The next code change probes for the UserLocal Register Implementation = (ULRI) and, if found, will enable it (or actually disable it if not = found) in the kernel code. sysarch(MIPS_SET_TLS,...) calls also update = the UserLocal register as well. For the patch, see: >=20 > http://people.freebsd.org/~sson/mips/ulri/ulri_kernel.diff +/* Register numbers */ +#define _V0 2 +#define _A1 5 +#define _T0 12 +#define _RA 31 We already have defines for these registers elsewhere. Any reason why = you chose not to use them? Also, is there any ABI difference to be = worried about? The rest looks generally good, apart from references to git versions = that might be difficult to find in the future. Consider moving details = inline instead. > The final patch is for qemu system-mode that adds support for the = ULRI: >=20 > http://people.freebsd.org/~sson/mips/ulri/ulri_qemu.diff Can't say about these... > For more information about the ULRI see "MIPS Architecture for = Programmers Volume III" section 9.9 UserLocal Register (CP0 Register 4, = Select 2). Thanks for doing this! Warner > Best Regards, >=20 > -stacey. > _______________________________________________ > freebsd-mips@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-mips > To unsubscribe, send any mail to = "freebsd-mips-unsubscribe@freebsd.org"