Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5665494ima; Tue, 5 Feb 2019 16:15:14 -0800 (PST) X-Google-Smtp-Source: AHgI3Iat6UThysj371cL0yKNyKhnMNoar/nNTiC5bhQJs9LjX+oan6eqlzAntun5+MtWJK6bRp04 X-Received: by 2002:a63:2c0e:: with SMTP id s14mr7131484pgs.132.1549412114854; Tue, 05 Feb 2019 16:15:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549412114; cv=none; d=google.com; s=arc-20160816; b=f7i66ZhvqAQCD3mhyX1o1vtIcDHGRjKE9CuDS0nZ4UkDLfVBLl2sW/z0hX+x7FSyAO aPWbHdWQCBp4/IedeIpr8Ns6eFHyWQi4MdEUUOmUO0ZYI5q1eGHFxg4RmbojxBuN/7pp D55aBLOryUYMf2A+jSCo7UFKV4rkHxP4m+RnTcXQQ6+MoTwya9cBkAh/jahL78n8UCD1 jLyc9NVoZuOPnE+LUS7ZV2vPp2GYJgecJ/1CWdD3t3ws2l0k0FqWL2lv1CQlo1tNjms2 GFM1E0QOrNka/IiBmvCORvNg1fjMyAqqZ/GUSfPmwFhYPVIYjEEAL+U0RaHtW3xKp7qf K9Qg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+GUoFTNniPDyfiwRgUfcUTytEWqh8nWBu+fPwR0GKeU=; b=0J9gHk7LhS/7E2xB5GMEAwNwwmKkoAHCxb7HFFkxuIpvdb+oY11B1MYYo347tJrSom Lfd3osNOay6WGqfsHABxxr3OpMLeiJXth29tJbgPmJyitUr5p0QLZOQP4UlNi3Mlon7B lgJwwSl5ZmEGNaon30hHmFJBMDqAED2UjhNEx2PJ8LlYeyWPwnXWWihZZBTMxHVaKaHm AO9fMFXCpjlP65UmiMnBpyCxkapDKwwgxgwZvwFs24piiLYYk3J1rXFMS+xRVsAycrbi sALj8buX+CfK1WKmn7PBFamnK8hdzuPY29TspOpj5J7TC9Oo4fB1jQvgd8hi7E/cnAbC Jo/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=Xwfr6FR+; 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=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 23si4390891pfk.287.2019.02.05.16.15.00; Tue, 05 Feb 2019 16:15:14 -0800 (PST) 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; dkim=pass header.i=@arista.com header.s=googlenew header.b=Xwfr6FR+; 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=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727717AbfBFALV (ORCPT + 99 others); Tue, 5 Feb 2019 19:11:21 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:43163 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727166AbfBFALR (ORCPT ); Tue, 5 Feb 2019 19:11:17 -0500 Received: by mail-ed1-f68.google.com with SMTP id f9so4445097eds.10 for ; Tue, 05 Feb 2019 16:11:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+GUoFTNniPDyfiwRgUfcUTytEWqh8nWBu+fPwR0GKeU=; b=Xwfr6FR+bNuw9+nDOx1MqTF73/dIFKH1BCfSHk0iRQeWdPIywbbNzre0HQbfl5Y1sE l45wvpqXYMn+LI3TSyTA/Eq9SqEEQB2oHUh6BnauWEQALUUzyDdGLE7ZzY80H3mmmZBf qgXaaGllr3VnSZl0VofxUFMuszqG0D9Iru1Gv6LXSUodJVrtB9WJg8clZRuiDwOtCyXh kMBtzWTNfzNf22LIF6hjtfz46RRjKaXrJxReSVOW6BCpVNYzNnee2AplfFlogGnEZXpC rHIQExcXZilYlrC/HzQkO6wcEt2X0hcsz+82m9nEE3naKEUM/0n+kIDiee6HI7Kh53CK mTGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+GUoFTNniPDyfiwRgUfcUTytEWqh8nWBu+fPwR0GKeU=; b=r83L1HX4trSyd0dYX3UuwzHsPiB5QT2D6A/CqepKh/mqaCmTbLiRnpzODZslNGEHXa yPi0xIXdQL4LuhAJWxJL2TNk9JzJjRQ+pvO+M8ZEIsEQcLt0ttnvLR2lnnHU5Snoi7lR e7ukPJ70Cam3iUm3h3GOF/TFfoOh1PrDRfEl70mUqPNsgiiORetk1Km3Q1X19kT7lgtr QPDtsDQZnHJGu8UrH2Tr6P4oGqyhITLox2jKZHoHxbS2mo6MH262vS6GG0CQjJmx0DNe twmcHemHaxP1/BsE0xNYw1DImt+FEZnqAtOx+VUbsa6QBngcRw6cV6pSCQFUpS8cz92R VLAg== X-Gm-Message-State: AHQUAubbTIdQ+qeZxyUKv2WSE+1/wfbd7DOJ+hv+aBWv3CKwTJqf5VIn 96LhKfFRPnNKqC9fg21RwkcDN7pFQNg= X-Received: by 2002:a17:906:9611:: with SMTP id s17mr5467367ejx.37.1549411874645; Tue, 05 Feb 2019 16:11:14 -0800 (PST) Received: from Mindolluin.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id p30sm5489594eda.68.2019.02.05.16.11.13 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 05 Feb 2019 16:11:14 -0800 (PST) From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Andrei Vagin , Dmitry Safonov , Adrian Reber , Andrei Vagin , Andy Lutomirski , Andy Tucker , Arnd Bergmann , Christian Brauner , Cyrill Gorcunov , Dmitry Safonov <0x7f454c46@gmail.com>, "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , containers@lists.linux-foundation.org, criu@openvz.org, linux-api@vger.kernel.org, x86@kernel.org Subject: [PATCH 04/32] timens: Introduce CLOCK_BOOTTIME offset Date: Wed, 6 Feb 2019 00:10:38 +0000 Message-Id: <20190206001107.16488-5-dima@arista.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190206001107.16488-1-dima@arista.com> References: <20190206001107.16488-1-dima@arista.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrei Vagin Adds boottime virtualisation for time namespace. Introduce timespec for boottime clock into timens offsets and wire clock_gettime() syscall. Signed-off-by: Andrei Vagin Co-developed-by: Dmitry Safonov Signed-off-by: Dmitry Safonov --- include/linux/timens_offsets.h | 1 + kernel/time/posix-timers.c | 1 + kernel/time_namespace.c | 3 +++ 3 files changed, 5 insertions(+) diff --git a/include/linux/timens_offsets.h b/include/linux/timens_offsets.h index 248b0c0bb92a..777530c46852 100644 --- a/include/linux/timens_offsets.h +++ b/include/linux/timens_offsets.h @@ -4,6 +4,7 @@ struct timens_offsets { struct timespec64 monotonic_time_offset; + struct timespec64 monotonic_boottime_offset; }; #endif diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index b6d5145858a3..782708054df2 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -1314,6 +1314,7 @@ static const struct k_clock clock_tai = { static const struct k_clock clock_boottime = { .clock_getres = posix_get_hrtimer_res, .clock_get = posix_get_boottime, + .clock_timens_adjust = true, .nsleep = common_nsleep, .timer_create = common_timer_create, .timer_set = common_timer_set, diff --git a/kernel/time_namespace.c b/kernel/time_namespace.c index 57694be9e9db..36b31f234472 100644 --- a/kernel/time_namespace.c +++ b/kernel/time_namespace.c @@ -208,6 +208,9 @@ static void clock_timens_fixup(int clockid, struct timespec64 *val, bool to_ns) case CLOCK_MONOTONIC_COARSE: offsets = &ns_offsets->monotonic_time_offset; break; + case CLOCK_BOOTTIME: + offsets = &ns_offsets->monotonic_boottime_offset; + break; } if (!offsets) -- 2.20.1