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] [day] [month] [year] [list]
Message-ID: <1351124446.2207.12.camel@ymzhang.sh.intel.com>
Date:	Thu, 25 Oct 2012 08:20:46 +0800
From:	Yanmin Zhang <yanmin_zhang@...ux.intel.com>
To:	"Rafael J. Wysocki" <rjw@...k.pl>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	zhanglong <longzhax@...el.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Alan Stern <stern@...land.harvard.edu>,
	"linux-pm@...ts.linux-foundation.org" 
	<linux-pm@...ts.linux-foundation.org>
Subject: Re: [PATCH v2] drivers-core: move the calling to device_pm_remove
 behind the calling to bus_remove_device

On Thu, 2012-10-25 at 00:33 +0200, Rafael J. Wysocki wrote:
> On Wednesday 24 of October 2012 15:13:27 Greg Kroah-Hartman wrote:
> > On Wed, Oct 24, 2012 at 09:46:19PM +0200, Rafael J. Wysocki wrote:
> > > On Tuesday 16 of October 2012 23:28:08 zhanglong wrote:
> > > > We hit an hang issue when removing a mmc device on Medfield Android phone by sysfs interface.
> > > > 
> > > > device_pm_remove will call pm_runtime_remove which would disable
> > > > runtime PM of the device. After that pm_runtime_get* or
> > > > pm_runtime_put* will be ignored. So if we disable the runtime PM
> > > > before device really be removed, drivers' _remove callback may
> > > > access HW even pm_runtime_get* fails. That is bad.
> > > > 
> > > > Consider below call sequence when removing a device:
> > > > device_del => device_pm_remove
> > > >              => class_intf->remove_dev(dev, class_intf)  => pm_runtime_get_sync/put_sync
> > > >              => bus_remove_device => device_release_driver => pm_runtime_get_sync/put_sync
> > > > 
> > > > remove_dev might call pm_runtime_get_sync/put_sync.
> > > > Then, generic device_release_driver also calls pm_runtime_get_sync/put_sync.
> > > > Since device_del => device_pm_remove firstly, later _get_sync wouldn't really wake up the device. 
> > > > 
> > > > I git log -p to find the patch which moves the calling to device_pm_remove ahead.
> > > > It's below patch:
> > > > 
> > > > commit  775b64d2b6ca37697de925f70799c710aab5849a
> > > > Author: Rafael J. Wysocki <rjw@...k.pl>
> > > > Date:   Sat Jan 12 20:40:46 2008 +0100
> > > > 
> > > >      PM: Acquire device locks on suspend
> > > > 
> > > >      This patch reorganizes the way suspend and resume notifications are
> > > >      sent to drivers.  The major changes are that now the PM core acquires
> > > >      every device semaphore before calling the methods, and calls to
> > > >      device_add() during suspends will fail, while calls to device_del()
> > > >      during suspends will block.
> > > > 
> > > >      It also provides a way to safely remove a suspended device with the
> > > >      help of the PM core, by using the device_pm_schedule_removal() callback
> > > >      introduced specifically for this purpose, and updates two drivers (msr
> > > >      and cpuid) that need to use it. 
> > > > 
> > > > 
> > > > As device_pm_schedule_removal is deleted by another patch, we need also revert other parts of the patch,
> > > > i.e. move the calling of device_pm_remove after the calling to bus_remove_device.
> > > > 
> > > > Signed-off-by: LongX Zhang <longx.zhang@...el.com>
> > > 
> > > Greg, do you see any potential problems with this patch?
> > 
> > No, no objection from me:
> > 
> > Acked-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> 
> OK, thanks!
> 
> Applied to linux-pm.git/linux-next as v3.8 material.
Rafael,

As usual, I really appreciate it!

Yanmin


--
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