Received: by 10.213.65.68 with SMTP id h4csp13504imn; Mon, 19 Mar 2018 17:54:29 -0700 (PDT) X-Google-Smtp-Source: AG47ELul+w3a9AAZFGxqws9MnTnNra7ZISPcKJPjqte1Q6392VBM8NyF77N4hSgU1QckDzq93xbi X-Received: by 10.101.92.138 with SMTP id a10mr10583022pgt.129.1521507269078; Mon, 19 Mar 2018 17:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521507269; cv=none; d=google.com; s=arc-20160816; b=GVCRWUJohxLYhdNPLWW5Joya+PMzhH17iwrTaBSQAlMBsfCLP1kV0IGeBl6MUbdYa8 kV58HtQxe28vrb6Q1VxyKBQCOs8ARZjlObx+W6Vefr8UvglLGxc0kQG9nSmt63SuBsdy azCMqHbMDQmoysYsexCXllqt9ZrytDi/Q4urbF8SvmForBhPgYpKGnUGwcYOqq6foL5o /petPkTwRuG4DeQgwwZFhiBEZgNxOhU3Q65s3MZ+TbeMS4xrEspvQDnm/GqacD0OPpVn 9notr6LSiq5YgNbAph7xF+DPVL+LCoBK1Rw/e9MPwDCy3W0Jew7IkB041ow1HD3VFR5y SCXA== 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=MhTMs+BZTOatV5lFeeP0M1FOcigx0ldD/6zs9aMcVdg=; b=FpY8dNpGLOQFbCnCYje+EEzfGkQ+cSK+z+lHiRMitOjeOSDaLGUrADtO1iGuNXVeVp RVhbfsCshqfVxvthv2g0YFKMNNx3KvOUP2Djzr2rMnV1NQ57IEoZynAX+LK0qOfEV/e4 CJI6Qcgw4a0DNQpM5JtqzVrdesf+KrJ8qqBz5zNGKmRhsxK+QmSuM1ivx+/XUmTbNqze R7I++zqbfWapkRD8UFXv++/EEvf8X9Q0PhjfQdCAvEVfVDAEhJzi/AhB09tO5j4gMJ0H gD6mZD8khZ7o8iVYR/DrBZX55RlGxDmEmmoMnHcbwxaf1dorvvizQicq/P1ReekDCnQz i3xQ== 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 b7-v6si434257plr.399.2018.03.19.17.54.14; Mon, 19 Mar 2018 17:54:29 -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 S1031008AbeCSSUd (ORCPT + 99 others); Mon, 19 Mar 2018 14:20:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47676 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030993AbeCSSU0 (ORCPT ); Mon, 19 Mar 2018 14:20:26 -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 EF9E211C6; Mon, 19 Mar 2018 18:20:25 +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.9 056/241] timers, sched_clock: Update timeout for clock wrap Date: Mon, 19 Mar 2018 19:05:21 +0100 Message-Id: <20180319180753.533220791@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@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.9-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;