Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5599pxb; Mon, 13 Sep 2021 11:26:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXJP1sK1Gtp9zGJaUICswhwAndBg2yTW99FkjEqHlnTco6E/lqEhCeej+xyh3LWWomblp4 X-Received: by 2002:a5e:da08:: with SMTP id x8mr9138996ioj.58.1631557619782; Mon, 13 Sep 2021 11:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631557619; cv=none; d=google.com; s=arc-20160816; b=XoPno+Rpfd1EnzY1UQHZJ21JMrF5c+auogF7ukJ3BE2ZT6VYQPwhhOwIoODi8x9goa daW3autnwr3tSEKv5hJ1V6mog4+0HN/MUxgM6YZWqfpKP8BlrPQPbKUVUYPXerHLsdcR sNy/HriNbM0FMrVvZNmlEq/STs9ijWpaVS3m//SL8CNfNuhDanZUo93aDSaufMlqkxEN jQcvzBuaAdZ9tCOFTZCwBcWqGUJgzSp/LY+P9kyU2mqQcgz2HCJlEykfvvx3hSJpsvyW WhdDnuQpD2QKEX89fjrD8YmjpjxVwW+IPNhDdj/sc3XWDQ/unrX2maije/t4tGIwck+g bOSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ci1gS9ubd7gn3/99cGn6APuOt1DX5izaFZ6yBLBbkSI=; b=0xGQAGj6+EKOHGbVhip+j7Nae71CUPzZ50QaiKIOuVEmfM9g6W6HsfsdupygGd5biq hbXnKz2kR5KNfHtF/jiI2Fkk8uvCwbHaHJrAftSyf6ymZuFbKgLZLXnUMGP9Y1rVSFPY IOchpaGYDnWWsB0OO6vRxyYMbQTtlP/lJG7Szv+3cshBms2FBPBiZQIeCTuuBezmEDAf 2Rd3fPXNxV55N4bKy+UPF5kpsestaGlEA9YYYduLBcJBsuAdbgH1zTO9dEbitOtXLhML P7hRzV2qpz5Wl9654WC4ldzzIO6D7F1dcN03knue+iLdjND/JTJkKQUWl/tpmCy4dM41 Ntyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WJmdEsHp; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u2si7664136ioc.87.2021.09.13.11.26.46; Mon, 13 Sep 2021 11:26:59 -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=@linuxfoundation.org header.s=korg header.b=WJmdEsHp; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240141AbhIMNT4 (ORCPT + 99 others); Mon, 13 Sep 2021 09:19:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:33196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236893AbhIMNSO (ORCPT ); Mon, 13 Sep 2021 09:18:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D998A60F23; Mon, 13 Sep 2021 13:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539018; bh=5WCdiSfoYC4iCYUhDtOeTfNzUT9R7Tz2ghmwEOEsMQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WJmdEsHpJzBYsfauOtJ6eNqiTxsqT/CzrxF1/PMTPj8DZixrM/4kLG+rfSnMFL4i5 de3o41dYJxn8zGEviVLfC3HENjqpoH2lkyMT1M+c23xS3AtoJcRdxj0jp2z9DTbxQH eIVAACwqHP4Mngp3VyjIg2QRh/za/WmI5ZVNBcaE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Sasha Levin Subject: [PATCH 5.4 011/144] hrtimer: Ensure timerfd notification for HIGHRES=n Date: Mon, 13 Sep 2021 15:13:12 +0200 Message-Id: <20210913131048.346230114@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131047.974309396@linuxfoundation.org> References: <20210913131047.974309396@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner [ Upstream commit 8c3b5e6ec0fee18bc2ce38d1dfe913413205f908 ] If high resolution timers are disabled the timerfd notification about a clock was set event is not happening for all cases which use clock_was_set_delayed() because that's a NOP for HIGHRES=n, which is wrong. Make clock_was_set_delayed() unconditially available to fix that. Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20210713135158.196661266@linutronix.de Signed-off-by: Sasha Levin --- include/linux/hrtimer.h | 5 ----- kernel/time/hrtimer.c | 32 ++++++++++++++++---------------- kernel/time/tick-internal.h | 3 +++ 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 1f98b52118f0..48be92aded5e 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -317,16 +317,12 @@ struct clock_event_device; extern void hrtimer_interrupt(struct clock_event_device *dev); -extern void clock_was_set_delayed(void); - extern unsigned int hrtimer_resolution; #else #define hrtimer_resolution (unsigned int)LOW_RES_NSEC -static inline void clock_was_set_delayed(void) { } - #endif static inline ktime_t @@ -350,7 +346,6 @@ hrtimer_expires_remaining_adjusted(const struct hrtimer *timer) timer->base->get_time()); } -extern void clock_was_set(void); #ifdef CONFIG_TIMERFD extern void timerfd_clock_was_set(void); #else diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 39beb9aaa24b..e1e8d5dab0c5 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -759,22 +759,6 @@ static void hrtimer_switch_to_hres(void) retrigger_next_event(NULL); } -static void clock_was_set_work(struct work_struct *work) -{ - clock_was_set(); -} - -static DECLARE_WORK(hrtimer_work, clock_was_set_work); - -/* - * Called from timekeeping and resume code to reprogram the hrtimer - * interrupt device on all cpus. - */ -void clock_was_set_delayed(void) -{ - schedule_work(&hrtimer_work); -} - #else static inline int hrtimer_is_hres_enabled(void) { return 0; } @@ -892,6 +876,22 @@ void clock_was_set(void) timerfd_clock_was_set(); } +static void clock_was_set_work(struct work_struct *work) +{ + clock_was_set(); +} + +static DECLARE_WORK(hrtimer_work, clock_was_set_work); + +/* + * Called from timekeeping and resume code to reprogram the hrtimer + * interrupt device on all cpus and to notify timerfd. + */ +void clock_was_set_delayed(void) +{ + schedule_work(&hrtimer_work); +} + /* * During resume we might have to reprogram the high resolution timer * interrupt on all online CPUs. However, all other CPUs will be diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 7b2496136729..5294f5b1f955 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -165,3 +165,6 @@ DECLARE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases); extern u64 get_next_timer_interrupt(unsigned long basej, u64 basem); void timer_clear_idle(void); + +void clock_was_set(void); +void clock_was_set_delayed(void); -- 2.30.2