lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121231150833.GA5425@sgi.com>
Date:	Mon, 31 Dec 2012 09:08:33 -0600
From:	Russ Anderson <rja@....com>
To:	Daniel Lezcano <daniel.lezcano@...aro.org>
Cc:	rafael.j.wysocki@...el.com, linux-pm@...r.kernel.org,
	pdeschrijver@...dia.com, akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org, rja@...ricas.sgi.com
Subject: Re: [PATCH] cpuidle - fix lock contention in the idle path

On Sat, Dec 29, 2012 at 11:03:03AM +0100, Daniel Lezcano wrote:
> 
> Hi Russ,
> 
> Is it possible you try this patch on your 2048 cpus ?

Yes, I will try it later today.
Thanks


> Thanks
> 
>   -- Daniel
> 
> On 12/26/2012 11:01 AM, Daniel Lezcano wrote:
> > The commit bf4d1b5ddb78f86078ac6ae0415802d5f0c68f92 introduces
> > a lock in the cpuidle_get_cpu_driver function. This function
> > is used in the idle_call function.
> > 
> > The problem is the contention with a large number of cpus because
> > they try to access the idle routine at the same time.
> > 
> > The lock could be safely removed because of how is used the
> > cpuidle api. The cpuidle_register_driver is called first but
> > until the cpuidle_register_device is not called we don't
> > enter in the cpuidle idle call function because the device
> > is not enabled.
> > 
> > The cpuidle_unregister_driver function, leading the a NULL driver,
> > is not called before the cpuidle_unregister_device.
> > 
> > This is how is used the cpuidle api from the different drivers.
> > 
> > However, a cleanup around the lock and a proper refcounting
> > mechanism should be used to ensure the consistency in the api,
> > like cpuidle_unregister_driver should failed if its refcounting
> > is not 0.
> > 
> > These modifications will need some code reorganization and rewrite
> > which does not fit with a fix.
> > 
> > The following patch is a hot fix by returning to the initial behavior
> > by removing the lock when getting the driver.
> > 
> > Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
> > ---
> >  drivers/cpuidle/driver.c |    8 +-------
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
> > index 3af841f..c2b281a 100644
> > --- a/drivers/cpuidle/driver.c
> > +++ b/drivers/cpuidle/driver.c
> > @@ -235,16 +235,10 @@ EXPORT_SYMBOL_GPL(cpuidle_get_driver);
> >   */
> >  struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev)
> >  {
> > -	struct cpuidle_driver *drv;
> > -
> >  	if (!dev)
> >  		return NULL;
> >  
> > -	spin_lock(&cpuidle_driver_lock);
> > -	drv = __cpuidle_get_cpu_driver(dev->cpu);
> > -	spin_unlock(&cpuidle_driver_lock);
> > -
> > -	return drv;
> > +	return __cpuidle_get_cpu_driver(dev->cpu);
> >  }
> >  EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver);
> >  
> > 
> 
> 
> -- 
>  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
> 
> Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
> <http://twitter.com/#!/linaroorg> Twitter |
> <http://www.linaro.org/linaro-blog/> Blog

-- 
Russ Anderson, OS RAS/Partitioning Project Lead  
SGI - Silicon Graphics Inc          rja@....com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