Page MenuHomeFreeBSD

Provide the CloudABI vDSO to its executables.
ClosedPublic

Authored by ed on Aug 8 2016, 1:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 10, 2:32 PM
Unknown Object (File)
Oct 31 2024, 8:17 AM
Unknown Object (File)
Oct 31 2024, 8:16 AM
Unknown Object (File)
Oct 31 2024, 8:16 AM
Unknown Object (File)
Oct 31 2024, 8:16 AM
Unknown Object (File)
Oct 31 2024, 7:58 AM
Unknown Object (File)
Oct 2 2024, 11:59 PM
Unknown Object (File)
Oct 2 2024, 7:31 PM
Subscribers

Details

Summary

CloudABI executables already provide support for passing in vDSOs. This
functionality is used by the emulator for OS X to inject system call
handlers. On FreeBSD, we could use it to optimize calls to
gettimeofday(), etc.

Though I don't have any plans to optimize any system calls right now,
let's go ahead and already pass in a vDSO. This will allow us to
simplify the executables, as the traditional "syscall" shims can be
removed.

Test Plan

Seems to work both on x86-64 and aarch64, both compiled into the kernel
and built as a kernel module.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 4738
Build 4792: arc lint + arc unit

Event Timeline

ed retitled this revision from to Provide the CloudABI vDSO to its executables..
ed updated this object.
ed edited the test plan for this revision. (Show Details)
ed added a reviewer: kib.

Hi Kostik,

The reason why I'm putting you down as a reviewer: could you please take a look at the code in cloudabi_vdso.c to see whether I'm using the VM API correctly?

Thanks,
Ed

sys/compat/cloudabi/cloudabi_vdso.c
57

Why do you check this, instead of assigning sv_shared_page_len to the needed value ?

71

vdso_length is size_t, i.e. unsigned. I suspect that this calculation does not do what you want, on the last partial page of the vdso, the first argument to MIN() is very large unsigned value..

Simply update the vDSO length dynamically.

There is no need to have a fixed space hardcoded in the sysentvec.
cloudabi_vdso_init() can simply compute those values correctly for us.

Thanks for the feedback. What do you think of this version?

sys/compat/cloudabi/cloudabi_vdso.c
57

That's a good question. I have to confess I inherited this construct from how we do the vDSO for Linux. I've just fixed it up to adjust these fields dynamically. Thanks!

71

i * PAGE_SIZE is guaranteed to not exceed vdso_length in this case, so it should never be negative. i is strictly smaller than the number of pages needed to hold the vDSO.

This revision was automatically updated to reflect the committed changes.