Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pm-7.0-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more power management updates from Rafael Wysocki:
"These are mostly fixes on top of the power management updates merged
recently in cpuidle governors, in the Intel RAPL power capping driver
and in the wake IRQ management code:

- Fix the handling of package-scope MSRs in the intel_rapl power
capping driver when called from the PMU subsystem and make it add
all package CPUs to the PMU cpumask to allow tools to read RAPL
events from any CPU in the package (Kuppuswamy Satharayananyan)

- Rework the invalid version check in the intel_rapl_tpmi power
capping driver to account for the fact that on partitioned systems,
multiple TPMI instances may exist per package, but RAPL registers
are only valid on one instance (Kuppuswamy Satharayananyan)

- Describe the new intel_idle.table command line option in the
admin-guide intel_idle documentation (Artem Bityutskiy)

- Fix a crash in the ladder cpuidle governor on systems with only one
(polling) idle state available by making the cpuidle core bypass
the governor in those cases and adjust the other existing governors
to that change (Aboorva Devarajan, Christian Loehle)

- Update kerneldoc comments for wake IRQ management functions that
have not been matching the code (Wang Jiayue)"

* tag 'pm-7.0-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
cpuidle: menu: Remove single state handling
cpuidle: teo: Remove single state handling
cpuidle: haltpoll: Remove single state handling
cpuidle: Skip governor when only one idle state is available
powercap: intel_rapl_tpmi: Remove FW_BUG from invalid version check
PM: sleep: wakeirq: Update outdated documentation comments
Documentation: PM: Document intel_idle.table command line option
powercap: intel_rapl: Expose all package CPUs in PMU cpumask
powercap: intel_rapl: Remove incorrect CPU check in PMU context

