Received: by 10.223.185.116 with SMTP id b49csp1076541wrg; Sat, 3 Mar 2018 14:54:44 -0800 (PST) X-Google-Smtp-Source: AG47ELsysSNPgO/oWwZxXqmoNjgtzDZDKuSZBHgUB8o0oXppnCA6eKb6as+Bfgp5Rxctq2FfcGvs X-Received: by 10.99.114.24 with SMTP id n24mr7898603pgc.400.1520117684299; Sat, 03 Mar 2018 14:54:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520117684; cv=none; d=google.com; s=arc-20160816; b=TkJTrrtestU+NkobXjWDGUqKS0YFirWSpFxzaVZ4U0TnVTeEkPfshefyDYrzuil+gK P8Duld5hKKbHJDoDKBwGyRHqGbfgeQb9sTURTDPF374fOIh0ibnsfV8dDuAyJBuTpept yc90c3ly0w5Awl3q0UrpDSxK9vhcwPQPukhbmGwbB+nWrXdPiW3Y0msZo10sSAv3guPX /BfuG25jASrAS8/ZLkzGgfT+Jomn6EkTwUuYb8T81OY9DjR35XQzLgGL1ZNLtpm7FA1S 2Y4/Tti2AaqPiWmqJIDADPyMHht5jpjAqZLlo0gjEzI5kx82azXmdP8zxdqdC5c9nTdt nA7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=7NahbVUbqqmpmhVWSpj2Oy7pjL/Wxi7yIOcK7Sokg5Q=; b=wjwADY8OlnOt/zLx3X1aPBWw2QKtdmjuL70Ko3Zf6IfeFVIkJq3E7qmXtHEVFYa+MT 3OSec8x8VWblrNvIyYHTP5kakWMUFRlpOr+mwKiVK9E4/EvEJMkHyaHLZRi/F+CaLGOq EmpXUt4eJn5juUhdtSIo8+TcpmMog6XF7OqHzHwERg1XYBZtRbEIxW6R6YpvesCNLPbp 1l4EqHUJXThwYN0Lbjn7rM7Ru3MigYuHTj8WM1MEwTnniNziibN2G96aAXP5ZQnXaGPj T5ZBM1n2SjRkoOzxaSJxAdil+ZUW4pZG4IAAlFuRTaKBBSipwYb5GwSpLnPrKbv4AH+X PO3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=XYehCMy8; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w22-v6si5943191pll.71.2018.03.03.14.54.30; Sat, 03 Mar 2018 14:54:44 -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=@microsoft.com header.s=selector1 header.b=XYehCMy8; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934921AbeCCWxa (ORCPT + 99 others); Sat, 3 Mar 2018 17:53:30 -0500 Received: from mail-by2nam01on0095.outbound.protection.outlook.com ([104.47.34.95]:48488 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935051AbeCCWlG (ORCPT ); Sat, 3 Mar 2018 17:41:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7NahbVUbqqmpmhVWSpj2Oy7pjL/Wxi7yIOcK7Sokg5Q=; b=XYehCMy80yGsB4ss9cU/4EvRtX0IN9+PLrY9V5hbibDDze9wTZeph32jtEJ3qdHnpOegOZjd+N2GQGcvteSczZUTe/JnC/Nxl6JlXzGvdNvUpFAiIc/95vt/GkYbMzgBbtFeCHg7GQEC0TB1qnp1F/brnAk3XeVUG32dwQm8KqM= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB0940.namprd21.prod.outlook.com (52.132.146.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.5; Sat, 3 Mar 2018 22:41:04 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:41:04 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: David Engraf , John Stultz , Sasha Levin Subject: [PATCH AUTOSEL for 3.18 17/63] timers, sched_clock: Update timeout for clock wrap Thread-Topic: [PATCH AUTOSEL for 3.18 17/63] timers, sched_clock: Update timeout for clock wrap Thread-Index: AQHTsz+hFQG7EZSACka233XpuxcXDw== Date: Sat, 3 Mar 2018 22:33:19 +0000 Message-ID: <20180303223228.27323-17-alexander.levin@microsoft.com> References: <20180303223228.27323-1-alexander.levin@microsoft.com> In-Reply-To: <20180303223228.27323-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB0940;6:Jcgg/ATDmN64YmGhfnoYOU4k6ce/UYZuC5GMK00bXzj381UtBJclZC30owSH9biFi1RQkahpL/A0RgjEadHAiPCszFmo6cLNfp6pJOcvrt52YgwPQvhQgzlBD7VIPfxphrVuaFni9hPFVgv6OJhqNvw/P9wG/fmYqyMOhzmh/zsBdEzWVGtgkpmUyregMCzAxm3LT43XRsEaDXKVICgpd8ZCYAQyKZ7y7IRYT4y/4YTIJvAdSSWSgNa62RKCPafonTzL+I+8QiZVxZtDMMBeeK2nZDmhrVG9ermjKpg+5ZGxwyaDxLIpGmfo0YaIVH1syUs62BFAriJRekPT/qlyTXn2HyYE6jpSMAxWmbkxyCSFgqP6rDKS5nhH+Dhh4SK5;5:/oEzbIt+h2M1BiCQZN0u89PV2ufhBQf+bcVRtivTHl43oxySLfaZrF2XcbiFrrFfYpCYZW2RDBqHhL8HgiTIl+g9jpL299gFrWggUMO9bv4BRH/pBI05fliQadxJ9b+8BD8qyLn4LJz5EHMpIthWXWpXIL+NiTPcjrFsom1jSFI=;24:vWxZE4rLuBWNP5ffz33kXlpN+xgnj1i2vyzaCrbBsBBRs91LJOeyRPrHMWb6i3CQuSqiXv0b8VMVUCCnroKHwTWdgV8DyNv5UBOOtAPiICk=;7:nG+wHcTjR2lcxkCo3PUsvWczeJQtSCJA/Cs+U3IUdRW1Lfaia16+08HyXTTvJARDQTWSgn9vy76imuMjPCP/2UsNYyGo4G4KuZ6M3NTLiVGPB6mYEPyGa3+CKOFJ6DWhLCMh7KA85BfGhOMmAFsodwpydB2D6DLbUxDqjFQXqKs71jhKi9E94yonfSdUr281PDoCq0+jMQWChVMm6yq/VXcy3iiIKIjB7Zb6AxerWCaw/13/0FTYKBh0AaOJiF1O x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 32eb0266-d2ae-4f73-8bd5-08d58157d8d6 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7193020);SRVR:MW2PR2101MB0940; x-ms-traffictypediagnostic: MW2PR2101MB0940: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231220)(944501244)(52105095)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB0940;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB0940; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(39380400002)(346002)(366004)(39860400002)(396003)(199004)(189003)(106356001)(68736007)(6486002)(25786009)(22452003)(6436002)(186003)(2906002)(81156014)(81166006)(10090500001)(66066001)(8676002)(36756003)(6512007)(2900100001)(316002)(97736004)(59450400001)(102836004)(53936002)(6506007)(3280700002)(26005)(4326008)(5250100002)(305945005)(2501003)(76176011)(2950100002)(86362001)(99286004)(3846002)(72206003)(14454004)(3660700001)(15650500001)(478600001)(1076002)(5660300001)(10290500003)(6666003)(6116002)(7736002)(86612001)(107886003)(110136005)(54906003)(105586002)(8936002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB0940;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: XCyZQ3SZUWyfIdE3BV/RKnT6HHPxkwOPTocARuar6WNvtVRKgHY09u4lh+M18AyInq8KYhHFECE45PH2R9hwchpuKRQGbW09Ixag/c4etg5ik+eVSJd7aZ4DRVyLcSlHb6af4sqM/xOpvDSXoJAmNSqtUGsAymsXjSBDik3warQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32eb0266-d2ae-4f73-8bd5-08d58157d8d6 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:33:19.2628 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB0940 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 cloc= k 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 --- kernel/time/sched_clock.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index 01d2d15aa662..830e214f372c 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -146,6 +146,11 @@ void __init sched_clock_register(u64 (*read)(void), in= t bits, cd.epoch_ns =3D ns; raw_write_seqcount_end(&cd.seq); =20 + if (sched_clock_timer.function !=3D NULL) { + /* update timeout for clock wrap */ + hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL); + } + r =3D rate; if (r >=3D 4000000) { r /=3D 1000000; --=20 2.14.1