linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Vagin <avagin@gmail.com>
To: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Cc: Andrei Vagin <avagin@openvz.org>,
	Dmitry Safonov <dima@arista.com>,
	linux-man <linux-man@vger.kernel.org>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Linux API <linux-api@vger.kernel.org>,
	Containers <containers@lists.linux-foundation.org>,
	Dmitry Safonov <0x7f454c46@gmail.com>,
	lkml <linux-kernel@vger.kernel.org>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Adrian Reber <adrian@lisas.de>
Subject: Re: RFC: time_namespaces(7) manual page
Date: Mon, 6 Apr 2020 20:23:18 -0700	[thread overview]
Message-ID: <20200407032318.GA494464@gmail.com> (raw)
In-Reply-To: <7221df0a-435b-f8bc-ff91-c188af535e73@gmail.com>

Hi Michael,

The man page looks good to me. A few comments are inline.

On Sat, Apr 04, 2020 at 01:08:50PM +0200, Michael Kerrisk (man-pages) wrote:
> Hello Dmitry, Andrei, et al.
> 
> I have written a manual page to document time namespaces.
> Could you please take a look and let me know of any
> corrections, improvements, etc.
> 
> The rendered page is shown below. Th epage source is at the foot of
> this mail.
> 
> Thanks,
> 
> Michael
> 
> 
> NAME
>        time_namespaces - overview of Linux time namespaces
> 
> DESCRIPTION
>        Time namespaces virtualize the values of two system clocks:
> 
>        · CLOCK_MONOTONIC   (and   likewise   CLOCK_MONOTONIC_COARSE   and
>          CLOCK_MONOTONIC_RAW), a nonsettable clock that represents  mono‐
>          tonic  time   since—as  described   by  POSIX—"some  unspecified
>          point in the past".
> 
>        · CLOCK_BOOTTIME (and likewise CLOCK_BOOTTIME_ALARM), a clock that
>          is  identical  to  CLOCK_MONOTONIC, except that it also includes
>          any time that the system is suspended.
> 
>        Thus, the processes in a time namespace share per-namespace values
>        for  these clocks.  This affects various APIs that measure against
>        these   clocks,   including:   clock_nanosleep(2),   nanosleep(2),
>        clock_gettime(2), and /proc/uptime.

timer_settime, timerfd_settime

> 
>        Currently,  the  only way to create a time namespace is by calling
>        unshare(2) with the CLONE_NEWTIME flag.  This call creates  a  new
>        time  namespace  but does not place the calling process in the new
>        namespace.  Instead, the calling  process's  subsequently  created
>        children  are placed in the new namespace.  This allows clock off‐
>        sets (see below) for the new namespace to be set before the  first
>        process      is      placed     in     the     namespace.      The
>        /proc/[pid]/ns/time_for_children  symbolic  link  shows  the  time
>        namespace in which the children of a process will be created.

We can mention that the current process can enter the namespace if it
call setns on /proc/self/ns/time_for_children.

> 
>    /proc/PID/timens_offsets
>        Associated  with  each  time namespace are offsets, expressed with
>        respect to the initial time namespace, that define the  values  of
>        the  monotonic  and  boot clocks in that namespace.  These offsets
>        are exposed via the file  /proc/PID/timens_offsets.   Within  this
>        file,  the  offsets  are  expressed  as  lines consisting of three
>        space-delimited fields:
> 
>            <clock-id> <offset-secs> <offset-nanosecs>
> 
>        The clock-id identifies the clock whose offsets are  being  shown.
>        This field is either 1, for CLOCK_MONOTONIC, or 7, for CLOCK_BOOT‐
>        TIME.  The remaining  fields  express  the  offset  (seconds  plus
>        nanoseconds)  for the clock in this time namespace.  These offsets
>        are expressed relative to the clock values  in  the  initial  time
>        namespace.   In  the  initial time namespace, the contents of this
>        file are as follows:

I think we can mention that offset-secs can be negative, but
offset-nanosleep has to be 0 or positive.

Thanks,
Andrei

  parent reply	other threads:[~2020-04-07  3:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-04 11:08 RFC: time_namespaces(7) manual page Michael Kerrisk (man-pages)
2020-04-06  7:38 ` Andrey Vagin
2020-04-06 11:50 ` Dmitry Safonov
2020-04-07 12:12   ` Michael Kerrisk (man-pages)
2020-04-07  3:23 ` Andrei Vagin [this message]
2020-04-07 10:30   ` Thomas Gleixner
2020-04-07 13:06     ` Michael Kerrisk (man-pages)
2020-04-07 14:19       ` Thomas Gleixner
2020-04-07 15:32         ` Michael Kerrisk (man-pages)
2020-04-07 12:53   ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200407032318.GA494464@gmail.com \
    --to=avagin@gmail.com \
    --cc=0x7f454c46@gmail.com \
    --cc=adrian@lisas.de \
    --cc=avagin@openvz.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=dima@arista.com \
    --cc=ebiederm@xmission.com \
    --cc=gorcunov@gmail.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=vincenzo.frascino@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).