Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4140233ybi; Mon, 29 Jul 2019 20:08:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqxw2ajtgEX/RP5JgySABKOdDiVuw3Ge7tw57Vo6ICmswsNTNhmDYz70tUK4NgD41Po4p5up X-Received: by 2002:a63:2252:: with SMTP id t18mr107287064pgm.5.1564456097751; Mon, 29 Jul 2019 20:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564456097; cv=none; d=google.com; s=arc-20160816; b=UwB2vzs5GFW2D8Az50lIAqc0ZAx5U2KKFw4qQ79+kpDxdteiFAaj4pK3NmFRsPwd/4 K1k9ZWKRHOomu/ZcR1ox9Tr4BJMoqRDJCoH5U5K3pYE96wWV3WyI6geFe8lwUr/jcrDD UWOesE+ExujU7J0CWcjUUrlHboQOV7oxXu2wnRaaYAYzHl6pS0niycvTUjee1FTtFjI6 RvUNZmr70S0mQ3jgh4t54HGKR/3Pa6Fy8TDB3Arf+Korf6hfbXYSu5sY9F4Xcf/PEF85 G3zt9mGNQcwkuxv/ILUqoUOAWONTiAYx7Rn2qSBj4cQDGuwCkugSv8waAYcoLVcNU3uR Agkg== 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=ajclCtPkHmfsuDyTsBDDeDUaIMIa7xyqZsQj0HfpnOA=; b=j455MFYwwZgbKbw6WSCIarq8k+liR6hmVFUvPqcx7EKP1u6Kfw+QcaPZll1gtNBGmG 8DOwSySbesedl5zDckiBqgY6QOXzTsezPN5FaDMCh7y0v5kfPT5QwFIalOBeAqh3iFBX plUKV+D/otz3PfvKnyt5cWvqkDprkn7LcOOxsQ4qOR+FFBqPAnspT7AxrmtEaY/d96Mc f4nReMUZBIyhL/YP3F7wNupMr6n/KMwp+m0btd3kEiVvh1aewY7AiS9pNjIKMp6d3hW7 9K3JmQ36Ihq+5VGFf5jWv9gRKiPJ2joAzFnap+fM7+CL2tDcPFlib26SiH1Gdawb4MSj J1tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=gBnsChUp; 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 cp2si28135207plb.437.2019.07.29.20.08.02; Mon, 29 Jul 2019 20:08:17 -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; dkim=pass header.i=@arista.com header.s=googlenew header.b=gBnsChUp; 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 S1730624AbfG2V7v (ORCPT + 99 others); Mon, 29 Jul 2019 17:59:51 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:35861 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730576AbfG2V7C (ORCPT ); Mon, 29 Jul 2019 17:59:02 -0400 Received: by mail-wr1-f67.google.com with SMTP id n4so63546343wrs.3 for ; Mon, 29 Jul 2019 14:59:01 -0700 (PDT) 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=ajclCtPkHmfsuDyTsBDDeDUaIMIa7xyqZsQj0HfpnOA=; b=gBnsChUpYJqm6KraqywpEqrYdlpGK80yRkwqP/Drik4VT6TtKzuWktoZ/3JcNrnwlE i7wq5oErkFVr6dV4BBG9MPw9UpcYGCNbFelYLIBh0rkpo4DCn6Sc4vd5AfCD1FdHFs9d r2sxOzb7XDXcZyFzPqizBoKGMbQl9gy7t10/zcAkAnbSzaRv5HnxHh0iBk2l6bwXAf+6 5CrOge6Bs1iCfGOkud3KsSMRyD9GQehnNUBerWSduCBuy7QjvB48CGCrApTLYCE823+5 VcwP4F2q8T4THUreKArju0G9xz8Px0H//ozTe2AHfbLmibNQ0lJxFxUKWuzPv5lEqWZ6 Szmw== 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=ajclCtPkHmfsuDyTsBDDeDUaIMIa7xyqZsQj0HfpnOA=; b=X10v4KSfH4ckqzMNVKmIk/qTWGbPulTrB0kjrRfFlF7qD+VriMJgTf/jdiEyYCHe6n hrvGylCfVc3aAVGah0BeBsIHz9gKp6i0FD8guu3JzOhY8PU6gTmKJG9UkeQ1gC1fVEJx qc6OxzIIGkRme20EnYFTZKNkLTUV9JDKGuynBgg/aDByjMZP6smf0IW/4o1wXTrncyBJ ZV7kyyhjQAWGtOWZN2TUc+R7svGua9uPGwLCyFLqTHfBUX4OzR2WRmwQnsWiLQUOaIKW 19IuHnzRyS+SjmYOqrsiYmCl41qwIBvXRJYhaHjFyUqDV1q44XSeM5N0ay42jFMnwmFb OHiA== X-Gm-Message-State: APjAAAXD6tFU6Qwd+W/JJ8uf9bsP9z8yJGZSpK7f/sG10o0fR9bK9mbf q74923qJBPa7MLVXybcnILTL3RcmghRP3iT/3qg35inW9xtHe28kUxsanz8YN9jQzS4Qr+pfRTv jqwa0b57MCI1LxzyAbGWAdal5zdJvuECEF1vyDl9xQvdwkUL7XglbakdZOKP80SS5u9rj490gfi jeEMO4jagS8ZnXBAJHNJ5Ie3DVzyylTZIFQCmOp0I= X-Received: by 2002:adf:da4d:: with SMTP id r13mr19656791wrl.281.1564437540219; Mon, 29 Jul 2019 14:59:00 -0700 (PDT) Received: from Mindolluin.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id x20sm49230728wmc.1.2019.07.29.14.58.58 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 14:58:59 -0700 (PDT) From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Dmitry Safonov , Adrian Reber , Andrei Vagin , Andy Lutomirski , Arnd Bergmann , Christian Brauner , Cyrill Gorcunov , "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jann Horn , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , Vincenzo Frascino , containers@lists.linux-foundation.org, criu@openvz.org, linux-api@vger.kernel.org, x86@kernel.org Subject: [PATCHv5 05/37] alarmtimer: Rename gettime() callback to get_ktime() Date: Mon, 29 Jul 2019 22:57:25 +0100 Message-Id: <20190729215758.28405-44-dima@arista.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729215758.28405-1-dima@arista.com> References: <20190729215758.28405-1-dima@arista.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CLOUD-SEC-AV-Info: arista,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrei Vagin The upcoming support for time namespaces requires to have access to: - The time in a tasks time namespace for sys_clock_gettime() - The time in the root name space for common_timer_get() struct alarm_base needs to follow the same name convention, so rename .gettime() callback into get_ktime() as a preparation for introducing get_timespec(). Suggested-by: Thomas Gleixner Signed-off-by: Andrei Vagin Co-developed-by: Dmitry Safonov Signed-off-by: Dmitry Safonov --- kernel/time/alarmtimer.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index c191254f178b..37254eb64459 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -36,13 +36,13 @@ * struct alarm_base - Alarm timer bases * @lock: Lock for syncrhonized access to the base * @timerqueue: Timerqueue head managing the list of events - * @gettime: Function to read the time correlating to the base + * @get_ktime: Function to read the time correlating to the base * @base_clockid: clockid for the base */ static struct alarm_base { spinlock_t lock; struct timerqueue_head timerqueue; - ktime_t (*gettime)(void); + ktime_t (*get_ktime)(void); clockid_t base_clockid; } alarm_bases[ALARM_NUMTYPE]; @@ -207,7 +207,7 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer) spin_unlock_irqrestore(&base->lock, flags); if (alarm->function) - restart = alarm->function(alarm, base->gettime()); + restart = alarm->function(alarm, base->get_ktime()); spin_lock_irqsave(&base->lock, flags); if (restart != ALARMTIMER_NORESTART) { @@ -217,7 +217,7 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer) } spin_unlock_irqrestore(&base->lock, flags); - trace_alarmtimer_fired(alarm, base->gettime()); + trace_alarmtimer_fired(alarm, base->get_ktime()); return ret; } @@ -225,7 +225,7 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer) ktime_t alarm_expires_remaining(const struct alarm *alarm) { struct alarm_base *base = &alarm_bases[alarm->type]; - return ktime_sub(alarm->node.expires, base->gettime()); + return ktime_sub(alarm->node.expires, base->get_ktime()); } EXPORT_SYMBOL_GPL(alarm_expires_remaining); @@ -270,7 +270,7 @@ static int alarmtimer_suspend(struct device *dev) spin_unlock_irqrestore(&base->lock, flags); if (!next) continue; - delta = ktime_sub(next->expires, base->gettime()); + delta = ktime_sub(next->expires, base->get_ktime()); if (!min || (delta < min)) { expires = next->expires; min = delta; @@ -364,7 +364,7 @@ void alarm_start(struct alarm *alarm, ktime_t start) hrtimer_start(&alarm->timer, alarm->node.expires, HRTIMER_MODE_ABS); spin_unlock_irqrestore(&base->lock, flags); - trace_alarmtimer_start(alarm, base->gettime()); + trace_alarmtimer_start(alarm, base->get_ktime()); } EXPORT_SYMBOL_GPL(alarm_start); @@ -377,7 +377,7 @@ void alarm_start_relative(struct alarm *alarm, ktime_t start) { struct alarm_base *base = &alarm_bases[alarm->type]; - start = ktime_add_safe(start, base->gettime()); + start = ktime_add_safe(start, base->get_ktime()); alarm_start(alarm, start); } EXPORT_SYMBOL_GPL(alarm_start_relative); @@ -414,7 +414,7 @@ int alarm_try_to_cancel(struct alarm *alarm) alarmtimer_dequeue(base, alarm); spin_unlock_irqrestore(&base->lock, flags); - trace_alarmtimer_cancel(alarm, base->gettime()); + trace_alarmtimer_cancel(alarm, base->get_ktime()); return ret; } EXPORT_SYMBOL_GPL(alarm_try_to_cancel); @@ -474,7 +474,7 @@ u64 alarm_forward_now(struct alarm *alarm, ktime_t interval) { struct alarm_base *base = &alarm_bases[alarm->type]; - return alarm_forward(alarm, base->gettime(), interval); + return alarm_forward(alarm, base->get_ktime(), interval); } EXPORT_SYMBOL_GPL(alarm_forward_now); @@ -500,7 +500,7 @@ static void alarmtimer_freezerset(ktime_t absexp, enum alarmtimer_type type) return; } - delta = ktime_sub(absexp, base->gettime()); + delta = ktime_sub(absexp, base->get_ktime()); spin_lock_irqsave(&freezer_delta_lock, flags); if (!freezer_delta || (delta < freezer_delta)) { @@ -619,7 +619,7 @@ static void alarm_timer_arm(struct k_itimer *timr, ktime_t expires, struct alarm_base *base = &alarm_bases[alarm->type]; if (!absolute) - expires = ktime_add_safe(expires, base->gettime()); + expires = ktime_add_safe(expires, base->get_ktime()); if (sigev_none) alarm->node.expires = expires; else @@ -657,7 +657,7 @@ static int alarm_clock_get_timespec(clockid_t which_clock, struct timespec64 *tp if (!alarmtimer_get_rtcdev()) return -EINVAL; - *tp = ktime_to_timespec64(base->gettime()); + *tp = ktime_to_timespec64(base->get_ktime()); return 0; } @@ -734,7 +734,7 @@ static int alarmtimer_do_nsleep(struct alarm *alarm, ktime_t absexp, struct timespec64 rmt; ktime_t rem; - rem = ktime_sub(absexp, alarm_bases[type].gettime()); + rem = ktime_sub(absexp, alarm_bases[type].get_ktime()); if (rem <= 0) return 0; @@ -803,7 +803,7 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags, exp = timespec64_to_ktime(*tsreq); /* Convert (if necessary) to absolute time */ if (flags != TIMER_ABSTIME) { - ktime_t now = alarm_bases[type].gettime(); + ktime_t now = alarm_bases[type].get_ktime(); exp = ktime_add_safe(now, exp); } @@ -868,9 +868,9 @@ static int __init alarmtimer_init(void) /* Initialize alarm bases */ alarm_bases[ALARM_REALTIME].base_clockid = CLOCK_REALTIME; - alarm_bases[ALARM_REALTIME].gettime = &ktime_get_real; + alarm_bases[ALARM_REALTIME].get_ktime = &ktime_get_real; alarm_bases[ALARM_BOOTTIME].base_clockid = CLOCK_BOOTTIME; - alarm_bases[ALARM_BOOTTIME].gettime = &ktime_get_boottime; + alarm_bases[ALARM_BOOTTIME].get_ktime = &ktime_get_boottime; for (i = 0; i < ALARM_NUMTYPE; i++) { timerqueue_init_head(&alarm_bases[i].timerqueue); spin_lock_init(&alarm_bases[i].lock); -- 2.22.0