Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp970315ybi; Wed, 19 Jun 2019 11:02:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0ziNaCdKPGiim8+UYt/nPP8VVDDHAPbNfD2px5a8Z5ZkRYVq7tfnUANer6iwkYZwR5XfZ X-Received: by 2002:a17:90a:d595:: with SMTP id v21mr12256820pju.34.1560967332579; Wed, 19 Jun 2019 11:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560967332; cv=none; d=google.com; s=arc-20160816; b=eMdwy5RP+Gbn26T7jLg+aVkNWRB8jL/IGkGEh1L3JJ3zHTjkNB7WWR4UNj5VMDcy/0 HkcufrH3Gc4HOSd1X/UWDASfDVSRf4x4R0a/M7e0J79f/PQqosfkQ88QGhd4Q5/tejb1 mgzwCqPnqnz5JZFqRbQQEYRFlaOw2/TvoL9bpH99wAICRBkZ9+YJi0Ca8x7fTSXE2J3/ MupUXc1MEhC7A38l78BjGQaCbwrQTP1YLmsXyOkpggorFQc83olSSB+v9WpJCVij2/y9 B/0ubRt0uDSXbXKB7uxxFGqr1XnnJWnBRuOJfe25XHwn1Pgguv/AUp/3x9hRWaSpAVRm lVnQ== 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=czuVT35co/UKsceghDoTiQ4oToGLTSbKhMCQO4t0nUE=; b=m92cpGA0fEHK6xOq2ct/WAI/yrZ5oMCkjNTuIyckm/nkLs0ohfwHKfUL/vOPK8aDsV BsGItRUGEPhIJa3TtH12OOSTb3BFS1KIxhcIdV3x4kVZ5ldeTWBydDfhcCYnQMANoVG0 ki16sXXGxo+wxnhsE5Ne1UGezZ7ZXkrJ09raI6RzuV19FXEgl9iP7+kF1fHzo4RSb9GS 55GwVFDhwe+iKMDmMtM0nWop3n8EDtqJIJqt1L2HKX+vg5/Yh7pdGtg4q2mI7Ci23Uqd uLj7AkyZRjp2CxR1a7oz0GOoAqLxn7cRt4iI84msc5/PcNfVP2Hx0ag5lisH1OEIf29W CZvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=t0FlsK0r; 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=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1si3388695pgp.301.2019.06.19.11.01.54; Wed, 19 Jun 2019 11:02:12 -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=@google.com header.s=20161025 header.b=t0FlsK0r; 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=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726482AbfFSSBt (ORCPT + 99 others); Wed, 19 Jun 2019 14:01:49 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:36394 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbfFSSBt (ORCPT ); Wed, 19 Jun 2019 14:01:49 -0400 Received: by mail-qt1-f195.google.com with SMTP id p15so91460qtl.3 for ; Wed, 19 Jun 2019 11:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=czuVT35co/UKsceghDoTiQ4oToGLTSbKhMCQO4t0nUE=; b=t0FlsK0r8Bx/f9E7kd+SWF3OofIkorm0DUUph6+DeKYxZhH1U3WrRKGKsUCk/Pyopt ZCT4v3iUv9Slj1G3/LFS8XXYQScHawo96l+KvR62BUI+LZW4DW0mmeWApJs9FDNP++8I hFpVtgUjorb6GvON/zvOaNk274fAgQ610pRPN2d8a4ZKqk8kp+mg4CWTC6mpLM86PjQ8 XQAQR8lUeFq+t9e937A5exioDrUzLZyGlsUA3MmCnYYQGGAAR8l4OPQOKfPU5Y4qSyMC eK0t9B/HM1zZyai4w8BO0Uovj73EoB72CeT5TBW4CNjFngXdTBAOLDwWPhtfkUyXyZmW reXg== 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=czuVT35co/UKsceghDoTiQ4oToGLTSbKhMCQO4t0nUE=; b=l+QIlCo8o3Haw055+4wZrAW65Ae4sFf9VwD7P1swqHG9hw4dBTDw1rKO8ZvD+DGP0c xcIN6CFwjsjuWWa/0NE31bFYCbEW/nCSwdz5XI9Er5Rg252FxoJ1FEIDOXv1Z7VNjqs8 vKTuawCXAqZFNj9kJutqTEvCS6amCv/JjSzQobFKFli1hAp/tGZCqJWa2tEl9/r4xEnG s14thX/0DnMWrfwhnnsYK+1B856EeMbh3T8p9x102QZpyya9Ftl2+KY9Dz1RdDMVw7Vb d43cUbNFzdtp6Q+mhE7l46pZdfU1jzdB7Zmix0U0YhkFQ+tihjlkgNfWrSHeTSp/K5YZ Gntw== X-Gm-Message-State: APjAAAW23p+KWiaXjdyFWqrBxdDqpjSWA1cUHHhuZ+o7n/EQ0EDmhRsE pGFpLK8+ExGXlhtKdCqwLTM2e+/CIucmZwtRd2MwVg== X-Received: by 2002:ac8:1ba9:: with SMTP id z38mr18306346qtj.176.1560967308199; Wed, 19 Jun 2019 11:01:48 -0700 (PDT) MIME-Version: 1.0 References: <20190618182502.GC203031@google.com> <4587569.x9DSL43cXO@kreacher> <20190619170750.GB10107@kroah.com> In-Reply-To: <20190619170750.GB10107@kroah.com> From: Joel Fernandes Date: Wed, 19 Jun 2019 14:01:36 -0400 Message-ID: Subject: Re: Alternatives to /sys/kernel/debug/wakeup_sources To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Tri Vo , "Rafael J. Wysocki" , Sandeep Patil , Viresh Kumar , Hridya Valsaraju , Linux PM , "Cc: Android Kernel" , LKML , Alexei Starovoitov , Steven Rostedt , Alexei Starovoitov 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 Wed, Jun 19, 2019 at 1:07 PM Greg Kroah-Hartman wrote: > > On Wed, Jun 19, 2019 at 12:53:12PM -0400, Joel Fernandes wrote: > > > It is conceivable to have a "wakeup_sources" directory under > > > /sys/power/ and sysfs nodes for all wakeup sources in there. > > > > One of the "issues" with this is, now if you have say 100 wake up > > sources, with 10 entries each, then we're talking about a 1000 sysfs > > files. Each one has to be opened, and read individually. This adds > > overhead and it is more convenient to read from a single file. The > > problem is this single file is not ABI. So the question I guess is, > > how do we solve this in both an ABI friendly way while keeping the > > overhead low. > > How much overhead? Have you measured it, reading from virtual files is > fast :) I measured, and it is definitely not free. If you create and read a 1000 files and just return a string back, it can take up to 11-13 milliseconds (did not lock CPU frequencies, was just looking for average ball park). This is assuming that the counter reading is just doing that, and nothing else is being done to return the sysfs data which is probably not always true in practice. Our display pipeline deadline is around 16ms at 60Hz. Conceivably, any CPU scheduling competion reading sysfs can hurt the deadline. There's also the question of power - we definitely have spent time in the past optimizing other virtual files such as /proc/pid/smaps for this reason where it spent lots of CPU time. > And how often does this happen? Does it _need_ to happen? These are good questions and we should find out. I am not saying that sysfs will not work, I am just saying we need to consider all the things. I will let Tri look into this since he is working on it, I don't know off the top. > Parsing files is also hard, and not for sysfs files, you can't have it > both ways. I don't think we are concerned with a parsing issue here, or are discussing it in this thread. > So try it this way, and if there really is a performance issue, we can > then talk about it... Sure that sounds good to me, again I am not saying we should do sysfs. But we should consider all the issues and chose the right solution. thanks! - Joel