[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201203150111.05724.rjw@sisk.pl>
Date: Thu, 15 Mar 2012 01:11:05 +0100
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Stephen Boyd <sboyd@...eaurora.org>
Cc: Saravana Kannan <skannan@...eaurora.org>,
Kay Sievers <kay.sievers@...y.org>,
Greg KH <gregkh@...uxfoundation.org>,
Christian Lamparter <chunkeey@...glemail.com>,
linux-kernel@...r.kernel.org,
"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
alan@...rguk.ukuu.org.uk,
Linus Torvalds <torvalds@...ux-foundation.org>,
Linux PM mailing list <linux-pm@...r.kernel.org>
Subject: Re: [PATCH] firmware loader: don't cancel _nowait requests when helper is not yet available
On Thursday, March 15, 2012, Stephen Boyd wrote:
> On 03/14/12 16:34, Rafael J. Wysocki wrote:
> > On Thursday, March 15, 2012, Stephen Boyd wrote:
> >> On 03/14/12 16:13, Rafael J. Wysocki wrote:
> >>> On Thursday, March 15, 2012, Rafael J. Wysocki wrote:
> >>>
> >>>> Which is OK, I think.
> >>> Moreover, thaw_kernel_threads() is _only_ called by (a) freeze_kernel_threads()
> >>> on error and (b) user-space hibernate interface in kernel/power/user.c
> >>> (and please read the comment in there describing what it's there for, which
> >>> also explains why the schedule() call in there is necessary).
> >> Exactly. So in case (a) when the error occurs we'll have this call flow:
> >>
> >> usermodehelpers_disable()
> >> suspend_freeze_processes()
> >> freeze_processes()
> >> freeze_kernel_threads()
> >> try_to_freeze_tasks() <-- returns error
> >> thaw_kernel_threads()
> >> schedule()
> >> thaw_processes()
> >> usermodehelpers_enable()
> >>
> >> Shouldn't we schedule only after we thaw all processes (not just tasks)?
> >> Otherwise we may run a kernel thread before userspace is thawed?
> > Yes, we may, but that isn't wrong, is it?
> >
> > Only a few kernel threads are freezable, so definitely kernel threads
> > can run while user space is frozen.
> >
>
> Yes but if someone calls request_firmware() from a kthread then they
> will hit the same problem where the thread runs and requests the
> firmware and usermodehelpers are still disabled. Currently my code is
> written with kthreads and that thread makes the request firmware call,
> so this doesn't seem far fetched (although in my case I can probably fix
> it).
So again, please consider using suspend/resume notifiers to synchronize
your kthread with system power transitions.
> It looks like before 379e0be (PM / Freezer: Thaw only kernel
> threads if freezing of kernel threads fails, 2012-02-03) schedule wasn't
> called until userspace was thawed. It looks like that patch was about
> hibernation and not suspend?
It was about hibernation and it fixed a real bug.
Thanks,
Rafael
--
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