Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Feb 2014 10:52:12 -0700
From:      Warner Losh <wlosh@bsdimp.com>
To:        Stacey Son <sson@FreeBSD.org>
Cc:        "freebsd-mips@freebsd.org" <freebsd-mips@freebsd.org>
Subject:   Re: [RFC] Enable use of UserLocal Register (ULRI) if detected (patches)
Message-ID:  <092B0786-EA73-44D0-81FC-DFB56B14D4D7@bsdimp.com>
In-Reply-To: <D964DBB1-3727-4B8A-B4E3-50FD8A300818@FreeBSD.org>
References:  <D964DBB1-3727-4B8A-B4E3-50FD8A300818@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?092B0786-EA73-44D0-81FC-DFB56B14D4D7>