From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Johannes Berg <johannes@sipsolutions.net>,
Greg KH <gregkh@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
Len Brown <lenb@kernel.org>, Ingo Molnar <mingo@elte.hu>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
pm list <linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH] PM: Acquire device locks on suspend
Date: Thu, 10 Jan 2008 17:59:09 +0100 [thread overview]
Message-ID: <200801101759.10701.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0801101033390.4267-100000@iolanthe.rowland.org>
On Thursday, 10 of January 2008, Alan Stern wrote:
> On Thu, 10 Jan 2008, Rafael J. Wysocki wrote:
>
> > On Wednesday, 9 of January 2008, Alan Stern wrote:
> > > On Wed, 9 Jan 2008, Rafael J. Wysocki wrote:
> > >
> > > > > In dpm_resume() you shouldn't need to use dpm_list_mtx at all, because
> > > > > the list_move_tail() comes before the resume_device(). It's the same
> > > > > as in dpm_power_up().
> > > >
> > > > Still, device_pm_schedule_removal() can (in theory) be called concurrently
> > > > with dpm_resume() by another thread and this might corrupt the list without
> > > > the locking.
> > >
> > > Any thread doing that would be in violation of the restrictions you're
> > > going to add to the kerneldoc for destroy_suspended_device().
> > >
> > > However the overhead for the locking isn't critical. There won't be
> > > any contention (if everything is working right) and it isn't a hot path
> > > anyway. So you can leave the extra locking in if you want. But then
> > > you should put it in all the routines where the lists get manipulated,
> > > not just some of them. That is: device_power_down(), dpm_power_up(),
> > > and even unregister_dropped_devices().
> >
> > Except for those run on one CPU with interrupts disabled, I think.
>
> Not unregister_dropped_devices()!
Sure, it will need locking around the check in while().
> > > > > Also, the kerneldoc for destroy_suspended_device() should contain an
> > > > > extra paragraph warning that the routine should never be called except
> > > > > within the scope of a system sleep transition. In practice this means
> > > > > it has to be directly or indirectly invoked by a suspend or resume
> > > > > method.
> > > >
> > > > Or by a CPU hotplug notifier (that will be the majority of cases, IMO).
> > >
> > > In your patch the call is made in response to a CPU_UP_CANCELED_FROZEN
> > > notification. Isn't it true that this notification is issued only as
> > > part of a system sleep transition?
> >
> > Yes, it is.
>
> So it counts as being indirectly invoked by a resume method.
Rather, by the resume core. Technically, it's invoked by
enable_nonboot_cpus(), which is not a resume method literally.
Greetings,
Rafael
next prev parent reply other threads:[~2008-01-10 16:56 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-05 18:36 [PATCH] PM: Acquire device locks on suspend Rafael J. Wysocki
2008-01-05 20:08 ` Alan Stern
2008-01-05 20:19 ` Rafael J. Wysocki
2008-01-05 20:39 ` Alan Stern
2008-01-05 21:13 ` Rafael J. Wysocki
2008-01-05 21:41 ` Alan Stern
2008-01-05 21:58 ` Rafael J. Wysocki
2008-01-06 4:04 ` Alan Stern
2008-01-06 13:19 ` Rafael J. Wysocki
2008-01-06 17:06 ` Alan Stern
2008-01-06 19:05 ` Rafael J. Wysocki
2008-01-06 19:57 ` Rafael J. Wysocki
2008-01-06 22:19 ` Rafael J. Wysocki
2008-01-06 22:21 ` Alan Stern
2008-01-06 22:34 ` Rafael J. Wysocki
2008-01-06 22:39 ` Alan Stern
2008-01-06 22:47 ` Rafael J. Wysocki
2008-01-06 23:46 ` Johannes Berg
[not found] ` <49505.::ffff:91.5.86.36.1199663162.squirrel@secure.sipsolutions.net>
2008-01-06 23:59 ` [linux-pm] " Rafael J. Wysocki
2008-01-07 0:49 ` Rafael J. Wysocki
2008-01-07 16:16 ` Alan Stern
2008-01-07 16:51 ` Rafael J. Wysocki
2008-01-07 17:23 ` Alan Stern
2008-01-07 18:01 ` Rafael J. Wysocki
2008-01-07 19:29 ` Alan Stern
2008-01-07 20:37 ` Rafael J. Wysocki
2008-01-07 21:32 ` Alan Stern
2008-01-08 0:25 ` Rafael J. Wysocki
2008-01-09 21:01 ` Alan Stern
2008-01-09 22:14 ` Rafael J. Wysocki
2008-01-09 22:46 ` Alan Stern
2008-01-09 23:29 ` Rafael J. Wysocki
2008-01-10 15:35 ` Alan Stern
2008-01-10 16:59 ` Rafael J. Wysocki [this message]
2008-01-10 17:04 ` Alan Stern
2008-01-06 22:11 ` Alan Stern
2008-01-06 22:24 ` Rafael J. Wysocki
2008-01-06 22:31 ` Alan Stern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200801101759.10701.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=johannes@sipsolutions.net \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=mingo@elte.hu \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox