Thread View: linux.kernel.netdev
6 messages
6 total messages
Started by Frank.Li
Thu, 29 Oct 2026 16:30
[PATCH 1/1] PM: runtime: change stub pm_runtime_get_if_active() return 1 when !CONFIG_PM
Author: Frank.Li
Date: Thu, 29 Oct 2026 16:30
Date: Thu, 29 Oct 2026 16:30
114 lines
22896 bytes
22896 bytes
From: Frank Li <Frank.Li@nxp.com>
When CONFIG_PM is not enabled, all devices runtime PM state should be
treated as active.
__pm_runtime_resume() returns 1 (called by pm_runtime_get()).
pm_runtime_get_if_active() is the try-and-get version of pm_runtime_get().
stub pm_runtime_active() also returns true. So pm_runtime_get_if_active()
should return the same value as the stub pm_runtime_get(), which is 1.
Analysis of all callers and their behavior with old (-EINVAL) vs new (1):
Pattern A: if (!pm_runtime_get_if_active(dev)) -- no impact
Both -EINVAL and 1 are non-zero, so !ret is false in both cases.
Callers: drivers/accel/ethosu/ethosu_perfmon.c,
drivers/gpu/drm/msm/adreno/a6xx_gmu.c,
drivers/gpu/drm/msm/msm_perfcntr.c,
drivers/gpu/drm/v3d/v3d_mmu.c,
drivers/gpu/drm/v3d/v3d_perfmon.c (x4),
drivers/media/i2c/gc08a3.c gc05a2.c og0ve1b.c ov6211.c,
drivers/media/i2c/ccs/ccs-core.c s5kjn1.c lm3560.c (x2),
drivers/media/i2c/s5k3m5.c thp7312.c imx283.c ov64a40.c,
drivers/media/pci/intel/ipu6/ipu6-buttress.c,
sound/hda/core/device.c
Pattern B: if (!ret) after get -- no impact
Both -EINVAL and 1 are non-zero, !ret is false in both cases.
drivers/gpu/drm/amd/pm/amdgpu_pm.c (comment says "allow access"
in kernels without CONFIG_PM), drivers/pci/pci.c
Pattern C: ret > 0 / ret <= 0 / ret != 1 checks -- FIXED
drivers/usb/core/offload.c: checks (!= 1), old -EINVAL caused
-EBUSY even with !CONFIG_PM. Fixed: now returns 1, proceeds.
drivers/accel/ivpu/ivpu_job.c: drm_WARN_ON(<= 0), old -EINVAL
spuriously triggered WARN. Fixed: 1 > 0, no warn.
drivers/gpu/drm/i915/intel_runtime_pm.c: checks (<= 0), old
-EINVAL triggered error path. Fixed: 1 > 0, correct path.
drivers/accel/ivpu/ivpu_sysfs.c: (> 0), old skipped freq read.
Fixed: proceeds correctly without CONFIG_PM.
drivers/gpu/drm/xe/xe_pm.c: wraps (> 0), all xe callers
(xe_bo.c, xe_shrinker.c, xe_vsec.c, xe_ggtt.c, xe_guc_ct.c,
xe_pxp.c) now correctly treat !CONFIG_PM as active.
drivers/net/ipa/ipa_smp2p.c: power_on = (> 0), now correctly true.
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c: (> 0), now correctly
executes stall register update.
drivers/staging/media/ipu7/ipu7-buttress.c: active (<= 0) early
return now skipped, correctly proceeds.
Pattern D: explicit -EINVAL check
drivers/hwmon/prom21-xhci.c: checks (> 0) then (== -EINVAL).
Old: took -EINVAL fallback. New: takes (> 0) fast path.
Both succeed when CONFIG_PM is disabled; functionally equivalent.
drivers/hwmon/eic7700-pvt.c: call is guarded by IS_ENABLED(CONFIG_PM),
stub is never reached. No impact.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andrzej Kacprowski <andrzej.kacprowski@linux.intel.com>
Cc: Karol Wachowski <karol.wachowski@linux.intel.com>
Cc: Oded Gabbay <ogabbay@kernel.org>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tvrtko Ursulin <tursulin@ursulin.net>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: "Thomas Hellstrom" <thomas.hellstrom@linux.intel.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Alex Elder <elder@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: "Joerg Roedel" <joro@8bytes.org>
Cc: Rob Clark <robin.clark@oss.qualcomm.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Guan-Yu Lin <guanyulin@google.com>
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Cc: linux-hwmon@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: iommu@lists.linux.dev
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: linux-staging@lists.linux.dev
Cc: netdev@vger.kernel.org
Cc: imx@lists.linux.dev
Cc: Rob Herring (Arm) <robh@kernel.org>
---
include/linux/pm_runtime.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 64921b10ac74f..de9e7518ecef2 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -280,7 +280,7 @@ static inline int pm_runtime_get_if_in_use(struct device *dev)
}
static inline int pm_runtime_get_if_active(struct device *dev)
{
- return -EINVAL;
+ return 1;
}
static inline int __pm_runtime_set_status(struct device *dev,
unsigned int status) { return 0; }
--
2.43.0
Re: [PATCH 1/1] PM: runtime: change stub pm_runtime_get_if_active() return 1 when !CONFIG_PM
Author: Dan Carpenter
Date: Thu, 29 Oct 2026 18:59
Date: Thu, 29 Oct 2026 18:59
26 lines
13459 bytes
13459 bytes
On Thu, Oct 29, 2026 at 12:30:37PM -0400, Frank.Li@oss.nxp.com wrote: > Pattern C: ret > 0 / ret <= 0 / ret != 1 checks -- FIXED > drivers/usb/core/offload.c: checks (!= 1), old -EINVAL caused > -EBUSY even with !CONFIG_PM. Fixed: now returns 1, proceeds. > drivers/accel/ivpu/ivpu_job.c: drm_WARN_ON(<= 0), old -EINVAL > spuriously triggered WARN. Fixed: 1 > 0, no warn. > drivers/gpu/drm/i915/intel_runtime_pm.c: checks (<= 0), old > -EINVAL triggered error path. Fixed: 1 > 0, correct path. > drivers/accel/ivpu/ivpu_sysfs.c: (> 0), old skipped freq read. > Fixed: proceeds correctly without CONFIG_PM. > drivers/gpu/drm/xe/xe_pm.c: wraps (> 0), all xe callers > (xe_bo.c, xe_shrinker.c, xe_vsec.c, xe_ggtt.c, xe_guc_ct.c, > xe_pxp.c) now correctly treat !CONFIG_PM as active. > drivers/net/ipa/ipa_smp2p.c: power_on = (> 0), now correctly true. > drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c: (> 0), now correctly > executes stall register update. > drivers/staging/media/ipu7/ipu7-buttress.c: active (<= 0) early > return now skipped, correctly proceeds. Pattern C is mostly bugs so this patch should have a Fixes tag since it fixes bugs. regards, dan carpenter
Re: [PATCH 1/1] PM: runtime: change stub pm_runtime_get_if_active() return 1 when !CONFIG_PM
Author: Sakari Ailus
Date: Fri, 30 Oct 2026 08:57
Date: Fri, 30 Oct 2026 08:57
24 lines
11332 bytes
11332 bytes
Hi Frank, Thanks for the patch. On Thu, Oct 29, 2026 at 12:30:37PM -0400, Frank.Li@oss.nxp.com wrote: > From: Frank Li <Frank.Li@nxp.com> > > When CONFIG_PM is not enabled, all devices runtime PM state should be > treated as active. > > __pm_runtime_resume() returns 1 (called by pm_runtime_get()). > pm_runtime_get_if_active() is the try-and-get version of pm_runtime_get(). > stub pm_runtime_active() also returns true. So pm_runtime_get_if_active() > should return the same value as the stub pm_runtime_get(), which is 1. Shouldn't the same change be done to pm_runtime_get_if_in_use()? It's otherwise the same, except that it requires also the use count to be non-zero. -- Regards, Sakari Ailus
Re: [PATCH 1/1] PM: runtime: change stub pm_runtime_get_if_active() return 1 when !CONFIG_PM
Author: Dan Carpenter
Date: Fri, 30 Oct 2026 13:54
Date: Fri, 30 Oct 2026 13:54
41 lines
13763 bytes
13763 bytes
On Fri, Oct 30, 2026 at 08:46:07AM -0500, Alex Elder wrote: > On 10/30/26 3:57 AM, Sakari Ailus wrote: > > Hi Frank, > > > > Thanks for the patch. > > > > On Thu, Oct 29, 2026 at 12:30:37PM -0400, Frank.Li@oss.nxp.com wrote: > > > From: Frank Li <Frank.Li@nxp.com> > > > > > > When CONFIG_PM is not enabled, all devices runtime PM state should be > > > treated as active. > > > > > > __pm_runtime_resume() returns 1 (called by pm_runtime_get()). > > > pm_runtime_get_if_active() is the try-and-get version of pm_runtime_get(). > > > stub pm_runtime_active() also returns true. So pm_runtime_get_if_active() > > > should return the same value as the stub pm_runtime_get(), which is 1. > > > > Shouldn't the same change be done to pm_runtime_get_if_in_use()? It's > > otherwise the same, except that it requires also the use count to be > > non-zero. > I think "yes." > > I think the logic for !CONFIG_PM should basically pretend runtime > PM is enabled for all devices, and they're all ACTIVE and effectively > in use. > > That implies: > - disable_depth == 0, so usage accounting would (if enabled) be done > - runtime_status == RPM_ACTIVE (power is on, no delay) > - usage_count > 0 > - runtime_error == 0 > - Maybe ignore_children is false? > > This might not be complete (and could be wrong!). > We could add this kind of information as a comment somewhere? regards, dan carpenter
Re: [PATCH 1/1] PM: runtime: change stub pm_runtime_get_if_active() return 1 when !CONFIG_PM
Author: "Rafael J. Wysocki (Intel)"
Date: Fri, 13 Nov 2026 18:18
Date: Fri, 13 Nov 2026 18:18
63 lines
13200 bytes
13200 bytes
On Thu, Oct 29, 2026 at 5:31 PM <Frank.Li@oss.nxp.com> wrote: > > From: Frank Li <Frank.Li@nxp.com> > > When CONFIG_PM is not enabled, all devices runtime PM state should be > treated as active. > > __pm_runtime_resume() returns 1 (called by pm_runtime_get()). > pm_runtime_get_if_active() is the try-and-get version of pm_runtime_get(). > stub pm_runtime_active() also returns true. So pm_runtime_get_if_active() > should return the same value as the stub pm_runtime_get(), which is 1. > > Analysis of all callers and their behavior with old (-EINVAL) vs new (1): > > Pattern A: if (!pm_runtime_get_if_active(dev)) -- no impact > Both -EINVAL and 1 are non-zero, so !ret is false in both cases. > Callers: drivers/accel/ethosu/ethosu_perfmon.c, > drivers/gpu/drm/msm/adreno/a6xx_gmu.c, > drivers/gpu/drm/msm/msm_perfcntr.c, > drivers/gpu/drm/v3d/v3d_mmu.c, > drivers/gpu/drm/v3d/v3d_perfmon.c (x4), > drivers/media/i2c/gc08a3.c gc05a2.c og0ve1b.c ov6211.c, > drivers/media/i2c/ccs/ccs-core.c s5kjn1.c lm3560.c (x2), > drivers/media/i2c/s5k3m5.c thp7312.c imx283.c ov64a40.c, > drivers/media/pci/intel/ipu6/ipu6-buttress.c, > sound/hda/core/device.c > > Pattern B: if (!ret) after get -- no impact > Both -EINVAL and 1 are non-zero, !ret is false in both cases. > drivers/gpu/drm/amd/pm/amdgpu_pm.c (comment says "allow access" > in kernels without CONFIG_PM), drivers/pci/pci.c > > Pattern C: ret > 0 / ret <= 0 / ret != 1 checks -- FIXED > drivers/usb/core/offload.c: checks (!= 1), old -EINVAL caused > -EBUSY even with !CONFIG_PM. Fixed: now returns 1, proceeds. > drivers/accel/ivpu/ivpu_job.c: drm_WARN_ON(<= 0), old -EINVAL > spuriously triggered WARN. Fixed: 1 > 0, no warn. > drivers/gpu/drm/i915/intel_runtime_pm.c: checks (<= 0), old > -EINVAL triggered error path. Fixed: 1 > 0, correct path. > drivers/accel/ivpu/ivpu_sysfs.c: (> 0), old skipped freq read. > Fixed: proceeds correctly without CONFIG_PM. > drivers/gpu/drm/xe/xe_pm.c: wraps (> 0), all xe callers > (xe_bo.c, xe_shrinker.c, xe_vsec.c, xe_ggtt.c, xe_guc_ct.c, > xe_pxp.c) now correctly treat !CONFIG_PM as active. > drivers/net/ipa/ipa_smp2p.c: power_on = (> 0), now correctly true. > drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c: (> 0), now correctly > executes stall register update. > drivers/staging/media/ipu7/ipu7-buttress.c: active (<= 0) early > return now skipped, correctly proceeds. > > Pattern D: explicit -EINVAL check > drivers/hwmon/prom21-xhci.c: checks (> 0) then (== -EINVAL). > Old: took -EINVAL fallback. New: takes (> 0) fast path. > Both succeed when CONFIG_PM is disabled; functionally equivalent. > drivers/hwmon/eic7700-pvt.c: call is guarded by IS_ENABLED(CONFIG_PM), > stub is never reached. No impact. > > Signed-off-by: Frank Li <Frank.Li@nxp.com> People sent feedback, so I'm wondering if there's going to be a v2 or does someone else need to take care of this going forward?
Re: [PATCH 1/1] PM: runtime: change stub pm_runtime_get_if_active() return 1 when !CONFIG_PM
Author: Frank Li
Date: Mon, 16 Nov 2026 13:46
Date: Mon, 16 Nov 2026 13:46
67 lines
22201 bytes
22201 bytes
On Fri, Nov 13, 2026 at 07:18:55PM +0100, Rafael J. Wysocki (Intel) wrote: > On Thu, Oct 29, 2026 at 5:31 PM <Frank.Li@oss.nxp.com> wrote: > > > > From: Frank Li <Frank.Li@nxp.com> > > > > When CONFIG_PM is not enabled, all devices runtime PM state should be > > treated as active. > > > > __pm_runtime_resume() returns 1 (called by pm_runtime_get()). > > pm_runtime_get_if_active() is the try-and-get version of pm_runtime_get(). > > stub pm_runtime_active() also returns true. So pm_runtime_get_if_active() > > should return the same value as the stub pm_runtime_get(), which is 1. > > > > Analysis of all callers and their behavior with old (-EINVAL) vs new (1): > > > > Pattern A: if (!pm_runtime_get_if_active(dev)) -- no impact > > Both -EINVAL and 1 are non-zero, so !ret is false in both cases. > > Callers: drivers/accel/ethosu/ethosu_perfmon.c, > > drivers/gpu/drm/msm/adreno/a6xx_gmu.c, > > drivers/gpu/drm/msm/msm_perfcntr.c, > > drivers/gpu/drm/v3d/v3d_mmu.c, > > drivers/gpu/drm/v3d/v3d_perfmon.c (x4), > > drivers/media/i2c/gc08a3.c gc05a2.c og0ve1b.c ov6211.c, > > drivers/media/i2c/ccs/ccs-core.c s5kjn1.c lm3560.c (x2), > > drivers/media/i2c/s5k3m5.c thp7312.c imx283.c ov64a40.c, > > drivers/media/pci/intel/ipu6/ipu6-buttress.c, > > sound/hda/core/device.c > > > > Pattern B: if (!ret) after get -- no impact > > Both -EINVAL and 1 are non-zero, !ret is false in both cases. > > drivers/gpu/drm/amd/pm/amdgpu_pm.c (comment says "allow access" > > in kernels without CONFIG_PM), drivers/pci/pci.c > > > > Pattern C: ret > 0 / ret <= 0 / ret != 1 checks -- FIXED > > drivers/usb/core/offload.c: checks (!= 1), old -EINVAL caused > > -EBUSY even with !CONFIG_PM. Fixed: now returns 1, proceeds. > > drivers/accel/ivpu/ivpu_job.c: drm_WARN_ON(<= 0), old -EINVAL > > spuriously triggered WARN. Fixed: 1 > 0, no warn. > > drivers/gpu/drm/i915/intel_runtime_pm.c: checks (<= 0), old > > -EINVAL triggered error path. Fixed: 1 > 0, correct path. > > drivers/accel/ivpu/ivpu_sysfs.c: (> 0), old skipped freq read. > > Fixed: proceeds correctly without CONFIG_PM. > > drivers/gpu/drm/xe/xe_pm.c: wraps (> 0), all xe callers > > (xe_bo.c, xe_shrinker.c, xe_vsec.c, xe_ggtt.c, xe_guc_ct.c, > > xe_pxp.c) now correctly treat !CONFIG_PM as active. > > drivers/net/ipa/ipa_smp2p.c: power_on = (> 0), now correctly true. > > drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c: (> 0), now correctly > > executes stall register update. > > drivers/staging/media/ipu7/ipu7-buttress.c: active (<= 0) early > > return now skipped, correctly proceeds. > > > > Pattern D: explicit -EINVAL check > > drivers/hwmon/prom21-xhci.c: checks (> 0) then (== -EINVAL). > > Old: took -EINVAL fallback. New: takes (> 0) fast path. > > Both succeed when CONFIG_PM is disabled; functionally equivalent. > > drivers/hwmon/eic7700-pvt.c: call is guarded by IS_ENABLED(CONFIG_PM), > > stub is never reached. No impact. > > > > Signed-off-by: Frank Li <Frank.Li@nxp.com> > > People sent feedback, so I'm wondering if there's going to be a v2 or > does someone else need to take care of this going forward? Sorry, I forget this thread. I will post v2 soon. Frank
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads