Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp794348imm; Sat, 7 Jul 2018 08:55:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfG+t2gPKAY3vcvsYQITVlrsK8G+E5vY0sw3HzQYp9UuATLCC4YGq4ehmw/UGCeUZJK4s1O X-Received: by 2002:a63:1811:: with SMTP id y17-v6mr6929964pgl.356.1530978945815; Sat, 07 Jul 2018 08:55:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530978945; cv=none; d=google.com; s=arc-20160816; b=pWKNqc/uIRLvbz0uSSJ+/32v7RZoOymnorxgbjBe7OgGz6TreY/JCALOn0e8Hc1r6b 6ODAfjH1tIDjXWDysYQfdbrN62gdHVVePoma2ReyprTka6XS7DpYf/BQ6Sd3nv45Uoi0 sgnNFulZ9YsqbwRHyUJ6JFeixaVj2JBsu1ZpW1NnO1f/Xwcpa0RJJ2EpSrLMTmyX7yu0 m4Ls9Hf6lIfg8Ye2UsMaXQBN6AiRG4IFjkGrsqJ6DU21vGF67i1dRGTQtjVcl2bTlcAs wSe0Kc73ajZmNHR59WguLBsuow5I6ryMCjvdFzpHWmcZTMj2exmtevEG0lPdWQfMlfn6 7FiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=DUuDv1I0X4buCoVoDEHEZ6HsCZ/coH+Tk+E+KvkN2zo=; b=XKLDoCtcjaV3dUxz1pO6t3hyNA7EHgZ1cUBw4dOmZ9rI+99UE4b0dAxMzrnoSM3ztK NoKwgt+DUls3+XOYAslqTmJH134ST01ApmEVu45GZVe4HTL1xPPx1/hGPhUHSzCRjN0u dpZNaT9pKMS2wc3X0ObAlvNo0383ZO9D2MeNh0ziCI2VjLRKNRhQrA4kAjCpMMQ5RQeN 838ySKWBnzFnDYRaC47YXyxBGcdCLq4HQdbM4LhXsUxWjHThe7iQJIOLP6ZKN9+bgnd4 NFnGtOYP6eyXk+GjcESGvPivsX4fnMH90SewEeQWQHFxVFB/R5AyLhO2Ylnbp1Mvr0aS ZWDA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g20-v6si7631404pgb.239.2018.07.07.08.55.31; Sat, 07 Jul 2018 08:55:45 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932657AbeGGPyS (ORCPT + 99 others); Sat, 7 Jul 2018 11:54:18 -0400 Received: from mga12.intel.com ([192.55.52.136]:22224 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932352AbeGGPyR (ORCPT ); Sat, 7 Jul 2018 11:54:17 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jul 2018 08:54:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,320,1526367600"; d="scan'208";a="65143950" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by orsmga003.jf.intel.com with SMTP; 07 Jul 2018 08:54:14 -0700 Received: by lahna (sSMTP sendmail emulation); Sat, 07 Jul 2018 18:54:14 +0300 Date: Sat, 7 Jul 2018 18:54:14 +0300 From: Mika Westerberg To: Lukas Wunner Cc: linux-kernel@vger.kernel.org, Andreas Noever , Michael Jamet , Yehezkel Bernat , "Rafael J. Wysocki" , Christian Kellner , Mario Limonciello Subject: Re: [PATCH 5/5] thunderbolt: Add support for runtime PM Message-ID: <20180707155414.GQ2534@lahna.fi.intel.com> References: <20180618110731.57427-1-mika.westerberg@linux.intel.com> <20180618110731.57427-6-mika.westerberg@linux.intel.com> <20180707133815.GA6656@wunner.de> <20180707142553.GP2534@lahna.fi.intel.com> <20180707144348.GA28036@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180707144348.GA28036@wunner.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 07, 2018 at 04:43:48PM +0200, Lukas Wunner wrote: > On Sat, Jul 07, 2018 at 05:25:53PM +0300, Mika Westerberg wrote: > > On Sat, Jul 07, 2018 at 03:38:15PM +0200, Lukas Wunner wrote: > > > You're setting pm_runtime_no_callbacks() on the domain. A side effect of > > > setting this flag is that whenever the domain's device is runtime resumed, > > > it's parent (the NHI) is *not* runtime resumed, see this comment in > > > rpm_resume(): > > > > > > /* > > > * See if we can skip waking up the parent. This is safe only if > > > * power.no_callbacks is set, because otherwise we don't know whether > > > * the resume will actually succeed. > > > */ > > > > > > Above, you're runtime resuming the domain in boot_acl_show(). So if the > > > NHI is runtime suspended while that sysfs attribute is accessed, it won't > > > be runtime resumed. Is that actually what you want? > > > > No, it should be runtime resumed when domain is. Looking at the code in > > question bit more deeper: > [snip] > > So skipping waking the parent can only happen if any of the following > > conditions are true: > > > > - Parent has runtime PM disabled > > - Parent has ignore_children set > > - Parent is already resumed > > > > As far I can tell there can't be situation you describe that the parent would > > not be runtime resumed when the domain is. > > Okay, missed that. > > Then why aren't you using pm_runtime_no_callbacks() on switches as well? > Wouldn't that obviate the need to declare those empty runtime PM callbacks? Domain is a kind of object that does not have a real physical device. It is just an abstraction of a Thunderbolt domain formed by the host controller (NHI) and the connection manager. Therefore we power manage it with the parent device (NHI). This is pretty much the purpose of pm_runtime_no_callbacks(). However, switches do have a real physical device that can be power managed. Furthermore we may need to add switch specific power management logic at some point.