Power management fixes for 5.9-rc3

- Make the recently added Tegra194 cpufreq driver use
    read_cpuid_mpir() instead of cpu_logical_map() to avoid
    exporting logical_cpu_map (Sumit Gupta).
 
  - Drop the automatic system wakeup event reporting for devices
    with pending runtime-resume requests during system-wide suspend
    to avoid spurious aborts of the suspend flow (Rafael Wysocki).
 
  - Fix build warning in the intel_pstate driver documentation and
    improve the wording in there (Randy Dunlap).
 
  - Clean up two pieces of code in the cpufreq core (Viresh Kumar).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAl9JXNASHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxCmkP/i1nsYDJirFak9t7oVqDaJ6BIgMSub5k
 n0h977NSCBoU+DC1jMXAEYoWqfKLl46cCbzcYyLjkAXDWocQB3DGhBDdJp8GA+DG
 dNea2cL6J7EWokzEmVgwE5iFbvjW4YSKr4F3+wH9Y7TGTJdfLyYBbueIodpEGqYz
 EtC18CdjCX6xiBdh9VGNTiFH0lGVUKiTmfLh8dDAfCvVnB23gjziCCspswmfa0i1
 3J8u+obVDcvHEZikQy42qWsq+X6k6fI2CKhJ+1kIecUPbH8A8K45hZYqhDyHi6QJ
 eEu+3YHfb79S2MG6fwky6tJ+11qbd2W4jnVJ4GK4FJP+xfkBqTaAW4J9rVeFOK1H
 FDAUbzJTbvG7qk/N95Iqt4soXHAKmVeYamw9K+1EDC87vsajy+XK95qZgQbFOPLy
 3AuSfR/QDnK/YboJXBQnKMwSxQ3RdQjynliaMjFCcVs/W6Bajts2an1R8d6h2zZ8
 nwPEhTmwZzigXrPf4ya4ucrQjl1jBCudpP50oyH+qxYLh1BrebMIFBurcDYt+gT+
 VUsN/VXcGzMgUXS2DQIb+5Ij0mBkeMwSDXUM3U86oSnrdSVoNr4P3NJFvNAe087p
 S2Rl5EPYyexSqbLRNN3ugwmIOUgVzsXlN+UzO8ELy4Kan4xj+FpR4d4xaZD0R84e
 RW+rROEjaqbE
 =Q4FD
 -----END PGP SIGNATURE-----

Merge tag 'pm-5.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
 "These fix the recently added Tegra194 cpufreq driver and the handling
  of devices using runtime PM during system-wide suspend, improve the
  intel_pstate driver documentation and clean up the cpufreq core.

  Specifics:

   - Make the recently added Tegra194 cpufreq driver use
     read_cpuid_mpir() instead of cpu_logical_map() to avoid exporting
     logical_cpu_map (Sumit Gupta).

   - Drop the automatic system wakeup event reporting for devices with
     pending runtime-resume requests during system-wide suspend to avoid
     spurious aborts of the suspend flow (Rafael Wysocki).

   - Fix build warning in the intel_pstate driver documentation and
     improve the wording in there (Randy Dunlap).

   - Clean up two pieces of code in the cpufreq core (Viresh Kumar)"

* tag 'pm-5.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  cpufreq: Use WARN_ON_ONCE() for invalid relation
  cpufreq: No need to verify cpufreq_driver in show_scaling_cur_freq()
  PM: sleep: core: Fix the handling of pending runtime resume requests
  Documentation: fix pm/intel_pstate build warning and wording
  cpufreq: replace cpu_logical_map() with read_cpuid_mpir()
This commit is contained in:
Linus Torvalds 2020-08-28 13:12:09 -07:00
commit 326e311b84
5 changed files with 22 additions and 15 deletions

View File

