[PATCH v5 4/5] powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32
Xi Ruoyao
xry111 at xry111.site
Fri Sep 6 03:01:13 AEST 2024
On Thu, 2024-09-05 at 18:55 +0200, Christophe Leroy wrote:
> > Normal single thread
> > vdso: 25000000 times in 12.494133131 seconds
> > libc: 25000000 times in 69.594625188 seconds
> > syscall: 25000000 times in 67.349243972 seconds
> > Time namespace single thread
> > vdso: 25000000 times in 71.673057436 seconds
> > libc: 25000000 times in 71.712774121 seconds
> > syscall: 25000000 times in 66.902318080 seconds
> >
> > I'm seeing this on ppc, ppc64, and ppc64le.
>
> What is the command to use to test with time namespace ?
Assuming user namespace and time namespace are available:
$ unshare -r -T --boottime $((365*24*3600))
It'll start a new shell where you are pretended to be the root (i.e. the
root in the separated user namespace). Then:
# uptime
00:57:17 up 365 days, 57 min, 2 users, load average: 0.19, 0.30, 0.32
So in the separated time namespace the system is pretended to have been
booted for 1 year. Now:
# /path/to/linux.git/tools/testing/selftests/vDSO/vdso_test_getrandom bench_single
vdso: 25000000 times in 0.419125373 seconds
libc: 25000000 times in 5.985498234 seconds
syscall: 25000000 times in 5.993506773 seconds
This is on x86_64, indicating vDSO getrandom is fine for x86_64 in a
separated time namespace.
If user namespace isn't available (disabled building the kernel or
disabled by the security policy of some distros) use
$ sudo unshare -T --boottime $((365*24*3600))
to create the time namespace instead. But note that with this approach
you'll be operating as the real root user and be careful not to break
things.
--
Xi Ruoyao <xry111 at xry111.site>
School of Aerospace Science and Technology, Xidian University
More information about the Linuxppc-dev
mailing list