+45 -36
+11
Documentation/admin-guide/pm/intel_idle.rst
··· 260 260 help performance of a sibling CPU at the expense of a slightly higher wakeup 261 261 latency for the idle CPU. 262 262 263 + The ``table`` argument allows customization of idle state latency and target 264 + residency. The syntax is a comma-separated list of ``name:latency:residency`` 265 + entries, where ``name`` is the idle state name, ``latency`` is the exit latency 266 + in microseconds, and ``residency`` is the target residency in microseconds. It 267 + is not necessary to specify all idle states; only those to be customized. For 268 + example, ``C1:1:3,C6:50:100`` sets the exit latency and target residency for 269 + C1 and C6 to 1/3 and 50/100 microseconds, respectively. Remaining idle states 270 + keep their default values. The driver verifies that deeper idle states have 271 + higher latency and target residency than shallower ones. Also, target 272 + residency cannot be smaller than exit latency. If any of these conditions is 273 + not met, the driver ignores the entire ``table`` parameter. 263 274 264 275 .. _intel-idle-core-and-package-idle-states: 265 276
+7 -4
drivers/base/power/wakeirq.c
··· 273 273 * otherwise try to disable already disabled wakeirq. The wake-up interrupt 274 274 * starts disabled with IRQ_NOAUTOEN set. 275 275 * 276 - * Should be only called from rpm_suspend() and rpm_resume() path. 277 - * Caller must hold &dev->power.lock to change wirq->status 276 + * Should be called from rpm_suspend(), rpm_resume(), 277 + * pm_runtime_force_suspend() or pm_runtime_force_resume(). 278 + * Caller must hold &dev->power.lock or disable runtime PM to change 279 + * wirq->status. 278 280 */ 279 281 void dev_pm_enable_wake_irq_check(struct device *dev, 280 282 bool can_change_status) ··· 308 306 * @cond_disable: if set, also check WAKE_IRQ_DEDICATED_REVERSE 309 307 * 310 308 * Disables wake-up interrupt conditionally based on status. 311 - * Should be only called from rpm_suspend() and rpm_resume() path. 309 + * Should be called from rpm_suspend(), rpm_resume(), 310 + * pm_runtime_force_suspend() or pm_runtime_force_resume(). 312 311 */ 313 312 void dev_pm_disable_wake_irq_check(struct device *dev, bool cond_disable) 314 313 { ··· 335 332 * enable wake IRQ after running ->runtime_suspend() which depends on 336 333 * WAKE_IRQ_DEDICATED_REVERSE. 337 334 * 338 - * Should be only called from rpm_suspend() path. 335 + * Should be called from rpm_suspend() or pm_runtime_force_suspend(). 339 336 */ 340 337 void dev_pm_enable_wake_irq_complete(struct device *dev) 341 338 {
+10
drivers/cpuidle/cpuidle.c
··· 359 359 int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, 360 360 bool *stop_tick) 361 361 { 362 + /* 363 + * If there is only a single idle state (or none), there is nothing 364 + * meaningful for the governor to choose. Skip the governor and 365 + * always use state 0 with the tick running. 366 + */ 367 + if (drv->state_count <= 1) { 368 + *stop_tick = false; 369 + return 0; 370 + } 371 + 362 372 return cpuidle_curr_governor->select(drv, dev, stop_tick); 363 373 } 364 374
+1 -3
drivers/cpuidle/governors/haltpoll.c
··· 50 50 struct cpuidle_device *dev, 51 51 bool *stop_tick) 52 52 { 53 - s64 latency_req = cpuidle_governor_latency_req(dev->cpu); 54 - 55 - if (!drv->state_count || latency_req == 0) { 53 + if (cpuidle_governor_latency_req(dev->cpu) == 0) { 56 54 *stop_tick = false; 57 55 return 0; 58 56 }
+1 -1
drivers/cpuidle/governors/menu.c
··· 281 281 data->bucket = BUCKETS - 1; 282 282 } 283 283 284 - if (drv->state_count <= 1 || latency_req == 0 || 284 + if (latency_req == 0 || 285 285 ((data->next_timer_ns < drv->states[1].target_residency_ns || 286 286 latency_req < drv->states[1].exit_latency_ns) && 287 287 !dev->states_usage[0].disable)) {
-6
drivers/cpuidle/governors/teo.c
··· 338 338 */ 339 339 cpu_data->sleep_length_ns = KTIME_MAX; 340 340 341 - /* Check if there is any choice in the first place. */ 342 - if (drv->state_count < 2) { 343 - idx = 0; 344 - goto out_tick; 345 - } 346 - 347 341 if (!dev->states_usage[0].disable) 348 342 idx = 0; 349 343
+8 -13
drivers/powercap/intel_rapl_common.c
··· 254 254 static int rapl_read_data_raw(struct rapl_domain *rd, 255 255 enum rapl_primitives prim, 256 256 bool xlate, u64 *data, 257 - bool atomic); 257 + bool pmu_ctx); 258 258 static int rapl_write_data_raw(struct rapl_domain *rd, 259 259 enum rapl_primitives prim, 260 260 unsigned long long value); ··· 832 832 */ 833 833 static int rapl_read_data_raw(struct rapl_domain *rd, 834 834 enum rapl_primitives prim, bool xlate, u64 *data, 835 - bool atomic) 835 + bool pmu_ctx) 836 836 { 837 837 u64 value; 838 838 enum rapl_primitives prim_fixed = prim_fixups(rd, prim); ··· 854 854 855 855 ra.mask = rpi->mask; 856 856 857 - if (rd->rp->priv->read_raw(get_rid(rd->rp), &ra, atomic)) { 857 + if (rd->rp->priv->read_raw(get_rid(rd->rp), &ra, pmu_ctx)) { 858 858 pr_debug("failed to read reg 0x%llx for %s:%s\n", ra.reg.val, rd->rp->name, rd->name); 859 859 return -EIO; 860 860 } ··· 1590 1590 1591 1591 /* PMU helpers */ 1592 1592 1593 - static int get_pmu_cpu(struct rapl_package *rp) 1593 + static void set_pmu_cpumask(struct rapl_package *rp, cpumask_var_t mask) 1594 1594 { 1595 1595 int cpu; 1596 1596 1597 1597 if (!rp->has_pmu) 1598 - return nr_cpu_ids; 1598 + return; 1599 1599 1600 1600 /* Only TPMI & MSR RAPL are supported for now */ 1601 1601 if (rp->priv->type != RAPL_IF_TPMI && rp->priv->type != RAPL_IF_MSR) 1602 - return nr_cpu_ids; 1602 + return; 1603 1603 1604 1604 /* TPMI/MSR RAPL uses any CPU in the package for PMU */ 1605 1605 for_each_online_cpu(cpu) 1606 1606 if (topology_physical_package_id(cpu) == rp->id) 1607 - return cpu; 1608 - 1609 - return nr_cpu_ids; 1607 + cpumask_set_cpu(cpu, mask); 1610 1608 } 1611 1609 1612 1610 static bool is_rp_pmu_cpu(struct rapl_package *rp, int cpu) ··· 1881 1883 { 1882 1884 struct rapl_package *rp; 1883 1885 cpumask_var_t cpu_mask; 1884 - int cpu; 1885 1886 int ret; 1886 1887 1887 1888 if (!alloc_cpumask_var(&cpu_mask, GFP_KERNEL)) ··· 1892 1895 1893 1896 /* Choose a cpu for each RAPL Package */ 1894 1897 list_for_each_entry(rp, &rapl_packages, plist) { 1895 - cpu = get_pmu_cpu(rp); 1896 - if (cpu < nr_cpu_ids) 1897 - cpumask_set_cpu(cpu, cpu_mask); 1898 + set_pmu_cpumask(rp, cpu_mask); 1898 1899 } 1899 1900 cpus_read_unlock(); 1900 1901
+5 -7
drivers/powercap/intel_rapl_msr.c
··· 110 110 return 0; 111 111 } 112 112 113 - static int rapl_msr_read_raw(int cpu, struct reg_action *ra, bool atomic) 113 + static int rapl_msr_read_raw(int cpu, struct reg_action *ra, bool pmu_ctx) 114 114 { 115 115 /* 116 - * When called from atomic-context (eg PMU event handler) 117 - * perform MSR read directly using rdmsrq(). 116 + * When called from PMU context, perform MSR read directly using 117 + * rdmsrq() without IPI overhead. Package-scoped MSRs are readable 118 + * from any CPU in the package. 118 119 */ 119 - if (atomic) { 120 - if (unlikely(smp_processor_id() != cpu)) 121 - return -EIO; 122 - 120 + if (pmu_ctx) { 123 121 rdmsrq(ra->reg.msr, ra->value); 124 122 goto out; 125 123 }
+1 -1
drivers/powercap/intel_rapl_tpmi.c
··· 157 157 tpmi_domain_flags = tpmi_domain_header >> 32 & 0xffff; 158 158 159 159 if (tpmi_domain_version == TPMI_VERSION_INVALID) { 160 - pr_warn(FW_BUG "Invalid version\n"); 160 + pr_debug("Invalid version, other instances may be valid\n"); 161 161 return -ENODEV; 162 162 } 163 163
+1 -1
include/linux/intel_rapl.h
··· 152 152 union rapl_reg reg_unit; 153 153 union rapl_reg regs[RAPL_DOMAIN_MAX][RAPL_DOMAIN_REG_MAX]; 154 154 int limits[RAPL_DOMAIN_MAX]; 155 - int (*read_raw)(int id, struct reg_action *ra, bool atomic); 155 + int (*read_raw)(int id, struct reg_action *ra, bool pmu_ctx); 156 156 int (*write_raw)(int id, struct reg_action *ra); 157 157 void *defaults; 158 158 void *rpi;