This set of patches implements 
        time virtualization by creating a time namespace
        an interface to it through unshare
        a ptrace extension to allow UML to take advantage of this
        UML support

The guts of the namespace is just an offset from the system time.  Within
the container, gettimeofday adds this offset to the system time.  settimeofday
changes the offset without touching the system time.  As such, within a 
namespace, settimeofday is unprivileged.

The interface to it is through unshare(CLONE_TIME).  This creates the new
namespace, initialized with a zero offset from the system time.

The advantage of this for UML is that it can create a time namespace for itself
and subsequently let its process' gettimeofday run on the host, without
being intercepted and run inside UML.  As such, it should basically run at
native speed.

In order to allow this, we need selective system call interception.  The
third patch implements PTRACE_SYSCALL_MASK, which specifies, through a 
bitmask, which system calls are intercepted and which aren't.

Finally, the UML support is straightforward.  It calls unshare(CLONE_TIME)
to create the new namespace, sets gettimeofday to run without being 
intercepted, and makes settimeofday call the host's settimeofday instead
of maintaining the time offset itself.

As expected, a gettimeofday loop runs basically at native speed.  The two
quick tests I did had it running inside UML at 98.8 and 99.2 % of native.

BUG - as I was writing this, I realized that refcounting of the time_ns
structures is wrong - they need to be incremented at process creation and
decremented at process exit.

                                Jeff



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to