Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4778885ybi; Mon, 15 Jul 2019 14:49:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwglCHK/tUFSQGcmHFoZFMKfKtKvEWJY9m4iemPQan4A1a9UaHxg2lCaWRYHW7MMHTZaRqC X-Received: by 2002:a63:6ecf:: with SMTP id j198mr29029326pgc.437.1563227342655; Mon, 15 Jul 2019 14:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563227342; cv=none; d=google.com; s=arc-20160816; b=GgnDI+uyyur8dJLCNukyz55OwUHKS5T5MlRJzjtkrnNT1DH+A9kvuAkjUTNMHbXeX/ NZrmBD5rHamPmdOSgv/6RfdrnWEmXh39qgzMKYtac5v1mub6HH9m8l6ZJwFS5SQ5fyQ3 y8ZwZsEZtEsshfjPy/TRGlar1IurHR6Hr2yaR/UqyNN84L3BrinwUgMQ+isaCkWx4m+W yLMn/KoGCqscSXLFctwt0sDLFYEIiXgN9HfCcGSiZz/zV8GXIipuhSXT0gM1puJClZrT uc4JMrERYgPm4ZFSlZvLmbvY+JH4H4xdLevbeWiUShA/CmqY1e8bw7u7hRkYrWWLDqAd n50A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=I6e7DRMuQdVok4h9s3bFzY/fVAesWrHCG++TXs3wwJc=; b=DRBl+0RWP/AfIHJo9o/LibuywUzCM/X3i9W5aAP0Kgbk2XRi7LXW4b+H754DRNB9yk 23c/aH9utZp/MKs8Zw8QymiFPNjDiUMc9wtPU6/6pUx2fkPJgAFr86Y9Xu8/FTzzxRb9 cw6tIWQCPOfwr9r88xrKqmEC0a4joSlhf1A3KRQhyLGDY9EAf8cyZw9wTYQrb+NHm3pT b1JIC30sh89LnceglL5vwJcblvsVmyvJDOoliFhmbkhorajAlFHMiggmY4VUEz8p2OQ0 qt5S3g5G/MyIGcf/PwjdEbHhkAonghUaH/q/urcOiqW48Uc7bq6ZaAokKFG2KtoUaGtu E+/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b="b+RfaTs/"; 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=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q19si15924287pgv.31.2019.07.15.14.48.46; Mon, 15 Jul 2019 14:49:02 -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; dkim=pass header.i=@android.com header.s=20161025 header.b="b+RfaTs/"; 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=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732227AbfGOVsZ (ORCPT + 99 others); Mon, 15 Jul 2019 17:48:25 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:45513 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730467AbfGOVsZ (ORCPT ); Mon, 15 Jul 2019 17:48:25 -0400 Received: by mail-oi1-f196.google.com with SMTP id m206so13891765oib.12 for ; Mon, 15 Jul 2019 14:48:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I6e7DRMuQdVok4h9s3bFzY/fVAesWrHCG++TXs3wwJc=; b=b+RfaTs//kWIhveDSusgI4qjyvX0eUrbNXorBAg27bcO9UpmJ4T2qDep9avaJUwfT0 kDsl4ZumaPNqw0I4YBrS5IYFs7EQ0wuzE7vNuHJlS2uF7TGlPuB637tG1TeAWyIvfr0c pgoY6TuZDTvWTjE1RXRX7i/OB/omeFq2khiE7Md2ZgKF/7ZpBpZMXp5f696nB/um3kHH smsCwp1vvsLFB+dxz3LlQoeg9++1+xgff51PUlsDp7OLXqD9qfRSTgIYtx5ahOx6/qqe 8VBAMiFgtbMey8lFx4HCeQ0hOruTIX4l1lqLgEQnNkJS3n3AqxsHc/mPiYs51Bi45pnb 2T9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I6e7DRMuQdVok4h9s3bFzY/fVAesWrHCG++TXs3wwJc=; b=nh7aJF0IYh81wIqaQDyim+OtIz2At1APWZAbPZpPCzzh3uMTS+5bzggOnYW9q4J7XW /0gf/aCne1lh+faZ4RWUcrnevZytEBYyhv7fblHiPmHT6G1bHdcaBJ08wlmllcrpjpF/ ZuzXORyumgsIWwCctZlXCsQkwbCCAcAUMAZxiiliCbGTmF2zVeOTNyeTHCt4Rl6xGFAL Uji4RoU2qgePJgk6TjoWTGk89NEPFToODQcRIxxVtteAac+UwFU9du0O+ZdYffi3SHrS iqWDFM7NCY7dRAZ8xu4EqLQd3NWL1e2o+2x3KjmR8B3yyatMMbEqtPq6o76agydp8vHz bJig== X-Gm-Message-State: APjAAAWqwcGbOAOxVCfvdDSS9vW7BXcR5TPnjkZV8koiCNkfdA7fTcQt qQaMt/Odi4evRIkdPrFRWR04pw2L64mjwQWYfB0= X-Received: by 2002:aca:3509:: with SMTP id c9mr15286738oia.179.1563227304035; Mon, 15 Jul 2019 14:48:24 -0700 (PDT) MIME-Version: 1.0 References: <20190715201116.221078-1-trong@android.com> <20190715203651.GA7513@kroah.com> In-Reply-To: <20190715203651.GA7513@kroah.com> From: Tri Vo Date: Mon, 15 Jul 2019 14:48:13 -0700 Message-ID: Subject: Re: [PATCH v3] PM / wakeup: show wakeup sources stats in sysfs To: Greg KH Cc: "Rafael J. Wysocki" , Viresh Kumar , "Rafael J. Wysocki" , Hridya Valsaraju , Sandeep Patil , kaleshsingh@google.com, LKML , Linux PM , "Cc: Android Kernel" 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 On Mon, Jul 15, 2019 at 1:37 PM Greg KH wrote: > > On Mon, Jul 15, 2019 at 01:11:16PM -0700, Tri Vo wrote: > > Userspace can use wakeup_sources debugfs node to plot history of suspend > > blocking wakeup sources over device's boot cycle. This information can > > then be used (1) for power-specific bug reporting and (2) towards > > attributing battery consumption to specific processes over a period of > > time. > > > > However, debugfs doesn't have stable ABI. For this reason, create a > > 'struct device' to expose wakeup sources statistics in sysfs under > > /sys/class/wakeup//. > > > > Introduce CONFIG_PM_SLEEP_STATS that enables/disables showing wakeup > > source statistics in sysfs. > > > > Suggested-by: Greg Kroah-Hartman > > Signed-off-by: Tri Vo > > Tested-by: Tri Vo > > Co-Developed-by: Greg Kroah-Hartman > perhaps given that I rewrote the whole file last time? :) Thanks again for the help! > > > > --- > > Documentation/ABI/testing/sysfs-power | 73 ++++++++++++- > > drivers/base/power/Makefile | 1 + > > drivers/base/power/wakeup.c | 12 ++- > > drivers/base/power/wakeup_stats.c | 148 ++++++++++++++++++++++++++ > > include/linux/pm_wakeup.h | 19 ++++ > > kernel/power/Kconfig | 10 ++ > > kernel/power/wakelock.c | 10 ++ > > 7 files changed, 270 insertions(+), 3 deletions(-) > > create mode 100644 drivers/base/power/wakeup_stats.c > > What changed from v2? :) Oops, my bad. > And I am guessing that you actually tested this all out, and it works > for you? Yes, I played around with wakelocks to make sure that wakeup source stats are added/updated/removed as expected. > Have you changed Android userspace to use the new api with no > problems? Kalesh helped me test this patch (added him in Tested-by: field in latest patch version). We haven't tested beyond booting and manual inspection on android devices. Android userspace changes should be fairly trivial though.