Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1156913ybl; Wed, 14 Aug 2019 11:39:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxAtkyNrvLQgxfK3Bs10l6oMw/XDXyb6EoKjOkX7okCilEzFGHRJvCyRcKX/kvgrnQRKZo X-Received: by 2002:a63:6f8f:: with SMTP id k137mr499899pgc.90.1565807990642; Wed, 14 Aug 2019 11:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565807990; cv=none; d=google.com; s=arc-20160816; b=vhckR66/WYEd9ohAAmNqda27RjFS+VFZjnmKP9HKzX4POYreBsySoP+aru64smgk+U jflQXJkw/kFbQvTKwaa0PN4/LR0iHYhszlZyCx/JNH/kAPuF+1eHl0oFaJKqnYYA88Cm F11DoUMt/GzG/MmRv98nwjCWKc/4nanuTuDT+fudM95yISsEEYidNMYn7Pa79K5fhT7z Sd9bLA+2d5E00qon5f0PhR5gcKbbggzYkWeMx304WaQwOkXiYyJplX1bei/95MFM8IXs nMBxf/evR9uipSiMRyj1TAXw2LXjyPdtAvFsjrBsiukgx6CH5Ta5pL9gwafRfAEgASxZ otuw== 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=n1ZhkxlA5RiuxtYaWeDgg6qWaM8JmbM5adPrEVLQCaY=; b=XJKhwZTBmDqq5CYhxlqQpSdCeDbaMzeST1I/RuhAvJVk0Y+HKYnXtOuujiXXONSMft 4yuSmTvPNVE4IYy5B2plgmtgN6eUlBAiN7laV8vas/RQk6dMi7zZt16rSNCri9c3vfIi esYfg9dMbkk2DMRRpAgZ6OGqOfwlbJnNvM/jE3ZofNmIAX3Rl68zH0BvnvigWO8LqX3a efEFsrxk+9Ml4PekzckrYFj4/nSI5YR/Yt0yW8EZqdgHzeEU5gzSHyWNpv39uFbguamG rfXS3hWow1Nlk6OG3kw3tcVDuKd/RHX9PxzmwsFhzAB+Z63H9ZJ6xOmuhApYFdpgGiIh 5o/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=mHFrTUKi; 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 c7si329022pjn.50.2019.08.14.11.39.34; Wed, 14 Aug 2019 11:39:50 -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=mHFrTUKi; 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 S1728919AbfHNShS (ORCPT + 99 others); Wed, 14 Aug 2019 14:37:18 -0400 Received: from mail-ot1-f48.google.com ([209.85.210.48]:37970 "EHLO mail-ot1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728349AbfHNShR (ORCPT ); Wed, 14 Aug 2019 14:37:17 -0400 Received: by mail-ot1-f48.google.com with SMTP id r20so297388ota.5 for ; Wed, 14 Aug 2019 11:37:17 -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=n1ZhkxlA5RiuxtYaWeDgg6qWaM8JmbM5adPrEVLQCaY=; b=mHFrTUKiPm4qyuo740JkJ7NzrjP6aZ05fw+cbk/S1SH/Xp8XRyb4Qr6JMvEHaqDpeb 6k0m7zmpxIeHgqZ05hZyX5ciFz3Y1cfCb9EcgczR9hd2ZlCgcrE0EooCzT9ib+3XuG7D /hH9E0TM8qOyoW8OcZ+td0oBasB3IvuTybxtCcqufMHMhsFCL7bEy0eHDHp1PCBL7xKk kDsDdv+NHXzgr/G0Ue7HQpILnjPycMftf8nGNwLT0wie+5+X3GoK7WnnKmLXnKrecD32 xVSfVhk0jJPLfG/CcjPSVLRxanongInZpzdKxAc6s1lKXNoimCvL6qIIguTYZ+5AxMW0 hVfA== 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=n1ZhkxlA5RiuxtYaWeDgg6qWaM8JmbM5adPrEVLQCaY=; b=M/2Z/PyS3VtIj0djC/u7aSbxcXJGV4bpJyUDxnkHqTMx/6Ug0vNdJJiJXa0AACzzVl 1Z44xDVjlmcqb+NEl7/SKAgdIW/oT421Mj2IGSe2ovP21qY0OhCobwHMSmuLSKgkuZGm eDzj+Zu3Orl4RnCF63AV+uMtaztJ3YE5jwTgaGRoGqD3g70BCPjPckw2m8P2FrvwQ89G VXxJDd9Vol7mX9B7/EuBX0AGS9CC4UkM+MOOCdXhPXBhAnZuhREdbZjNLfb31mDLP6sJ Ohrer94/SNyR0y6ISSgj+JFEfxW7d+MniBwwV/o7M0tKgA/XC0qSmipv4Syjg/X6ZP3W iw/w== X-Gm-Message-State: APjAAAVA+UxpYKOazGdQ9by1QmivTeXWK3XPbj81CBUf3DV8TLa7VD9w rha1zhQ3q4doyzP44K8QsQ7R7N76/7b2iOdRweCkuQ== X-Received: by 2002:a05:6830:13d9:: with SMTP id e25mr411557otq.197.1565807836826; Wed, 14 Aug 2019 11:37:16 -0700 (PDT) MIME-Version: 1.0 References: <1565731976.8572.16.camel@lca.pw> <5d53b238.1c69fb81.d3cd3.cd53@mx.google.com> <20190814084014.GB52127@atomide.com> In-Reply-To: <20190814084014.GB52127@atomide.com> From: Tri Vo Date: Wed, 14 Aug 2019 11:37:05 -0700 Message-ID: Subject: Re: "PM / wakeup: Show wakeup sources stats in sysfs" causes boot warnings To: Tony Lindgren Cc: Stephen Boyd , Qian Cai , Dmitry Torokhov , Peter Zijlstra , Greg Kroah-Hartman , "Rafael J. Wysocki" , Linux PM , LKML 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, Aug 14, 2019 at 1:40 AM Tony Lindgren wrote: > > * Stephen Boyd [691231 23:00]: > > I also notice that device_set_wakeup_capable() has a check to see if the > > device is registered yet and it skips creating sysfs entries for the > > device if it isn't created in sysfs yet. Why? Just so it can be called > > before the device is created? I guess the same logic is handled by > > dpm_sysfs_add() if the device is registered after calling > > device_set_wakeup_*(). > > Hmm just guessing.. It's maybe because drivers can enable and disable > the wakeup capability at any point for example like driver/net drivers > do based on WOL etc? > > > There's two approaches I see: > > > > 1) Do a similar check for device_set_wakeup_enable() and skip > > adding the wakeup class until dpm_sysfs_add(). > > > > 2) Find each case where this happens and only call wakeup APIs > > on the device after the device is added. > > > > I guess it's better to let devices have wakeup modified on them before > > they're registered with the device core? > > I think we should at least initially handle case #1 above as multiple > places otherwise seem to break. Then maybe we could add a warning to > help fix all the #2 cases if needed? Makes sense. For case#1, we could also just register the wakeup source without specifying the parent device if the latter hasn't been registered yet. Userspace won't be able to associate a wakeup source to the parent device. But I think it's a reasonable fix, assuming we want to fix devices not being added before calling wakeup APIs #2.