Received: by 2002:a25:c641:0:0:0:0:0 with SMTP id k62csp7768903ybf; Thu, 1 Aug 2019 13:25:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqytZBDzcvIG3OED2RiFJ3mt6G0thAoP6AI1bCThvzjHhyf9PHKhnePwnE9VXodyQ1ebHPw6 X-Received: by 2002:a17:90a:d814:: with SMTP id a20mr623662pjv.48.1564691156178; Thu, 01 Aug 2019 13:25:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564691156; cv=none; d=google.com; s=arc-20160816; b=Il30+rUkW3c3dsP9uAzo9XBCrrkGhXEW6+yv9ob2z7uUa9yvJdKfQzu2mYVf/em4Ix EathGmxjGKkwd3FKY45aaxL8386wSFUqpJLnLZJUojisXkE7kX841z5Jz/NzPTDoYo6B tGCeKnZQH2OI7pa5LhCAVpbSKvjb78Ib1W6/8eGbSfEjp8FdyTKW8CQtdh0CzmoLkBtE u7NycEDEo1LeZJ0B2oMswTowSiTz2w5sXGrS191rnRdCOFWkae7OF06s5OrTv2eQWc4z lQ5l59vIoJxFgEe37lnXylY6syvsMEpFfGt/cP0tA9wmuO7Tc0tia/f3qMI3qKcqkq24 ljpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:user-agent:subject:to:from:cc :references:in-reply-to:content-transfer-encoding:mime-version :message-id:dkim-signature; bh=fTIZJQikQI8w/BKVVJZ33osEkUPhfPGMi+gSFP68ip4=; b=X/HzJn+OzV1ElcmIuAxI//8ybHCr1ndNS3Gl4OSKQBbZVc9aVSUA8gICBCdOLMe+e3 RfSM9ABvhjM+OEBp9wCpcdhAmBUemd5dlzMbpszSOoIrcaBb6lWH7WnsF58G/fHxeh9A QE9nFOCNncUB44DBYxsxnoPqumQ0lxHuzhiWzkWrWmTwebIRqt5504JvT69/BnPmZ6/G y1oTlWXH0cl2aIXihqeNKnUxlQb7O8K/Bl/qUi965O+Y/iwkpCiS9j0JeOIE6zsgyOPz oYaxelCoKZucK1Nzng6kxuJ7Bp5/hBzAPqVbkWVb8E/fEoovix76NkL8aO9GEJqTadha gbrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lxWCa9qR; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y14si20441937pfr.82.2019.08.01.13.25.07; Thu, 01 Aug 2019 13:25:56 -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=@chromium.org header.s=google header.b=lxWCa9qR; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729244AbfHAUXB (ORCPT + 99 others); Thu, 1 Aug 2019 16:23:01 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33350 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726505AbfHAUXA (ORCPT ); Thu, 1 Aug 2019 16:23:00 -0400 Received: by mail-pf1-f195.google.com with SMTP id g2so34709785pfq.0 for ; Thu, 01 Aug 2019 13:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=message-id:mime-version:content-transfer-encoding:in-reply-to :references:cc:from:to:subject:user-agent:date; bh=fTIZJQikQI8w/BKVVJZ33osEkUPhfPGMi+gSFP68ip4=; b=lxWCa9qRPtHhH2oHKBdo2XyMWrk9vqfYVYeT6QPsAjlAmS0/cIk+KAOcG/75md+Br0 5dFST6qO2H9lshNgpnQ8B3ElPqmBbyqzytFI8DolFwaGRugcmEpie+aWP7RcXWEgEW+Q hGHe//H9rh8Uive6cfcspibky09EEiirl8w+Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:mime-version :content-transfer-encoding:in-reply-to:references:cc:from:to:subject :user-agent:date; bh=fTIZJQikQI8w/BKVVJZ33osEkUPhfPGMi+gSFP68ip4=; b=XvVN54ejUINUOrHIhSNncX8AWbWIXr29NDEp4XRRFVGjyWl3ytd5ttNuDhRzrAGtp5 HlnKBjm6+kxkPJJf+EYoT62Fu0NPs0Gq7BX4M12EvlgbmzFAzCbh7wcM556QOCM59o5R VaPVUOHpi31kYkfUYu1coz5n19v/vR7c5l33RoL/S24hy3nuThvNVj5VFAok+85T3lno OvIVt0Qhdz+qe2xS8daKnqld8zGd3yYLhKXwbr42tnY04mgnPTeyYJ/FhdQ9HnydAEK8 4Bmo7w2vxSxz2nV3ZvrQRYyu6TCZE2XGgMxpbyz4pzndIyBDOSt6ZjKbpGcU2gFCLI4o I9JA== X-Gm-Message-State: APjAAAUfZbxkGEMyP+GjxyR55IiL6j3A5TXucD8f9l6qsLymP7Os+TUF kQyO7ylVK6amQkhupDJUZSkQSQ== X-Received: by 2002:a63:5b52:: with SMTP id l18mr121210400pgm.21.1564690979818; Thu, 01 Aug 2019 13:22:59 -0700 (PDT) Received: from chromium.org ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id l1sm94261462pfl.9.2019.08.01.13.22.59 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 13:22:59 -0700 (PDT) Message-ID: <5d434a23.1c69fb81.c4201.c65b@mx.google.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20190731215514.212215-1-trong@android.com> <32598586.Mjd66ZhNnG@kreacher> <6987393.M0uybTKmdI@kreacher> <5d42281c.1c69fb81.bcda1.71f5@mx.google.com> Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Greg Kroah-Hartman , Viresh Kumar , Hridya Valsaraju , Sandeep Patil , Kalesh Singh , Ravi Chandra Sadineni , LKML , Linux PM , "Cc: Android Kernel" From: Stephen Boyd To: Tri Vo Subject: Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs User-Agent: alot/0.8.1 Date: Thu, 01 Aug 2019 13:22:58 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Tri Vo (2019-08-01 12:50:25) > On Wed, Jul 31, 2019 at 4:45 PM Stephen Boyd wrote: > > > > Quoting Rafael J. Wysocki (2019-07-31 16:10:38) > > > On Thu, Aug 1, 2019 at 12:59 AM Tri Vo wrote: > > > > > > > > > > > > > > So why wouldn't something like this suffice: > > > > > > > > > > dev =3D device_create_with_groups(wakeup_class, parent, MKDEV(0, = 0), ws, > > > > > wakeup_source_groups, "wakeup:%s"= , ws->name); > > > > > > > > > > ? > > > > > > > > ws->name is inherited from the device name. IIUC device names are n= ot > > > > guaranteed to be unique. So if different devices with the same name > > > > register wakeup sources, there is an error. > > > > > > OK > > > > > > So I guess the names are retained for backwards compatibility with > > > existing user space that may be using them? > > > > > > That's kind of fair enough, but having two different identification > > > schemes for wakeup sources will end up confusing. > > > > I understand your concern about the IDA now. Thanks for clarifying. > > > > How about we name the devices 'wakeupN' with the IDA when they're > > registered with a non-NULL device pointer and then name them whatever > > the name argument is when the device pointer is NULL. If we have this, > > we should be able to drop the name attribute in sysfs and figure out the > > name either by looking at the device name in /sys/class/wakeup/ if it > > isn't 'wakeupN', or follow the symlink to the device in /sys/devices/ > > and look at the parent device name there. >=20 > This makes it difficult for userspace to query the name a wakeup > source, as it now has to first figure out if a wakeup source is > associated with a device or not. The criteria for that is also > awkward, userspase has to check if directory path contains "wakeupN", > then it's a virtual wakeup source. I think you mean if it doesn't match wakeupN then it's a virtual wakeup source? >=20 > IMO it's cleaner to consistently have /sys/class/wakeup/wakeupN/name > for every wakeup source. I don't find it awkward or difficult. Just know what the name of the /sys/class/wakeup/ path is and then extract the name from there if it doesn't match wakeupN, otherwise read the 'device' symlink and run it through basename.