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: <AANLkTiktmoiyX4c8x1XtJ353sv0flV5NqIQrptrDXPnM@mail.gmail.com>
Date:	Sat, 26 Jun 2010 21:08:07 -0700
From:	Suresh Rajashekara <suresh.raj+linuxomap@...il.com>
To:	Alan Stern <stern@...land.harvard.edu>
Cc:	linux-omap@...r.kernel.org, linux-pm@...ts.linux-foundation.org,
	LKML <linux-kernel@...r.kernel.org>,
	vivin uthappa <vivinuthappa@...il.com>,
	Sudhakar R <sudhakar.raj@...il.com>
Subject: Re: [linux-pm] wait_for_completion_interruptible does not wait !!

On Sun, Jun 20, 2010 at 8:52 AM, Alan Stern <stern@...land.harvard.edu> wrote:
>
> What happens if the variable is completed while nobody is waiting for
> it?  The next time somebody tries to wait, won't the wait terminate
> immediately?
>

Haven't tested it but will reply with the answer once I get a chance to test it.


>> I tried wait_for_completion instead, but now the kernel refuses to suspend.
>>
>> I have tried wait queues and mutexs with no success.
>>
>> Could anyone please point me how I can resolve this issue? Is there
>> any construct which can block inside the kernel during suspend/resume?
>
> Yes: The freezer.
>
>> Can there be a blocking call active while we suspend?
>
> Yes, in theory.  In practice it's not a good idea, since the call
> wouldn't be able to distinguish between an actual signal and the onset
> of a suspend.  You might end up with a call that ignores all signals
> and hence cannot be interrupted.
>

Just for the information of others on the list, here is what we did to
solve this issue, we designed a freezer-friendly wrapper around
wait_for_completion_interruptible()

<SNIP>
#define wait_for_completion_freezable(ptr_completion)           \
({                                                              \
   int __retval;                                                \
   do {                                                         \
       __retval = wait_for_completion_interruptible(            \
                       ptr_completion);                         \
       if (__retval && !freezing(current))                      \
           break;                                               \
   } while (try_to_freeze());                                   \
   __retval;                                                    \
})

</SNIP>

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