@ -564,8 +564,8 @@ Energy-Performance Preference (EPP) knob (if supported) or its
Energy-Performance Bias (EPB) knob. It is also possible to write a positive Energy-Performance Bias (EPB) knob. It is also possible to write a positive
integer value between 0 to 255, if the EPP feature is present. If the EPP integer value between 0 to 255, if the EPP feature is present. If the EPP
feature is not present, writing integer value to this attribute is not feature is not present, writing integer value to this attribute is not
supported. In this case, user can use supported. In this case, user can use the
"/sys/devices/system/cpu/cpu*/power/energy_perf_bias" interface. "/sys/devices/system/cpu/cpu*/power/energy_perf_bias" interface.
[Note that tasks may by migrated from one CPU to another by the scheduler's [Note that tasks may by migrated from one CPU to another by the scheduler's
load-balancing algorithm and if different energy vs performance hints are load-balancing algorithm and if different energy vs performance hints are

View File

@ -1606,13 +1606,17 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
} }
/* /*
* If a device configured to wake up the system from sleep states * Wait for possible runtime PM transitions of the device in progress
* has been suspended at run time and there's a resume request pending * to complete and if there's a runtime resume request pending for it,
* for it, this is equivalent to the device signaling wakeup, so the * resume it before proceeding with invoking the system-wide suspend
* system suspend operation should be aborted. * callbacks for it.
*
* If the system-wide suspend callbacks below change the configuration
* of the device, they must disable runtime PM for it or otherwise
* ensure that its runtime-resume callbacks will not be confused by that
* change in case they are invoked going forward.
*/ */
if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) pm_runtime_barrier(dev);
pm_wakeup_event(dev, 0);
if (pm_wakeup_pending()) { if (pm_wakeup_pending()) {
dev->power.direct_complete = false; dev->power.direct_complete = false;

View File

@ -703,8 +703,7 @@ static ssize_t show_scaling_cur_freq(struct cpufreq_policy *policy, char *buf)
freq = arch_freq_get_on_cpu(policy->cpu); freq = arch_freq_get_on_cpu(policy->cpu);
if (freq) if (freq)
ret = sprintf(buf, "%u\n", freq); ret = sprintf(buf, "%u\n", freq);
else if (cpufreq_driver && cpufreq_driver->setpolicy && else if (cpufreq_driver->setpolicy && cpufreq_driver->get)
cpufreq_driver->get)
ret = sprintf(buf, "%u\n", cpufreq_driver->get(policy->cpu)); ret = sprintf(buf, "%u\n", cpufreq_driver->get(policy->cpu));
else else
ret = sprintf(buf, "%u\n", policy->cur); ret = sprintf(buf, "%u\n", policy->cur);

View File

@ -56,9 +56,11 @@ struct read_counters_work {
static struct workqueue_struct *read_counters_wq; static struct workqueue_struct *read_counters_wq;
static enum cluster get_cpu_cluster(u8 cpu) static void get_cpu_cluster(void *cluster)
{ {
return MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 1); u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
*((uint32_t *)cluster) = MPIDR_AFFINITY_LEVEL(mpidr, 1);
} }
/* /*
@ -186,8 +188,10 @@ static unsigned int tegra194_get_speed(u32 cpu)
static int tegra194_cpufreq_init(struct cpufreq_policy *policy) static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
{ {
struct tegra194_cpufreq_data *data = cpufreq_get_driver_data(); struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
int cl = get_cpu_cluster(policy->cpu);
u32 cpu; u32 cpu;
u32 cl;
smp_call_function_single(policy->cpu, get_cpu_cluster, &cl, true);
if (cl >= data->num_clusters) if (cl >= data->num_clusters)
return -EINVAL; return -EINVAL;

View File

@ -956,8 +956,8 @@ static inline int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
case CPUFREQ_RELATION_C: case CPUFREQ_RELATION_C:
return cpufreq_table_find_index_c(policy, target_freq); return cpufreq_table_find_index_c(policy, target_freq);
default: default:
pr_err("%s: Invalid relation: %d\n", __func__, relation); WARN_ON_ONCE(1);
return -EINVAL; return 0;
} }
} }