Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp252383ybb; Thu, 9 Apr 2020 22:28:23 -0700 (PDT) X-Google-Smtp-Source: APiQypIR4z/lmPUHrzp2ywZelI/YPkd87X3nsePZQHZ4quYOYWJg+fMfPh9izHyAL0lGtkdg5IMk X-Received: by 2002:ad4:524c:: with SMTP id s12mr3691075qvq.52.1586496503297; Thu, 09 Apr 2020 22:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586496503; cv=none; d=google.com; s=arc-20160816; b=G9dPEnw3LcDFtwQAjuY0/ycqGGaKG9jB6AUnGh63kuIusClDYlt8rWXVTmjn3Fh/J2 Cs3nVmXWhp7QwdxqqxwfP+6vfA0y1M4dMOE8cvc9cc2BSN5qzPOJUT+3i4ejGL9z/zm+ d3mMti4Gq2Up7pmUP8Woxhku2wl/BQ/UAVzOK/vffXhG9f2oLQ9eU42ZWx164EqmWvDr qmGWPPaH+z6778yFN3Hp3SAS1CPl/kQVhYbStXIIVM1rC2VS3KCbRg27QLdqJiFGN6Ry aPIjQecpcd3DArRPA8kcF9tbBk5v78ntAmFR2/9tKpFnhrPBBoOHQuUBN/jJBnoCafOo GsHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=REsNrvY14e/EL+vcIiiQ1G5qlZrCGPUTJji1FlQfUXk=; b=jS7mnGyMBDx98+1n4NIt8Adrdqok7WtzIykST5ZKGxAo0/4WV7Acl0ITG6g8rsoYNB fjg2Xqx5LFAUqzSSwKBgaXZSVDIDfjeQaPoUUlsun1mDr883gVxyeImgbUfINfxss8NM 5gs9LmcIM/wHOIUOmXppPbmX2bTnqFj8A08ANADo+KQkwoZ/644/TFEJdiqrGuQww8VH jO/royMc/EMJ91ve20vD0+KXns8GxrzMRRDGE1aGcAuGXOtdZkuJ8+mmjbjeyl1HuW6k ESDhGz81WyQ11ISWWnfeVo93M2V0bT8Z2et/hlAGZ3tfqrl2IHxHWvKJT6O2qZ0lOpJL 2+Ew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g29si668456qtm.90.2020.04.09.22.28.08; Thu, 09 Apr 2020 22:28:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725955AbgDJFYF convert rfc822-to-8bit (ORCPT + 99 others); Fri, 10 Apr 2020 01:24:05 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:42940 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725208AbgDJFYF (ORCPT ); Fri, 10 Apr 2020 01:24:05 -0400 Received: by mail-ot1-f65.google.com with SMTP id j20so183518otl.9; Thu, 09 Apr 2020 22:24:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=G7Vs6kbIU7vDoe0PVtVhOXYoT49lemDbcQnLgW0gxPY=; b=so8FAPcR1CMo+/j4f39k765yjz6XskK4I3NVUgyEHYwGN5YNTekFPNcz14Jou3Un62 tFnG9pXrujpeplebshGhRKOQEA0LiP2m9vo3TRDa08NT4es9zRpzXBPKBue2yUayy+yF A53nVAaRFaji02dXGp5YX5V/FLOsnWh6YAxGwpimX4HFMOujoiEB9Wy4Zh7of4JhPYjF ADK8PoRljqLGcAICa36MbiIzzL1Ynj8EZklEUz1CPL4i/XKEHneH0to/nfhf2bdkwyGw AECC+WGn9+3kOtSM30t8zEY9TfUEz/pxPn0c/DuzGqTFBYTwdGtp73rASDh298aJ+zm4 l93w== X-Gm-Message-State: AGi0PuaGBWJLxlP6omLfY8fYsIuw0/mU1yJVjFEdsSHREU54hE44HBam Ky5R7luNA3PyF6xaUMAJtTACuPqh2aaq7QItbQw= X-Received: by 2002:a4a:c595:: with SMTP id x21mr2952338oop.10.1586496244370; Thu, 09 Apr 2020 22:24:04 -0700 (PDT) MIME-Version: 1.0 References: <703440af-031c-16b5-c1ff-54fb4bb5e10c@gmail.com> <87a73kny56.fsf@x220.int.ebiederm.org> In-Reply-To: <87a73kny56.fsf@x220.int.ebiederm.org> From: Andrey Vagin Date: Thu, 9 Apr 2020 22:23:49 -0700 Message-ID: Subject: Re: A further though on /proc/PID/timens_offsets To: "Eric W. Biederman" Cc: Dmitry Safonov , Linux API , Containers , Dmitry Safonov <0x7f454c46@gmail.com>, lkml , "Michael Kerrisk (man-pages)" , Andy Lutomirski , Thomas Gleixner , Adrian Reber Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 9, 2020 at 2:35 PM Eric W. Biederman wrote: > > Andrey Vagin writes: > > > On Tue, Apr 7, 2020 at 6:24 AM Michael Kerrisk (man-pages) > > wrote: > > > >> 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. > >> > >> What was the reason for exposing numeric clock IDs in the > >> timens_offsets file? In API terms, that seems a little ugly. > >> > >> I think it would have been much nicer if the clocks were defined > >> symbolically in this file. I.e., that reading the file would have > >> shown something like > >> > >> monotonic x y > >> boottime x y > >> > >> And that records similarly with symbolic clock names could have > >> been written to the file. Was there a reason not to do this? > > > > No, there was not except that I haven't thought about this. I agree > > that symbolic clock names looks nicer for humans, but numeric clock > > IDs are a bit more convenient when we need to set/read offsets from > > code. This interface is in the released kernel, so I think we can't > > change the format of the content of this file. But we can add support > > of symbolic clock names for setting clock offsets. What do you think? > > The rule is we can change things as long as userspace doesn't care. For > very new interfaces like this it is possible there are few enough > userspace programs that nothing cares. > > Do you know if someone is using this interface yet? CRIU has the support of time namespace, but these changes are in the devel branch and have not been released yet. I know two more project: * The util-linux (unshare and nsenter tools): https://github.com/karelzak/util-linux/commit/7f1f0584c24a77909a7c96e62e30f63f4c1b10ad https://github.com/karelzak/util-linux/commit/ef0341c9be441b834848d260ba0dbeb47a20f7a3 The last release of util-linux was at the end of January, so these changes have not been released. * crun https://github.com/containers/crun/commit/a669dc64f70f71423a0ee1bb977f2d77e473649a These changes have been released in the crun v0.13. All these projects only set offsets, so I think following the rule that you described, we can start showing symbolic clock names and accept both variants for setting offsets. If everyone agrees with this, I can prepare a patch tomorrow. Thanks, Andrei