Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp236875ybi; Thu, 1 Aug 2019 18:07:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqw66jtWRNepOeKHATS4QGbwF4M2FDg5PkhaiCPqxX5J99FdpEEs/hOa4t8Ae9MSxKZgaaRP X-Received: by 2002:a62:3103:: with SMTP id x3mr55545371pfx.107.1564708041492; Thu, 01 Aug 2019 18:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564708041; cv=none; d=google.com; s=arc-20160816; b=fCB/jnm/AxGTR5YHIXvwnItlodoszZ/Px+q/PsNQmhx61mUfDxbo0Rn/qRbiExy2Fn K8yOIuaT7+qeYhnwaqcjdoc7w8/Y4X5gJE/LXcCSrqWtHs9FVzQb34GCVZ2fB7hzgayL ZBOnM0rMoygsqlR++3RI+tfWy9v1/eS+qy4Z1H/m46pJwKWK+Jl/tw6AFGEpEFk1QkQ+ sruGTZgSshPde2tH9CxxB/HH0HTOYiSyzgjWUNzd65plb4VG1WsDEero8uYVWGGFApJt h73qGu+rCKufYXoM0mtWw+TqYgMLsMq5+FVdofbSdcsPk07cBmKJ9z3WSaTgRhOzm7kW oJyQ== 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=2FWtSgzRD4bHrWCNNgJRr3LQVys4kFqT4AsZYk1+5PU=; b=bBCpnoPe7qQtC7BUlO7bhbIesmSSU5w1kmggtFe/Q5m1W/xGR4v/4WvKT7JfHsJgC1 k7K2hHAQxwLrT/COz0+iP5tBm5gm7wzwNTeEhqxB3nfN3o35wj+KiNT9P4tJW+suZjfN 1HfnEs8+Ic0IGkZvon++4eN1tQAwbJD4GVtwJb+QczQglnB8WxIPHFs2cpUgPYyBYfKA SIcVJyXe66yCPfWXHDftZ72y9O4OZzt8w0Lvx0FDyOLcIMtLc7JXqLWo678ip1gSFFuU p+MaLKhpZsLEJyXLnq83pL2F62Xc5DuaUhd24CvCAidOgrGqHw4FBXnGU8Z4kikMa6pD bluw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b="ui73Jo/4"; 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 n19si35705778pgh.219.2019.08.01.18.07.05; Thu, 01 Aug 2019 18:07:21 -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="ui73Jo/4"; 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 S2388769AbfHATui (ORCPT + 99 others); Thu, 1 Aug 2019 15:50:38 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:33122 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388633AbfHATui (ORCPT ); Thu, 1 Aug 2019 15:50:38 -0400 Received: by mail-oi1-f194.google.com with SMTP id u15so54965547oiv.0 for ; Thu, 01 Aug 2019 12:50:37 -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=2FWtSgzRD4bHrWCNNgJRr3LQVys4kFqT4AsZYk1+5PU=; b=ui73Jo/4/huIvxvzrGT6zAMrXY2OVPod58pVaM1xjpAa6z4vw54kNetazl/71za763 7HJ7eUOq/T5JDdsHX9DvAI4ifl22hscvfd8MKkYBtOuyG8q/1xomAP1EWo72JXODdzXv 8J7wgO/Fe5tr4w3PQqfn+qqPNpkvQbo9EljAJ9uTfXvW6fD4gKAfybd4ShFKjXt7dMh/ 8anwkXE/rca9UJQ8iDBEmt/FwuV8Nx1CYADNtUz/ZPMtdrNgyvKlmrpqUMS0KITD08jv qPmXAnmuIjHI4lV4ZlqmLYymJAAtM7ioxzNfyDVJ/WWs8a6zGKgiMNkO40APY5av+jR5 dPeg== 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=2FWtSgzRD4bHrWCNNgJRr3LQVys4kFqT4AsZYk1+5PU=; b=Xghgdl25teBfE2u8S5MAjKmB2PbFV/Q1fF5zbKBURr0xNsqvH0YQwAWOntR1DOMCGK FmJjXms4+alBJdMjtq7qG6l+cqyNZ/Ie5RbENRyZV7YK+dXXb7WtYBA/6YaXaVGhoefK 4AgbgwWb2M08dswMDTu5fN+4UntHD8Up5mvhG8He5iapMNlObpr+t4LhxykUbEkenf7N Pb684iiJHiIV2A3ds6Abh1yEX49d6YgHv6h40qStWAcRe8FGoX7vtV7aOAMhIqGxlMME PnTfoHTYaLzimzbVFJXvpIDm0Cm0mnUhxh9IzJqxqCCsg8nRlBmox0j1RZM9HGGKBF0w KOHA== X-Gm-Message-State: APjAAAXYwUxDkl4j9kV8zQPIo3LJRcLI4sMDs8SH0pnmEnW9ObjPbVsZ St9YochMgfZfxv1+H4d0V5gzRsXVbG5Cn9fnzIE= X-Received: by 2002:aca:cc8e:: with SMTP id c136mr369657oig.18.1564689037172; Thu, 01 Aug 2019 12:50:37 -0700 (PDT) MIME-Version: 1.0 References: <20190731215514.212215-1-trong@android.com> <32598586.Mjd66ZhNnG@kreacher> <6987393.M0uybTKmdI@kreacher> <5d42281c.1c69fb81.bcda1.71f5@mx.google.com> In-Reply-To: <5d42281c.1c69fb81.bcda1.71f5@mx.google.com> From: Tri Vo Date: Thu, 1 Aug 2019 12:50:25 -0700 Message-ID: Subject: Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs To: Stephen Boyd 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" 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, 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: > > > > > > On Wed, Jul 31, 2019 at 3:42 PM Rafael J. Wysocki wrote: > > > > > > > > That's not my point (see below). > > > > > > > > > > > > + if (id < 0) > > > > > > > > + return id; > > > > > > > > + ws->id = id; > > > > > > > > + > > > > > > > > + dev = device_create_with_groups(wakeup_class, parent, MKDEV(0, 0), ws, > > > > > > > > + wakeup_source_groups, "ws%d", > > > > > > > > > > > > > > I thought the name was going to still be 'wakeupN'? > > > > > > > > > > > > So can't we prefix the wakeup source name with something like "wakeup:" or similar here? > > > > > > > > > > "ws%d" here is the name in the sysfs path rather than the name of the > > > > > wakeup source. Wakeup source name is not altered in this patch. > > > > > > > > > > > > > So why wouldn't something like this suffice: > > > > > > > > dev = 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 not > > > 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. 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. IMO it's cleaner to consistently have /sys/class/wakeup/wakeupN/name for every wakeup source.