← Back to team overview

linaro-pm-wg team mailing list archive

[Bug 1098343] [NEW] cpuidle - fix lock contention in the idle path

 

Public bug reported:

    Commit bf4d1b5 (cpuidle: support multiple drivers) introduced
    locking in cpuidle_get_cpu_driver(), which is used in the
    idle_call() function.
    
    This leads to a contention problem with a large number of CPUs,
    because they all try to run the idle routine at the same time.
    
    The lock can be safely removed because of how is used the cpuidle
    API.  Namely, cpuidle_register_driver() is called first, but the
    cpuidle idle function is not entered before cpuidle_register_device()
    is called, because the cpuidle device is not enabled then. Moreover,
    cpuidle_unregister_driver(), which would reset the driver value to
    NULL, is not called before cpuidle_unregister_device().
    
    All of the cpuidle drivers use the API in the same way.
    
    In general, a cleanup around the lock is necessary and a proper
    refcounting mechanism should be used to ensure the consistency in the
    API (for example, cpuidle_unregister_driver() should fail if the
    driver's refcount is not 0). However, these modifications will require
    some code reorganization and rewrite which will be too intrusive for
    a fix.

** Affects: linaro-power-kernel
     Importance: High
     Assignee: Daniel Lezcano (daniel-lezcano)
         Status: Fix Committed

-- 
You received this bug notification because you are a member of Linaro
Power Management Working Group, which is subscribed to Linaro PMWG
Kernel.
https://bugs.launchpad.net/bugs/1098343

Title:
  cpuidle - fix lock contention in the idle path

Status in Kernel related development for Power Management Working Group:
  Fix Committed

Bug description:
      Commit bf4d1b5 (cpuidle: support multiple drivers) introduced
      locking in cpuidle_get_cpu_driver(), which is used in the
      idle_call() function.
      
      This leads to a contention problem with a large number of CPUs,
      because they all try to run the idle routine at the same time.
      
      The lock can be safely removed because of how is used the cpuidle
      API.  Namely, cpuidle_register_driver() is called first, but the
      cpuidle idle function is not entered before cpuidle_register_device()
      is called, because the cpuidle device is not enabled then. Moreover,
      cpuidle_unregister_driver(), which would reset the driver value to
      NULL, is not called before cpuidle_unregister_device().
      
      All of the cpuidle drivers use the API in the same way.
      
      In general, a cleanup around the lock is necessary and a proper
      refcounting mechanism should be used to ensure the consistency in the
      API (for example, cpuidle_unregister_driver() should fail if the
      driver's refcount is not 0). However, these modifications will require
      some code reorganization and rewrite which will be too intrusive for
      a fix.

To manage notifications about this bug go to:
https://bugs.launchpad.net/linaro-power-kernel/+bug/1098343/+subscriptions


Follow ups

References