Received: by 10.213.65.68 with SMTP id h4csp1715428imn; Mon, 19 Mar 2018 11:15:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELvXvTnGXfMkIqE67/COb5Ys4FtNStNvvaTS6lV1Me1VLB+TbmY+3rYndOCvzJeE9Wd20fbg X-Received: by 10.101.88.130 with SMTP id d2mr9735535pgu.383.1521483341474; Mon, 19 Mar 2018 11:15:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521483341; cv=none; d=google.com; s=arc-20160816; b=UVDuouZjliENVDBmJgMgyICoA2zbShUXT+8t5q74KIO5HGe4r095dXESU+H2vh4P9p Z3U/Fc/CLhPpPTaLw4HeoWcgR9CPaF1splYRRJuT6Ex1vgmbuGs9kinzoHxcbMwUt8W1 YvkE0VvMj07B5a8KzPDIY2OuKeoD+Gbq7Ic93z6PlzhQRLYgeqj8N+r4YtVvqz/W/roW KUrvHhym62zUoSn7aHa4wb9HGBNVHcDeanlhS7ErGqc1Uc6iZiXVKDF2uFgZCIv5hznK bn6BZMNJV7DL7lgpPV/mIJ/V3+XiAcHFrOoxAV6Kmb/bnXE+c/FRUnpGd1xr++Q6ySe0 FidQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=e7p3NVaVXkotste401XA9hDNX6g2vGMy0C4vNa2sAtg=; b=IK6lc+GBzAdi2EOoe4BqW8qy38MJ6NALuHsGNN7QnXVva2yzBLO3x54NhWyzI5jGQ0 RZL0SnbTNLKMqPKNUS/W7gDgX8crljbfh3oKMLukt9tmLLozQGprM+/ABkZonsjd+CVt 7aOZqEYVe4B4zYUNx1ehvjQQ06IbEOE/0Hmuug1kwREo1c47GkxGe9HMMY38IHjQJamL O7eD2SnXxrZT/50C9Dgho60nTsBfJ1w4Fa8dExog11ONQ9490MuT2X7rcDo631iDwhAX g5XS0c+8LHszdJP3wwS93uGlzsrJiR/fA+AtUMIxyiYRv2hTRpCPkZCsQgbaq1JRamuJ +rig== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f125si277151pgc.736.2018.03.19.11.15.27; Mon, 19 Mar 2018 11:15:41 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030527AbeCSSNM (ORCPT + 99 others); Mon, 19 Mar 2018 14:13:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42952 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030478AbeCSSM5 (ORCPT ); Mon, 19 Mar 2018 14:12:57 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id CC5F411D6; Mon, 19 Mar 2018 18:12:56 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Engraf , John Stultz , Sasha Levin Subject: [PATCH 4.4 027/134] timers, sched_clock: Update timeout for clock wrap Date: Mon, 19 Mar 2018 19:05:10 +0100 Message-Id: <20180319171853.120793258@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319171849.024066323@linuxfoundation.org> References: <20180319171849.024066323@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Engraf [ Upstream commit 1b8955bc5ac575009835e371ae55e7f3af2197a9 ] The scheduler clock framework may not use the correct timeout for the clock wrap. This happens when a new clock driver calls sched_clock_register() after the kernel called sched_clock_postinit(). In this case the clock wrap timeout is too long thus sched_clock_poll() is called too late and the clock already wrapped. On my ARM system the scheduler was no longer scheduling any other task than the idle task because the sched_clock() wrapped. Signed-off-by: David Engraf Signed-off-by: John Stultz Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- kernel/time/sched_clock.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -205,6 +205,11 @@ sched_clock_register(u64 (*read)(void), update_clock_read_data(&rd); + if (sched_clock_timer.function != NULL) { + /* update timeout for clock wrap */ + hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL); + } + r = rate; if (r >= 4000000) { r /= 1000000;