Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1637041ybv; Fri, 21 Feb 2020 00:45:35 -0800 (PST) X-Google-Smtp-Source: APXvYqw9vZ/8L51S4cWuB9RtNqiGsRalFUIvwrluwLom5x+uw6uQ9RqzGvvhawYIktleonj69Ub7 X-Received: by 2002:a05:6830:114c:: with SMTP id x12mr27449416otq.324.1582274734978; Fri, 21 Feb 2020 00:45:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582274734; cv=none; d=google.com; s=arc-20160816; b=qN0GdKNX/rmlgqeErfisuMXMX7CIlH9swvagkFmlihoMHPA/GrEjHa3bm55FpH1kZr 5I2eBEX0wkOg8+V7fvWHvQO/fhWwsTsuI0QzkJBK2qZ8xDAccBOBAHNMw/hTMdSqUxOp YQBXhBlLRTv0zdI1+sFz1rdiB2c0dtGp9TzJFqN4tnAfqV3zHC/qBh7xTVbck0bllqQw RRflsHrjGnNBNSCc9y+knugqfNDm2DY7Y1K6MRIUBs0B/jT7tMDwLlWdsqEszNhl/J4L /d1t9iLbZDc2dq/WFeIVRqmjWaJJluIIkTc8PcgOVwvOkL9LzuUk/Ir5jVyPLF48KuTP ivpg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TDhbeqaym5jVC+IHR6yoUrgAHW0jwxXZqo20NVMTsCs=; b=eCNWclDLTrZ4uHKCTeWgubW2Ln/k7AbE6CG4IIyMiPYYFa/gl+PCba57Auh8vb43g+ hcrAD8JYNjBeE4DV3RHVUeV9/19yJMd905ho1B9oD7L5w9WHvxi42mzWHGyOYYgsc0E+ yaqoFk+LOcUS5foJeUZ2TaeTh/A4/3hus9Ujkq6xeUey3/02D8eRlxuCVDc4m1FpmO/S dDFrjxfDALg5PIK2EdOhStv6yzr2iSdwFGHyzHba6fquCvW7JrWzd1GLPEmIbiFnZxbh FmaD76h8KkTIqRLLbUXJaIx8zB8RHZdsxOQj9zUXq8RBLXaCF4Ul5U+/x2pinuCTNUkn yHjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Yy5WrAKN; 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 e6si1136477otq.217.2020.02.21.00.45.23; Fri, 21 Feb 2020 00:45:34 -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=@kernel.org header.s=default header.b=Yy5WrAKN; 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 S1729814AbgBUHvt (ORCPT + 99 others); Fri, 21 Feb 2020 02:51:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:49326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729806AbgBUHvr (ORCPT ); Fri, 21 Feb 2020 02:51:47 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5711520578; Fri, 21 Feb 2020 07:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582271506; bh=kHrVyKQu4EWN7X+O0OX9IdROv4KxjFWl9tyQX76enSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yy5WrAKNKkJRYoj6fpFDRVkSc3KjpZ0BzKQpDQ+6NYC47XJtrflacbEP/JgnZk3/W rnOwmF0MuKpScOO8Kg/sHOATlEDmFqMtn2I2lE5m8QbLGAwYV3Gtnw/R0OaDQN8CPl bFGIkNtkl+sB9J/EjocOXem0WAXnySeu4Cmjgg4o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kamil Konieczny , Chanwoo Choi , Sasha Levin Subject: [PATCH 5.5 191/399] PM / devfreq: Change time stats to 64-bit Date: Fri, 21 Feb 2020 08:38:36 +0100 Message-Id: <20200221072421.377625465@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072402.315346745@linuxfoundation.org> References: <20200221072402.315346745@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kamil Konieczny [ Upstream commit b76b3479dab948bea0a98b6d263eb56d8f358528 ] Change time stats counting to bigger type by using 64-bit jiffies. This will make devfreq stats code look similar to cpufreq stats and prevents overflow (for HZ = 1000 after 49.7 days). Signed-off-by: Kamil Konieczny Acked-by: Chanwoo Choi Signed-off-by: Chanwoo Choi Signed-off-by: Sasha Levin --- drivers/devfreq/devfreq.c | 14 +++++++------- include/linux/devfreq.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 07602083c743e..554d155106a5f 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -209,10 +209,10 @@ static int set_freq_table(struct devfreq *devfreq) int devfreq_update_status(struct devfreq *devfreq, unsigned long freq) { int lev, prev_lev, ret = 0; - unsigned long cur_time; + u64 cur_time; lockdep_assert_held(&devfreq->lock); - cur_time = jiffies; + cur_time = get_jiffies_64(); /* Immediately exit if previous_freq is not initialized yet. */ if (!devfreq->previous_freq) @@ -535,7 +535,7 @@ void devfreq_monitor_resume(struct devfreq *devfreq) msecs_to_jiffies(devfreq->profile->polling_ms)); out_update: - devfreq->last_stat_updated = jiffies; + devfreq->last_stat_updated = get_jiffies_64(); devfreq->stop_polling = false; if (devfreq->profile->get_cur_freq && @@ -820,7 +820,7 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->time_in_state = devm_kcalloc(&devfreq->dev, devfreq->profile->max_state, - sizeof(unsigned long), + sizeof(*devfreq->time_in_state), GFP_KERNEL); if (!devfreq->time_in_state) { mutex_unlock(&devfreq->lock); @@ -828,7 +828,7 @@ struct devfreq *devfreq_add_device(struct device *dev, goto err_devfreq; } - devfreq->last_stat_updated = jiffies; + devfreq->last_stat_updated = get_jiffies_64(); srcu_init_notifier_head(&devfreq->transition_notifier_list); @@ -1589,8 +1589,8 @@ static ssize_t trans_stat_show(struct device *dev, for (j = 0; j < max_state; j++) len += sprintf(buf + len, "%10u", devfreq->trans_table[(i * max_state) + j]); - len += sprintf(buf + len, "%10u\n", - jiffies_to_msecs(devfreq->time_in_state[i])); + len += sprintf(buf + len, "%10llu\n", (u64) + jiffies64_to_msecs(devfreq->time_in_state[i])); } len += sprintf(buf + len, "Total transition : %u\n", diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index fb376b5b72819..95816a8e3d266 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -177,8 +177,8 @@ struct devfreq { /* information for device frequency transition */ unsigned int total_trans; unsigned int *trans_table; - unsigned long *time_in_state; - unsigned long last_stat_updated; + u64 *time_in_state; + u64 last_stat_updated; struct srcu_notifier_head transition_notifier_list; -- 2.20.1