On Fri, Nov 29, 2013 at 9:27 PM, Linus Walleij <[email protected]> wrote:
> On Thu, Nov 28, 2013 at 8:16 PM, Ezequiel Garcia
> <[email protected]> wrote:
>> Hi Linus,
>> On Sun, Nov 24, 2013 at 09:37:45AM -0300, Ezequiel Garcia wrote:
>>> These warnings can be very spammy, since they could be called from
>>> kernel threads. Use WARN_ON_ONCE, which is enough to warn developers
>>> about the 'can_sleep' usage.
>>>
>>> Signed-off-by: Ezequiel Garcia <[email protected]>
> (...)
>> Any comments on this?
>
> I'm a bit hesitant because I don't know the conventions for WARN_ON_ONCE()
> vs WARN_ON().
>
> I'd like some wider input if possible, Alexandre, Grant, what do you say?

I'd say WARN_ON() is just appropriate here. Calling a preemptible
function from a context that cannot sleep is a serious issue and you
cannot nag the user enough about it. At least if something bad happens
due to this condition the warning is guaranteed to be one of the last
messages the user will see before the system locks. Change it with
WARN_ON_ONCE() and chances are high that the system will hang without
any meaningful log near the point of failure.

Each caller should know whether it is running in preemptible context
or not and can thus use the right function, so I don't see any reason
to relax the rules here.

If we could know for sure at runtime whether we are running in
preemptible context or not we could probably merge these functions
into one and warn more appropriately on a per-case basis, but as far
as I know (which is not very far) there is no such way.

Alex.
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to