1. 26 Jul, 2018 3 commits
    • Waiman Long's avatar
      cpufreq: Fix a circular lock dependency problem · 9b3d9bb3
      Waiman Long authored
      With lockdep turned on, the following circular lock dependency problem
      was reported:
      
      [   57.470040] ======================================================
      [   57.502900] WARNING: possible circular locking dependency detected
      [   57.535208] 4.18.0-0.rc3.1.el8+7.x86_64+debug #1 Tainted: G
      [   57.577761] ------------------------------------------------------
      [   57.609714] tuned/1505 is trying to acquire lock:
      [   57.633808] 00000000559deec5 (cpu_hotplug_lock.rw_sem){++++}, at: store+0x27/0x120
      [   57.672880]
      [   57.672880] but task is already holding lock:
      [   57.702184] 000000002136ca64 (kn->count#118){++++}, at: kernfs_fop_write+0x1d0/0x410
      [   57.742176]
      [   57.742176] which lock already depends on the new lock.
      [   57.742176]
      [   57.785220]
      [   57.785220] the existing dependency chain (in reverse order) is:
          :
      [   58.932512] other info that might help us debug this:
      [   58.932512]
      [   58.973344] Chain exists of:
      [   58.973344]   cpu_hotplug_lock.rw_sem --> subsys mutex#5 --> kn->count#118
      [   58.973344]
      [   59.030795]  Possible unsafe locking scenario:
      [   59.030795]
      [   59.061248]        CPU0                    CPU1
      [   59.085377]        ----                    ----
      [   59.108160]   lock(kn->count#118);
      [   59.124935]                                lock(subsys mutex#5);
      [   59.156330]                                lock(kn->count#118);
      [   59.186088]   lock(cpu_hotplug_lock.rw_sem);
      [   59.208541]
      [   59.208541]  *** DEADLOCK ***
      
      In the cpufreq_register_driver() function, the lock sequence is:
      
        cpus_read_lock --> kn->count
      
      For the cpufreq sysfs store method, the lock sequence is:
      
        kn->count --> cpus_read_lock
      
      These sequences are actually safe as they are taking a share lock on
      cpu_hotplug_lock. However, the current lockdep code doesn't check for
      share locking when detecting circular lock dependency.  Fixing that
      could be a substantial effort.
      
      Instead, we can work around this problem by using cpus_read_trylock()
      in the store method which is much simpler. The chance of not getting
      the read lock is very small. If that happens, the userspace application
      that writes the sysfs file will get an error.
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      9b3d9bb3
    • Waiman Long's avatar
      cpu/hotplug: Add a cpus_read_trylock() function · 6f4ceee9
      Waiman Long authored
      There are use cases where it can be useful to have a cpus_read_trylock()
      function to work around circular lock dependency problem involving
      the cpu_hotplug_lock.
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6f4ceee9
    • Ruchi Kandoi's avatar
      cpufreq: trace frequency limits change · 601b2185
      Ruchi Kandoi authored
      systrace used for tracing for Android systems has carried a patch for
      many years in the Android tree that traces when the cpufreq limits
      change.  With the help of this information, systrace can know when the
      policy limits change and can visually display the data. Lets add
      upstream support for the same.
      Signed-off-by: default avatarRuchi Kandoi <kandoiruchi@google.com>
      Signed-off-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Acked-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      601b2185
  2. 25 Jul, 2018 1 commit
  3. 19 Jul, 2018 1 commit
    • Srinivas Pandruvada's avatar
      cpufreq: intel_pstate: Show different max frequency with turbo 3 and HWP · eea033d0
      Srinivas Pandruvada authored
      On HWP platforms with Turbo 3.0, the HWP capability max ratio shows the
      maximum ratio of that core, which can be different than other cores. If
      we show the correct maximum frequency in cpufreq sysfs via
      cpuinfo_max_freq and scaling_max_freq then, user can know which cores
      can run faster for pinning some high priority tasks.
      
      Currently the max turbo frequency is shown as max frequency, which is
      the max of all cores, even if some cores can't reach that frequency
      even for single threaded workload.
      
      But it is possible that max ratio in HWP capabilities is set as 0xFF or
      some high invalid value (E.g. One KBL NUC). Since the actual performance
      can never exceed 1 core turbo frequency from MSR TURBO_RATIO_LIMIT, we
      use this as a bound check.
      Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      eea033d0
  4. 18 Jul, 2018 6 commits
  5. 15 Jul, 2018 2 commits
  6. 14 Jul, 2018 19 commits
  7. 13 Jul, 2018 8 commits