From patchwork Tue Jan 22 14:24:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 156299 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp7638356jaa; Tue, 22 Jan 2019 06:24:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN6oTeQezrAiPCuE5jP6Y3/wszhF/vDCFTRLnKsA/En0VWUszHDzUfOX+txWfIA4N0bCK9fP X-Received: by 2002:a63:ed03:: with SMTP id d3mr31842892pgi.275.1548167079035; Tue, 22 Jan 2019 06:24:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548167079; cv=none; d=google.com; s=arc-20160816; b=0TrYjNcvUwVsQk4rMW7OaTnRo3xBvte+exDeyQxAsVEkME47xfcbmprvh1BKdwPp3f 3qOcTt8oGwHcshUUUTIOhs4txEU+2UjmsWnEI9B4vJcTaEt6tj638vfHWfc6Kyb+xZYc 9R2yQluEidcWQNNnNrhoXNn0GwOnyxfbVfdWchrdqcaOULcvqVz4MsQSKdIrcxkuYg6G jGInL0x3IDHhBqbRzvZKZORz8/TbO3WmJmKbg1biXx0VYY+2QaGPgrv0oa2pz201v2hZ T4L5CEWr4wzHqhEm65m6TyMLEFs6tu7Sw4NiWXGCMRgC+O6CaKtG878Jxvq0oHTNW0uA jdpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=tWy5IgM53R5DQsaBsmPIJYPahNQhBygKg9p4mjF1rG8=; b=oyUMMPfOZph2XTvTmTqEWx2OyxOEDYXinJMNRdQgPKGMlPU6WrKidMMsARAIUcniyw MfSh+TS72Nd5Tty7KWRkj99hox9PGAmcbqkZkI9Ikn9sPg9JC/eMe0jP/s7BilhFeYNs eOatFNscYeg7F1uQvaUQH3HVLXbGEO0JhZHqqHUrp0elOMFAhdFKEwjk8q5FFksBl1ZK j7Bq2o4PHDcVxu9WgedvoL5j9pE58PHdWSawr+6hVHHcyMyAdcSfzhcqHtCr3Z7iPQpz wPLl0EAd786PFgHLVHycOUv+2M2MMMteMFfJFdFMGWKe2SGkllQePe94tSrPE2L2HFWb GIfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KvB2F9xE; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6si205104pfb.92.2019.01.22.06.24.38; Tue, 22 Jan 2019 06:24:39 -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=@linaro.org header.s=google header.b=KvB2F9xE; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728775AbfAVOYh (ORCPT + 26 others); Tue, 22 Jan 2019 09:24:37 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:35252 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728547AbfAVOYg (ORCPT ); Tue, 22 Jan 2019 09:24:36 -0500 Received: by mail-wr1-f67.google.com with SMTP id 96so27606064wrb.2 for ; Tue, 22 Jan 2019 06:24:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tWy5IgM53R5DQsaBsmPIJYPahNQhBygKg9p4mjF1rG8=; b=KvB2F9xEA8wzh3bg0/Yjx88DsEX53SxjxLv0siS3s3D3QYFUzk/9oQA4WCdHip97jv puMrJroejhPxPLcRUO5b6TyZxyzmAuE5uMhb0fYBRJeDv+kec/LyOUybzt+5BUEe+G7K VJ5LeITyVg7I1edqgNaX+2cC04XPpvMEUZJy8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tWy5IgM53R5DQsaBsmPIJYPahNQhBygKg9p4mjF1rG8=; b=ZXB4szOvUF0Tgll9dwIFTLNJ26lZe7ZuOzic6y37qZYxiIWjqB1lemSPcyREJBmZ1n W3DRj+xa08EP/0L/pRvay+IoVI8TI6F6/mfwJJUg08gkilnmRFzT1C9WEZ5YOICf5MR+ M6RA0frsOmK7yXQdlCrsp6gGMfdkW8+PmGhJmjaO/dqZUGpP8fjSoy0g301QcvUhUuw4 k6aZW7Q/yIFaPmcg6VRHoj/lngfdQc+pe5bhAzdQfrKPa7OusgY7JXUlHRIPKNG3I38n u0K9lV6abLEX5bl1dArqWKaEn3OpcwPFDAK5DAsKBa5gvjz4CAe2C03nDsaW9nKZWKJ5 i7aQ== X-Gm-Message-State: AJcUukcigJJRJXLbYDXmEBQIsm+Z4MqYgBT5OLCJ4mNqlaUbbycCOdev Nd2Qw273u7ZuFNiAwo3JaytNog== X-Received: by 2002:a5d:64c7:: with SMTP id y7mr32520873wrv.207.1548167074288; Tue, 22 Jan 2019 06:24:34 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:609f:7896:d361:50c6]) by smtp.gmail.com with ESMTPSA id l19sm52620119wme.21.2019.01.22.06.24.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Jan 2019 06:24:33 -0800 (PST) From: Vincent Guittot To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rjw@rjwysocki.net, thara.gopinath@linaro.org, linux@roeck-us.net Cc: ulf.hansson@linaro.org, Vincent Guittot Subject: [PATCH v6 1/2] PM-runtime: update accounting_timestamp only when enable Date: Tue, 22 Jan 2019 15:24:29 +0100 Message-Id: <1548167070-421-2-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548167070-421-1-git-send-email-vincent.guittot@linaro.org> References: <1548167070-421-1-git-send-email-vincent.guittot@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Initializing accounting_timestamp to something different from 0 during pm_runtime_init() doesn't make sense and put useless ordering constraint between timekeeping_init() and pm_runtime_init(). PM runtime should start accounting time only when it is enable and discard the period when disabled. Set accounting_timestamp to now when enabling PM runtime. Suggested-by: "Rafael J. Wysocki" Signed-off-by: Vincent Guittot --- drivers/base/power/runtime.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index fb5e2b6..7df1d05 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -1306,6 +1306,10 @@ void pm_runtime_enable(struct device *dev) spin_lock_irqsave(&dev->power.lock, flags); + /* About to enable runtime pm, set accounting_timestamp to now */ + if (dev->power.disable_depth == 1) + dev->power.accounting_timestamp = jiffies; + if (dev->power.disable_depth > 0) dev->power.disable_depth--; else @@ -1506,7 +1510,7 @@ void pm_runtime_init(struct device *dev) dev->power.request_pending = false; dev->power.request = RPM_REQ_NONE; dev->power.deferred_resume = false; - dev->power.accounting_timestamp = jiffies; + dev->power.accounting_timestamp = 0; INIT_WORK(&dev->power.work, pm_runtime_work); dev->power.timer_expires = 0;