Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp499434ybm; Fri, 29 May 2020 05:29:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxarDpvxszedtmqZwFwxlSUyD7oRAyjn/w28d/VNrMRkqvWmVQOJnOBzxNtuNQF09ZnoDpD X-Received: by 2002:a17:906:da05:: with SMTP id fi5mr7664017ejb.95.1590755364479; Fri, 29 May 2020 05:29:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590755364; cv=none; d=google.com; s=arc-20160816; b=HwfujHCSs4RVQgaF9/QzitSww4XRa8CoX/kW2YtskxjeDMm02s0d+ekZAdPc760pWu Nddtf4838CoMRGAfQgPy2r2aGIGkOoefDJGxHsZFP1l9uo6ySwl2L7UBVO10IRU47N/c pM4xpaN1xPV77a57MFjB6NiTRiU0BaDNaOXXcTRYplVLQkAv7NqcDgkqz2s5zmHr+Xoc Lj2jet7u+GwOxYbs3Sg/U/MwJmX1xpbFMxgeSgJ2pJN+tsSiT90cPzOxSDY4vyKbJwK1 YN2p88bF0wFplBAtlQU5g/y/H9/0KQlfMIYnqrDSNS9tUjYaROM/LaY75aKHPP+mL4RW sc1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:dkim-signature; bh=Oq58YQ7K3U+VFAHOwMAEPCB3pfR9X0Yod8nFGMe+Pdw=; b=YxoWlLDe5ZQ2t1Lek7T3UXOWm+plhHIzlMNPHBMD+vH3M9qww/MnamxPohDoTTnJwC xeiZdEUxMef0Ovu80U5SlwSL+3d24+Cy13RRvJh7KUMq+o0neMXBBPR7h0P37aTn3O0H bA+APyMucYrp+ziaDN5k8Z6DTvHw58Lu+UtLK7YpJMTEuzLzkAFkmrrINg/ZQckdmyHY MX5aoyUZXjX75jyz1kVV5JPK6Fs/Lh7USYwiOW/NMJHy+nu8sqJBlRNRq2gpIjMnYoUg YV2aSfxsDJsqzlQCk8wRecr1DcRx9BIQ+vT4wOIqmgNwg1yXU/RGoFMn+f9TLVKCr7PJ jFnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UG4rFKoA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si5136511ede.199.2020.05.29.05.29.00; Fri, 29 May 2020 05:29:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UG4rFKoA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726829AbgE2M00 (ORCPT + 99 others); Fri, 29 May 2020 08:26:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726052AbgE2M00 (ORCPT ); Fri, 29 May 2020 08:26:26 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF9FFC03E969 for ; Fri, 29 May 2020 05:26:25 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id d7so1878976eja.7 for ; Fri, 29 May 2020 05:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=Oq58YQ7K3U+VFAHOwMAEPCB3pfR9X0Yod8nFGMe+Pdw=; b=UG4rFKoAgWmq9WpIszGNHsVYP2LhOV2zl4bDkuhefY28GIhZFNwN0NEn3boutHt3ho s1iTdaqixhlnAtK5P2gaisektUDlV4FIfbvR3T7dawMsw70DlwycAtadJ1pjfesWgow0 O2GHys3hiaiDugZGhP2tVTo9dlQv4O8/khFjtR2p3tFe86B5YoUtPA8VjVzjf9uGDIJq rYlgdkzyoG24fA/mY0fMPEQzrk6Izt5dZAr9H/T+h/RM7s7tBRSWk6hCxhzaN5qmzM1K T+GlOadAe+lXl3f9xKrG1aeBoVQfmdSAeUkynvvtoc7Z61KBwZyB8O5XUYW4q9EqKWzB f0eg== 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:reply-to :from:date:message-id:subject:to:cc; bh=Oq58YQ7K3U+VFAHOwMAEPCB3pfR9X0Yod8nFGMe+Pdw=; b=iB7UhZd6GivoAtBXxj9fsIAEEN0jkGoBlzbfp+Ek1F5jkBzhTo51B/1OukNIUmbhze dMZIIFs38/Qz+mSJkvKp2J8onUJAcE2wRedvGkzSIsIqHHMIPcLzKTL3K8h267yJHXao 4QLzuURsmvSWU4hOGaCVi5jwl1UvLDpNhc6jzldSdvgMsKVz4DV6sU9Y9ncSfSWlA8wa wbxaEMJPv5/oTKb1FHydn+Kp4XLJymEFOGQboLExVrtq2chxzfEXkP2pBrCojQhY0NvC CbFi+COIkp/BtGjZIk8uaCXn8rPBNncDJ1K8TuwebJooC9A2HqWsulhCephv5YOzTNaU jPhg== X-Gm-Message-State: AOAM5310VjCNEsVbP/oUXCLSXJgN3/BzXbHh6rEU7NCoveBtDFgGknYF PbmULSoTVcSHk2dTtbOJR8M5mfHQ4I8usFbaZ1I= X-Received: by 2002:a17:906:51b:: with SMTP id j27mr7018425eja.246.1590755184371; Fri, 29 May 2020 05:26:24 -0700 (PDT) MIME-Version: 1.0 References: <20200317083043.226593-1-areber@redhat.com> In-Reply-To: <20200317083043.226593-1-areber@redhat.com> Reply-To: mtk.manpages@gmail.com From: "Michael Kerrisk (man-pages)" Date: Fri, 29 May 2020 14:26:13 +0200 Message-ID: Subject: Re: clone3: allow creation of time namespace with offset To: Adrian Reber Cc: Christian Brauner , Eric Biederman , Pavel Emelyanov , Oleg Nesterov , Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , lkml , Mike Rapoport , Radostin Stoyanov , Arnd Bergmann , Cyrill Gorcunov , Thomas Gleixner , Michael Kerrisk Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Adrian, If there was a revision to this patch, I missed it. Is there still a plan to bring CLONE_NEWTIME to clone3()? Thanks, Michael On Tue, 17 Mar 2020 at 09:32, Adrian Reber wrote: > > This is an attempt to add time namespace support to clone3(). I am not > really sure which way clone3() should handle time namespaces. The time > namespace through /proc cannot be used with clone3() because the offsets > for the time namespace need to be written before a process has been > created in that time namespace. This means it is necessary to somehow > tell clone3() the offsets for the clocks. > > The time namespace offers the possibility to set offsets for > CLOCK_MONOTONIC and CLOCK_BOOTTIME. My first approach was to extend > 'struct clone_args` with '__aligned_u64 monotonic_offset' and > '__aligned_u64 boottime_offset'. The problem with this approach was that > it was not possible to set nanoseconds for the clocks in the time > namespace. > > One of the motivations for clone3() with CLONE_NEWTIME was to enable > CRIU to restore a process in a time namespace with the corresponding > offsets. And although the nanosecond value can probably never be > restored to the same value it had during checkpointing, because the > clock keeps on running between CRIU pausing all processes and CRIU > actually reading the value of the clocks, the nanosecond value is still > necessary for CRIU to not restore a process where the clock jumps back > due to CRIU restoring it with a nanonsecond value that is too small. > > Requiring nanoseconds as well as seconds for two clocks during clone3() > means that it would require 4 additional members to 'struct clone_args': > > __aligned_u64 tls; > __aligned_u64 set_tid; > __aligned_u64 set_tid_size; > + __aligned_u64 boottime_offset_seconds; > + __aligned_u64 boottime_offset_nanoseconds; > + __aligned_u64 monotonic_offset_seconds; > + __aligned_u64 monotonic_offset_nanoseconds; > }; > > To avoid four additional members to 'struct clone_args' this patchset > uses another approach: > > __aligned_u64 tls; > __aligned_u64 set_tid; > __aligned_u64 set_tid_size; > + __aligned_u64 timens_offset; > + __aligned_u64 timens_offset_size; > }; > > timens_offset is a pointer to an array just as previously done with > set_tid and timens_offset_size is the size of the array. > > The timens_offset array is expected to contain a struct like this: > > struct set_timens_offset { > int clockid; > struct timespec val; > }; > > This way it is possible to pass the information of multiple clocks with > seconds and nanonseconds to clone3(). > > To me this seems the better approach, but I am not totally convinced > that it is the right thing. If there are other ideas how to pass two > clock offsets with seconds and nanonseconds to clone3() I would be happy > to hear other ideas. > > Adrian > > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/