Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5265325ybi; Tue, 30 Jul 2019 17:24:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzr2rNzpO4iUbhqpNWeuUuhDxAdRd5DpOuJAf9+N99QyJ76p/3UrvT4X9YYLRD+q66NdUbN X-Received: by 2002:a17:90a:4f0e:: with SMTP id p14mr86831pjh.40.1564532643757; Tue, 30 Jul 2019 17:24:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564532643; cv=none; d=google.com; s=arc-20160816; b=J8/O99ZNLYT+Joagabr2uPD1HjHe555wz433kWsLJe6ssVAm4hqmR/YZU/XC/xnYo+ hF+MLuwO5xvaXqQLSERoZ1pVKg+QW23GhjbRmF/GEo0T08dl6SuQaYkpBvx0A6XSr2Pz qktklKrNfs+SSJFgbunZIumh4+IDbPlHXE5qzdJnUR4XX5ObZlkWXax/sTH3zdlAvyVk y5Xk6u4posZVkLLPnR8h92ZlZfafQJoXHaKNZUid1bg3E7LezqWm4cPVCijjJzvg9nVz 3eiFcv+agq5+SUlkwcJKSqL12EAkiRo9FscP0um/7bUVrvylS1NinIyJmHzLXLSrwyn8 1vqQ== 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=C1ucMuWkvECgHfJc7Um+akVfVauMdXRgWlIE/s+6MMs=; b=e8SPkMBAIX19YLzGonPI3igczKHVgZCs/WbsmCSeWOx4qRlWHS7d+g3pZ5U7JWduaS cK2VB/PZn/dCeEd4NiGI3IdELE427oU2c3FMAj/0xPxkHzyMgSKXp0Q0zJdMHqbYv0nd sM1iNgxIgVFR41J1OHzJmeB8EM04LbCit2QxlToCmpy+88ngkGpL5GGXmA0l4zYuAyMy 4MoKsN2vG47vkaXn8p88SAqUQ9l09j2/yfk9htU7szeE0PjC/mEcyiKK88OjTY93EOzt JogSsTI0+YDNwqK3DzSntuDfpfRwULmmzt/Ga/D/dzXGQFLvToIUllt3LVBrFNBgntf0 N4KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=P0noKexj; 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 j185si30643678pge.91.2019.07.30.17.23.48; Tue, 30 Jul 2019 17:24:03 -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=P0noKexj; 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 S1727165AbfG3XcL (ORCPT + 99 others); Tue, 30 Jul 2019 19:32:11 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:45067 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbfG3XcL (ORCPT ); Tue, 30 Jul 2019 19:32:11 -0400 Received: by mail-oi1-f193.google.com with SMTP id m206so49244777oib.12 for ; Tue, 30 Jul 2019 16:32:10 -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=C1ucMuWkvECgHfJc7Um+akVfVauMdXRgWlIE/s+6MMs=; b=P0noKexjpK3gtxTHPZ3M5T8JI5TxmLDyGAn5SEA+GHFyIk4IWl4ufsYeqPIoTrWp1E KTzMtmlKDhxbNF2afKOJhSKTysNNo17+iuT5ycT2GIzKeqJkcQDIoipfzf/5g+ti0I/8 J0vl0CDycPFlohX0mzXfQikPh+e8aAQA9FcjXltnOgM+Teqc++jSbcS1KgIiQzb0gwW+ AVoazMOZYrpIEF1Bw1vn8+1Lal/xg3ZHML2FZVYk6ZVLBpJyqJbXqPXDpasOTxv79KrR z8S/1uu/q7pcIdTSpiLuWM6uOTcaZF+htYA1qCADLsI+aQ7aHjATfX4jBLGkujko4oRL ueIw== 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=C1ucMuWkvECgHfJc7Um+akVfVauMdXRgWlIE/s+6MMs=; b=B4tm822rJWMF0C65GmXQEsEJO65e8Mm9L7qSfKthaVtM5rBRZ9x4xdEy4PbhT9hUWe 0UIvpMDTnqSCSney9m5BHO4DnvIz0TqQpZUxVAOms6d9y/oqeZ6C+V2Mhz50Vt2E7ZSo gZqpVtl9nwYp3T1hY+wJkoRbVK4CLqgsjJFi8+cCHmrybE/m+VHy2SRMIFd6o5VOX/DX clzJM/+Gk2Z0z6VKBxZbQJxpKdazcMOoCbJwtiW2yl+kxcVbK2EqFw9lLWkT6Es/wOXZ 0JjhtH5X96ytAiyBQyId6KHUJi7zkyxHs09Z/TCtACJwUavQTlaZMMFzRHqQh51/k+IA nw5g== X-Gm-Message-State: APjAAAUXw+RA35YBcsiriDmqse2jZGq1yE8x3hCTkTucBMnshsX52ceA 5Uk2n5lAiKYfTWKEmXb1Ipuf8NEA8fj0WNIn588= X-Received: by 2002:aca:3509:: with SMTP id c9mr61001740oia.179.1564529530082; Tue, 30 Jul 2019 16:32:10 -0700 (PDT) MIME-Version: 1.0 References: <20190730024309.233728-1-trong@android.com> <5d4090ea.1c69fb81.d5cab.4dcd@mx.google.com> <2085893.cJkfNvi94x@kreacher> <5d40c41f.1c69fb81.ac63f.947f@mx.google.com> In-Reply-To: From: Tri Vo Date: Tue, 30 Jul 2019 16:31:59 -0700 Message-ID: Subject: Re: [PATCH v5] PM / wakeup: show wakeup sources stats in sysfs To: "Rafael J. Wysocki" Cc: Stephen Boyd , "Rafael J. Wysocki" , Greg Kroah-Hartman , Viresh Kumar , Hridya Valsaraju , Sandeep Patil , Kalesh Singh , Ravi Chandra Sadineni , Linux Kernel Mailing List , Linux PM , "Cc: Android Kernel" , kbuild test robot 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 Tue, Jul 30, 2019 at 4:06 PM Rafael J. Wysocki wrote: > > On Wed, Jul 31, 2019 at 12:26 AM Stephen Boyd wrote: > > > > Quoting Rafael J. Wysocki (2019-07-30 15:17:55) > > > On Tuesday, July 30, 2019 8:48:09 PM CEST Stephen Boyd wrote: > > > > Quoting Tri Vo (2019-07-30 11:39:34) > > > > > On Mon, Jul 29, 2019 at 10:46 PM Rafael J. Wysocki wrote: > > > > > > > > > > > > On Tue, Jul 30, 2019 at 4:45 AM Tri Vo wrote: > > > > > > > - Device registering the wakeup source is now the parent of the wakeup source. > > > > > > > Updated wakeup_source_register()'s signature and its callers accordingly. > > > > > > > > > > > > And I really don't like these changes. Especially having "wakeup" > > > > > > twice in the path. > > > > > > > > > > I can trim it down to /sys/class/wakeup//. Does that sound good? > > > > > > > > Using the same prefix for the class and the device name is quite common. > > > > For example, see the input, regulator, tty, tpm, remoteproc, hwmon, > > > > extcon classes. I'd prefer it was left as /sys/class/wakeup/wakeupN. The > > > > class name could be changed to wakeup_source perhaps (i.e. > > > > /sys/class/wakeup_source/wakeupN)? > > > > > > Alternatively /sys/class/wakeup/wsN > > > > > > > Or /sys/class/wakeup/eventN? It's your bikeshed to paint. > > So actually the underlying problem here is that device_wakeup_enable() > tries to register a wakeup source and then attach it to the device to > avoid calling possibly sleeping functions under a spinlock. > > However, it should be possible to call wakeup_source_create(name) > first, then attach the wakeup source to the device (after checking for > presence), and then invoke wakeup_source_add() (after dropping the > lock). If the wakeup source virtual device registration is done in > wakeup_source_add(), that should avoid the problem altogether without > having to introduce extra complexity. This addresses the issue with device_wakeup_enable(), but IIUC we still have the general problem of multiple devices having the same name, which leads to name collisions when identifying wakeup sources with the name only.