Message ID | 20240212063233.5599-1-raag.jadav@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-61119-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2336508dyd; Mon, 12 Feb 2024 02:10:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXYkcWf5MpKRxgdnvTH+ClDZ88QfRDkiVQzC1N3qMusTCJ08lbFD5Pt+K4pdnm1QvF/Rpt3/Iz/F6N58ebqg4D3kK78fA== X-Google-Smtp-Source: AGHT+IE6IS0U3gaHTJUQpyRSAtja7espTgZb/HJZrtxn3kkK05MQ/cQjo7/GibyXV69A888nUg8w X-Received: by 2002:a25:e0c5:0:b0:dc2:547f:27a2 with SMTP id x188-20020a25e0c5000000b00dc2547f27a2mr4883432ybg.50.1707732614918; Mon, 12 Feb 2024 02:10:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707732614; cv=pass; d=google.com; s=arc-20160816; b=EGXkFGsTUOMi8h2BQTwKO61txsC2uPjjX9WP/aNVOMzf1gia7ISJLBWhZ5hvSkgRf0 BFVFJZZ10bMwdjLhhLl9L/3WXs9AafQRszccR8uSxOXlpxBKtsYZL/c+15jib97yUQ2j HVktpL7XtQbBSehjpHGXLHk5PUFUz73LoX4nDU7OSqC+wycCzEWRZC86W+sGYR7Gad4Y IwjbciK9EvMC6PAGutMuAn2d69qT6OJip5UnMqKrWxkl3Da4vEh3SStZKJxO8kp+JXh1 t6rowjnNZrB1XZNkt54Amm7dS8ETmh+wjTWwCXeSQMvPyrhA5cx4n1YC1bWnRYKpkaZ4 hfjA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=KhvZMxAwi/Nw57syHx49fBIb/QN5OuARUtRvir17eRU=; fh=QfsymY/EDFA2CnmQ6gpH7zgTUUrkli1qg45OrkIMglM=; b=tDY+hjJf+k9sQQQiQ14a6J0lWBG8TM6rhyHalBF6oPHFCQmuFQjOFxDKAlBrAZfBB8 eRN0/nmk6TTwnh4iUJogUZl9CfFTbgS9Axsz2um9Ebbbh+Oq0FKGM65y59pmZ0APhiI3 6cgRQlt1W7Xrl5Hjg2UPJxQgPwYgqfiywJ84eCf3bbeTSp18AaqZQgE08vKBkCdrS5XS 16MiG7E/1D38jjpXaEXcukWmWHDdpgAA1WPNDAVqCrXJa70h6MSzLzX3oUcpZyWQxW82 7yQ62Vjfb48bKitnVOwP3bgpBazxmzmhZjHmVUZLttNLXfY2DC+MVH/97kq6+6sK4Npo GIdQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KeZ6oAxh; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-61119-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61119-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVQDczMpPXgRbCbnDfpUlJdoSEt9XKOti1H3GsHrcnayY2TlP8wZzQvX+slgwteBbx5bF2vKeErr2ooMxFCJxZy4o3HOw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r21-20020a05620a299500b00785d645980dsi2191308qkp.496.2024.02.12.02.10.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 02:10:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61119-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KeZ6oAxh; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-61119-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61119-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 604251C224A6 for <ouuuleilei@gmail.com>; Mon, 12 Feb 2024 06:33:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58F9A79D0; Mon, 12 Feb 2024 06:32:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KeZ6oAxh" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C74AF1876; Mon, 12 Feb 2024 06:32:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707719565; cv=none; b=f8nqdqzXdnynHaKnNrPoFZbYBTXMnzZ2E888e5chuimPgjgKDpByNQdKfNefY42xqve98BknC7529bQIGlMtQontq/fjDpQ6jbIEMBnrPY2v+Wk8oyrjVEvkMtc1DllUWNGbhCqlt5nlgJVQ8Sosm2t/N10JgaPXe3bMSU0Qgh4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707719565; c=relaxed/simple; bh=WtENbaXqtArIZ1h/ul86KKlsUh8sF5NCgydYyrUusME=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=icVHeoPGZGiRuz1UhSqnuzo1YwDa0h/FR2aFLqlE5wDkoTcG0CRJzJMFUUjJHi73J3wWWRSY2Vj+MmUB5nWQSaOTTCp9ZiIvdWzsIw/SGTvnbvvojDYgB23ljYlKnT47iLZxlujrPDyDYu4zH4lNWFfFRpk1paJB/LaLfqIrADU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KeZ6oAxh; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707719564; x=1739255564; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=WtENbaXqtArIZ1h/ul86KKlsUh8sF5NCgydYyrUusME=; b=KeZ6oAxh/OFsHP3Hpk3UKglRsnIl0Aq+h/ANK0HNVQ7YfO8i3BZiiqv0 KF8inZLt9ZeeeJPMVJpC41yuA/ik4WnjGrTR575psTLTSAbV/vA3Klykm eyJ+uVGlh3ABwyjugCl3pS5gmwJr64QdChhifDPDG9zZTSWWD3ORVfaOL p+zi/AVHITwMQUxiF4lcOwdk+hoSSX2vKSCN8/COdkCGLh0n3HITgpb9d q46HPILfwtfZd7jDbYix/5SbCRKzwDcUrTtDtR4YJR/NzIpJWvttufZso HZHprdb3Db9vr4bBP/lhT5mrhNHgSehhwXm4w966oCObMWWZI4p8ihi/V Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10981"; a="1538558" X-IronPort-AV: E=Sophos;i="6.05,262,1701158400"; d="scan'208";a="1538558" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2024 22:32:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,262,1701158400"; d="scan'208";a="2897133" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by orviesa008.jf.intel.com with ESMTP; 11 Feb 2024 22:32:41 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 882D01CAEA; Mon, 12 Feb 2024 12:02:39 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 837061600100; Mon, 12 Feb 2024 12:02:39 +0530 (IST) From: Raag Jadav <raag.jadav@intel.com> To: bhelgaas@google.com, jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, stanislaw.gruszka@linux.intel.com, lukas@wunner.de, rafael@kernel.org, ilpo.jarvinen@linux.intel.com Cc: linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, sashal@kernel.org, Raag Jadav <raag.jadav@intel.com> Subject: [PATCH v1] PCI / PM: Really allow runtime PM without callback functions Date: Mon, 12 Feb 2024 12:02:33 +0530 Message-Id: <20240212063233.5599-1-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790687434161810388 X-GMAIL-MSGID: 1790687434161810388 |
Series |
[v1] PCI / PM: Really allow runtime PM without callback functions
|
|
Commit Message
Raag Jadav
Feb. 12, 2024, 6:32 a.m. UTC
Commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions") tried to eliminate the need for runtime PM callbacks by modifying pci_pm_runtime_suspend() and pci_pm_runtime_resume(), but didn't modify pci_pm_runtime_idle() with relevant changes, which still returns -ENOSYS if the driver supplies no runtime PM callbacks. Fix this by modifying pci_pm_runtime_idle() such that it allows PCI device power state transitions without runtime PM callbacks. 0) | pm_runtime_work() { 0) | rpm_idle() { 0) | rpm_check_suspend_allowed() { 0) 1.500 us | __dev_pm_qos_resume_latency(); /* = 0x7fffffff */ 0) 4.840 us | } /* rpm_check_suspend_allowed = 0x0 */ 0) 1.550 us | __rpm_get_callback(); /* = 0xffffffffb4bc84f0 */ 0) 1.800 us | pci_pm_runtime_idle(); /* = -38 */ 0) + 17.070 us | } /* rpm_idle = -38 */ 0) + 22.450 us | } /* pm_runtime_work = -38 */ Debugged-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Raag Jadav <raag.jadav@intel.com> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> --- This is not marked for linux-stable for the need of extensive testing and can be backported after a few releases if no issues are reported. drivers/pci/pci-driver.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Comments
On Mon, Feb 12, 2024 at 7:32 AM Raag Jadav <raag.jadav@intel.com> wrote: > > Commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback > functions") tried to eliminate the need for runtime PM callbacks > by modifying pci_pm_runtime_suspend() and pci_pm_runtime_resume(), > but didn't modify pci_pm_runtime_idle() with relevant changes, which > still returns -ENOSYS if the driver supplies no runtime PM callbacks. > > Fix this by modifying pci_pm_runtime_idle() such that it allows PCI > device power state transitions without runtime PM callbacks. > > 0) | pm_runtime_work() { > 0) | rpm_idle() { > 0) | rpm_check_suspend_allowed() { > 0) 1.500 us | __dev_pm_qos_resume_latency(); /* = 0x7fffffff */ > 0) 4.840 us | } /* rpm_check_suspend_allowed = 0x0 */ > 0) 1.550 us | __rpm_get_callback(); /* = 0xffffffffb4bc84f0 */ > 0) 1.800 us | pci_pm_runtime_idle(); /* = -38 */ > 0) + 17.070 us | } /* rpm_idle = -38 */ > 0) + 22.450 us | } /* pm_runtime_work = -38 */ > > Debugged-by: Mika Westerberg <mika.westerberg@linux.intel.com> > Signed-off-by: Raag Jadav <raag.jadav@intel.com> > Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org> > --- > > This is not marked for linux-stable for the need of extensive testing > and can be backported after a few releases if no issues are reported. > > drivers/pci/pci-driver.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c > index 51ec9e7e784f..bb7f6775b350 100644 > --- a/drivers/pci/pci-driver.c > +++ b/drivers/pci/pci-driver.c > @@ -1382,10 +1382,7 @@ static int pci_pm_runtime_idle(struct device *dev) > if (!pci_dev->driver) > return 0; > > - if (!pm) > - return -ENOSYS; > - > - if (pm->runtime_idle) > + if (pm && pm->runtime_idle) > return pm->runtime_idle(dev); > > return 0; > -- > 2.35.3 > >
On Mon, Feb 12, 2024 at 12:02:33PM +0530, Raag Jadav wrote: > Commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback > functions") tried to eliminate the need for runtime PM callbacks > by modifying pci_pm_runtime_suspend() and pci_pm_runtime_resume(), > but didn't modify pci_pm_runtime_idle() with relevant changes, which > still returns -ENOSYS if the driver supplies no runtime PM callbacks. > > Fix this by modifying pci_pm_runtime_idle() such that it allows PCI > device power state transitions without runtime PM callbacks. > > 0) | pm_runtime_work() { > 0) | rpm_idle() { > 0) | rpm_check_suspend_allowed() { > 0) 1.500 us | __dev_pm_qos_resume_latency(); /* = 0x7fffffff */ > 0) 4.840 us | } /* rpm_check_suspend_allowed = 0x0 */ > 0) 1.550 us | __rpm_get_callback(); /* = 0xffffffffb4bc84f0 */ > 0) 1.800 us | pci_pm_runtime_idle(); /* = -38 */ > 0) + 17.070 us | } /* rpm_idle = -38 */ > 0) + 22.450 us | } /* pm_runtime_work = -38 */ What is this timing information telling me? > Debugged-by: Mika Westerberg <mika.westerberg@linux.intel.com> Sounds like this resolves a problem report? Is there a URL we can cite? If not, at least a mention of what the user-visible problem is? From the c5eb1190074c commit log, it sounds like maybe this allows devices to be autosuspended when they previously could not be? Possibly this should have "Fixes: c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions")" since it sounds like it goes with it? > Signed-off-by: Raag Jadav <raag.jadav@intel.com> > Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> > --- > > This is not marked for linux-stable for the need of extensive testing > and can be backported after a few releases if no issues are reported. If you think this should not get backported to stable, you'll have to watch the backports to prevent it. Lots of stuff gets auto-backported even though not explicitly marked for stable. This comment won't prevent it (and won't even appear in the commit log). > drivers/pci/pci-driver.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c > index 51ec9e7e784f..bb7f6775b350 100644 > --- a/drivers/pci/pci-driver.c > +++ b/drivers/pci/pci-driver.c > @@ -1382,10 +1382,7 @@ static int pci_pm_runtime_idle(struct device *dev) > if (!pci_dev->driver) > return 0; > > - if (!pm) > - return -ENOSYS; > - > - if (pm->runtime_idle) > + if (pm && pm->runtime_idle) > return pm->runtime_idle(dev); > > return 0; > -- > 2.35.3 >
Hi On 2/13/24 22:06, Bjorn Helgaas wrote: >> Debugged-by: Mika Westerberg <mika.westerberg@linux.intel.com> > > Sounds like this resolves a problem report? Is there a URL we can > cite? If not, at least a mention of what the user-visible problem is? > > From the c5eb1190074c commit log, it sounds like maybe this allows > devices to be autosuspended when they previously could not be? > > Possibly this should have "Fixes: c5eb1190074c ("PCI / PM: Allow > runtime PM without callback functions")" since it sounds like it goes > with it? > I don't think there's known regression but my above commit wasn't complete. Autosuspending works without runtime PM callback as long as the driver has the PM callbacks structure set. For example the drivers/i2c/busses/i2c-i801.c has system suspend/resume callbacks. I tested this patch by hack-removing them and yes, autosuspend doesn't work without this patch. Raag and Mika noticed the issue when cleaning up empty runtime PM callbacks from an another driver which doesn't have any other PM callbacks.
On Tue, Feb 13, 2024 at 02:06:48PM -0600, Bjorn Helgaas wrote: > On Mon, Feb 12, 2024 at 12:02:33PM +0530, Raag Jadav wrote: > > Commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback > > functions") tried to eliminate the need for runtime PM callbacks > > by modifying pci_pm_runtime_suspend() and pci_pm_runtime_resume(), > > but didn't modify pci_pm_runtime_idle() with relevant changes, which > > still returns -ENOSYS if the driver supplies no runtime PM callbacks. > > > > Fix this by modifying pci_pm_runtime_idle() such that it allows PCI > > device power state transitions without runtime PM callbacks. > > > > 0) | pm_runtime_work() { > > 0) | rpm_idle() { > > 0) | rpm_check_suspend_allowed() { > > 0) 1.500 us | __dev_pm_qos_resume_latency(); /* = 0x7fffffff */ > > 0) 4.840 us | } /* rpm_check_suspend_allowed = 0x0 */ > > 0) 1.550 us | __rpm_get_callback(); /* = 0xffffffffb4bc84f0 */ > > 0) 1.800 us | pci_pm_runtime_idle(); /* = -38 */ > > 0) + 17.070 us | } /* rpm_idle = -38 */ > > 0) + 22.450 us | } /* pm_runtime_work = -38 */ > > What is this timing information telling me? It's a raw ftrace dump. > > Debugged-by: Mika Westerberg <mika.westerberg@linux.intel.com> > > Sounds like this resolves a problem report? Is there a URL we can > cite? If not, at least a mention of what the user-visible problem is? > > From the c5eb1190074c commit log, it sounds like maybe this allows > devices to be autosuspended when they previously could not be? > > Possibly this should have "Fixes: c5eb1190074c ("PCI / PM: Allow > runtime PM without callback functions")" since it sounds like it goes > with it? As pointed out by Jarkko, it's not a regression. The implementation in original commit is incomplete. We discovered it while cleaning up another PCI based driver. > > Signed-off-by: Raag Jadav <raag.jadav@intel.com> > > Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> > > --- > > > > This is not marked for linux-stable for the need of extensive testing > > and can be backported after a few releases if no issues are reported. > > If you think this should not get backported to stable, you'll have to > watch the backports to prevent it. Lots of stuff gets auto-backported > even though not explicitly marked for stable. This comment won't > prevent it (and won't even appear in the commit log). This is why I've added Greg and Sasha here. Raag
On Wed, Feb 14, 2024 at 12:43:35PM +0200, Raag Jadav wrote: > On Tue, Feb 13, 2024 at 02:06:48PM -0600, Bjorn Helgaas wrote: > > On Mon, Feb 12, 2024 at 12:02:33PM +0530, Raag Jadav wrote: .. > > > 0) | pm_runtime_work() { > > > 0) | rpm_idle() { > > > 0) | rpm_check_suspend_allowed() { > > > 0) 1.500 us | __dev_pm_qos_resume_latency(); /* = 0x7fffffff */ > > > 0) 4.840 us | } /* rpm_check_suspend_allowed = 0x0 */ > > > 0) 1.550 us | __rpm_get_callback(); /* = 0xffffffffb4bc84f0 */ > > > 0) 1.800 us | pci_pm_runtime_idle(); /* = -38 */ > > > 0) + 17.070 us | } /* rpm_idle = -38 */ > > > 0) + 22.450 us | } /* pm_runtime_work = -38 */ > > > > What is this timing information telling me? > > It's a raw ftrace dump. (Told ya that people would be surprised with this without seeing how you get this and what fields mean)
On Wed, Feb 14, 2024 at 03:01:29PM +0200, Andy Shevchenko wrote: > On Wed, Feb 14, 2024 at 12:43:35PM +0200, Raag Jadav wrote: > > On Tue, Feb 13, 2024 at 02:06:48PM -0600, Bjorn Helgaas wrote: > > > On Mon, Feb 12, 2024 at 12:02:33PM +0530, Raag Jadav wrote: > > ... > > > > > 0) | pm_runtime_work() { > > > > 0) | rpm_idle() { > > > > 0) | rpm_check_suspend_allowed() { > > > > 0) 1.500 us | __dev_pm_qos_resume_latency(); /* = 0x7fffffff */ > > > > 0) 4.840 us | } /* rpm_check_suspend_allowed = 0x0 */ > > > > 0) 1.550 us | __rpm_get_callback(); /* = 0xffffffffb4bc84f0 */ > > > > 0) 1.800 us | pci_pm_runtime_idle(); /* = -38 */ > > > > 0) + 17.070 us | } /* rpm_idle = -38 */ > > > > 0) + 22.450 us | } /* pm_runtime_work = -38 */ > > > > > > What is this timing information telling me? > > > > It's a raw ftrace dump. > > (Told ya that people would be surprised with this without seeing how you get > this and what fields mean) I can add stat headers in v2 which I think will be more helpful. Raag
On Wed, Feb 14, 2024 at 03:20:35PM +0200, Raag Jadav wrote: > On Wed, Feb 14, 2024 at 03:01:29PM +0200, Andy Shevchenko wrote: > > On Wed, Feb 14, 2024 at 12:43:35PM +0200, Raag Jadav wrote: > > > On Tue, Feb 13, 2024 at 02:06:48PM -0600, Bjorn Helgaas wrote: > > > > On Mon, Feb 12, 2024 at 12:02:33PM +0530, Raag Jadav wrote: > > > > ... > > > > > > > 0) | pm_runtime_work() { > > > > > 0) | rpm_idle() { > > > > > 0) | rpm_check_suspend_allowed() { > > > > > 0) 1.500 us | __dev_pm_qos_resume_latency(); /* = 0x7fffffff */ > > > > > 0) 4.840 us | } /* rpm_check_suspend_allowed = 0x0 */ > > > > > 0) 1.550 us | __rpm_get_callback(); /* = 0xffffffffb4bc84f0 */ > > > > > 0) 1.800 us | pci_pm_runtime_idle(); /* = -38 */ > > > > > 0) + 17.070 us | } /* rpm_idle = -38 */ > > > > > 0) + 22.450 us | } /* pm_runtime_work = -38 */ > > > > > > > > What is this timing information telling me? > > > > > > It's a raw ftrace dump. > > > > (Told ya that people would be surprised with this without seeing how you get > > this and what fields mean) > > I can add stat headers in v2 which I think will be more helpful. That's not what I was asking. *Why* is the ftrace dump here? Is the point that we're calling a function we shouldn't? That this patch improves performance? Without some interpretation of what the dump shows, it's just noise. Bjorn
On Wed, Feb 14, 2024 at 08:58:48AM +0200, Jarkko Nikula wrote: > On 2/13/24 22:06, Bjorn Helgaas wrote: > > > Debugged-by: Mika Westerberg <mika.westerberg@linux.intel.com> > > > > Sounds like this resolves a problem report? Is there a URL we can > > cite? If not, at least a mention of what the user-visible problem is? > > > > From the c5eb1190074c commit log, it sounds like maybe this allows > > devices to be autosuspended when they previously could not be? > > > > Possibly this should have "Fixes: c5eb1190074c ("PCI / PM: Allow > > runtime PM without callback functions")" since it sounds like it goes > > with it? > > > I don't think there's known regression but my above commit wasn't complete. > Autosuspending works without runtime PM callback as long as the driver has > the PM callbacks structure set. I didn't suggest there was a regression, but if we mention that Mika debugged something, I want to know what the something was. I'm guessing runtime PM doesn't work for some subset of drivers, and this patch fixes that. So let's say exactly how to find that subset of drivers, e.g., "drivers that implement X but not Y" or whatever. > For example the drivers/i2c/busses/i2c-i801.c has system suspend/resume > callbacks. I tested this patch by hack-removing them and yes, autosuspend > doesn't work without this patch. > > Raag and Mika noticed the issue when cleaning up empty runtime PM callbacks > from an another driver which doesn't have any other PM callbacks. Bjorn
On Wed, Feb 14, 2024 at 10:58:00AM -0600, Bjorn Helgaas wrote: > On Wed, Feb 14, 2024 at 08:58:48AM +0200, Jarkko Nikula wrote: > > On 2/13/24 22:06, Bjorn Helgaas wrote: > > > > Debugged-by: Mika Westerberg <mika.westerberg@linux.intel.com> > > > > > > Sounds like this resolves a problem report? Is there a URL we can > > > cite? If not, at least a mention of what the user-visible problem is? > > > > > > From the c5eb1190074c commit log, it sounds like maybe this allows > > > devices to be autosuspended when they previously could not be? > > > > > > Possibly this should have "Fixes: c5eb1190074c ("PCI / PM: Allow > > > runtime PM without callback functions")" since it sounds like it goes > > > with it? > > > > > I don't think there's known regression but my above commit wasn't complete. > > Autosuspending works without runtime PM callback as long as the driver has > > the PM callbacks structure set. > > I didn't suggest there was a regression, but if we mention that Mika > debugged something, I want to know what the something was. Considering it's not a bug to begin with, perhaps we can change it to Suggested-by or Co-developed-by? Raag
On Wed, Feb 14, 2024 at 10:15:29PM +0200, Raag Jadav wrote: > On Wed, Feb 14, 2024 at 10:58:00AM -0600, Bjorn Helgaas wrote: > > On Wed, Feb 14, 2024 at 08:58:48AM +0200, Jarkko Nikula wrote: > > > On 2/13/24 22:06, Bjorn Helgaas wrote: > > > > > Debugged-by: Mika Westerberg <mika.westerberg@linux.intel.com> > > > > > > > > Sounds like this resolves a problem report? Is there a URL we can > > > > cite? If not, at least a mention of what the user-visible problem is? > > > > > > > > From the c5eb1190074c commit log, it sounds like maybe this allows > > > > devices to be autosuspended when they previously could not be? > > > > > > > > Possibly this should have "Fixes: c5eb1190074c ("PCI / PM: Allow > > > > runtime PM without callback functions")" since it sounds like it goes > > > > with it? > > > > > > > I don't think there's known regression but my above commit wasn't complete. > > > Autosuspending works without runtime PM callback as long as the driver has > > > the PM callbacks structure set. > > > > I didn't suggest there was a regression, but if we mention that Mika > > debugged something, I want to know what the something was. > > Considering it's not a bug to begin with, perhaps we can change it to > Suggested-by or Co-developed-by? Hi Mika, If you are okay with this, please let me know and perhaps suggest a better fit for the scenario. Raag
On Mon, Feb 26, 2024 at 09:35:37AM +0200, Raag Jadav wrote: > On Wed, Feb 14, 2024 at 10:15:29PM +0200, Raag Jadav wrote: > > On Wed, Feb 14, 2024 at 10:58:00AM -0600, Bjorn Helgaas wrote: > > > On Wed, Feb 14, 2024 at 08:58:48AM +0200, Jarkko Nikula wrote: > > > > On 2/13/24 22:06, Bjorn Helgaas wrote: > > > > > > Debugged-by: Mika Westerberg <mika.westerberg@linux.intel.com> > > > > > > > > > > Sounds like this resolves a problem report? Is there a URL we can > > > > > cite? If not, at least a mention of what the user-visible problem is? > > > > > > > > > > From the c5eb1190074c commit log, it sounds like maybe this allows > > > > > devices to be autosuspended when they previously could not be? > > > > > > > > > > Possibly this should have "Fixes: c5eb1190074c ("PCI / PM: Allow > > > > > runtime PM without callback functions")" since it sounds like it goes > > > > > with it? > > > > > > > > > I don't think there's known regression but my above commit wasn't complete. > > > > Autosuspending works without runtime PM callback as long as the driver has > > > > the PM callbacks structure set. > > > > > > I didn't suggest there was a regression, but if we mention that Mika > > > debugged something, I want to know what the something was. > > > > Considering it's not a bug to begin with, perhaps we can change it to > > Suggested-by or Co-developed-by? > > Hi Mika, > > If you are okay with this, please let me know and perhaps suggest a better > fit for the scenario. You can just drop my name from it completely.
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 51ec9e7e784f..bb7f6775b350 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1382,10 +1382,7 @@ static int pci_pm_runtime_idle(struct device *dev) if (!pci_dev->driver) return 0; - if (!pm) - return -ENOSYS; - - if (pm->runtime_idle) + if (pm && pm->runtime_idle) return pm->runtime_idle(dev); return 0;