lkml.org 
[lkml]   [2008]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Bug 10030] Suspend doesn't work when SD card is inserted
On Sun, 24 Feb 2008, Pavel Machek wrote:

> > > What locking protects this variable? What happens when suspending_task
> > > exits? (Hmm, that would probably be bug, anyway?)
> >
> > It's protected by whatever existing locking scheme allows only one
> > task to start a system sleep at a time. For example, the suspending
> > task has to get a write lock on pm_sleep_rwsem.
>
> And readers of suspending_task are protected by?

I added a comment about that too.

> At the very least, you'd need rmb() before reading it and wmb() after
> writing to it, but I'm not sure if that's enough on every obscure
> architecture out there.

No, neither one is needed because of the way suspending_task is used.

It's not necessary for a reader R to see the variable's actual value;
all R needs to know is whether or not suspending_task is equal to R.
Since the only process which can set suspending_task to R is R itself,
and since R will set suspending_task back to NULL before releasing the
write lock on pm_sleep_rwsem, there's never any ambiguity.

Alan Stern



\
 
 \ /
  Last update: 2008-02-24 23:27    [W:0.095 / U:7.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site