BUG: sleeping function called from invalid context

Dave Hylands dhylands at gmail.com
Tue Aug 30 11:14:33 EDT 2011


Hi sandeep,

On Tue, Aug 30, 2011 at 6:28 AM, sandeep kumar
<coolsandyforyou at gmail.com> wrote:
> Hi all,
> I am working on android, linux kernel version: 2.6.35.11
>
> I am getting this following error message. I know it occurs when u call a
> sleeping function in atomic context.
> As far as i knew the entire stack of functions,nothing is atomic
> context(these are standard platform dev add functions...)
>
> Now i want to know these things..
> 1) Is there any method to know, when and where this atomic context started?
>            (i put a log in the "msm_bus_fabric_probe" function, to check
> whether it is atomic or not using "in_atomic()"..it is giving '0', and also
> i read that in_atomic wont always work well in all cases in the header file)
>
> 2) Can we neglect this warning, is it very important? because lot of similer
> cases,(where "clk_get_sys" is called)
> are working fine. only this thing is showing warning message. can we
> overlook this?

It's inidicative  of a bug in the code somewhere. It may be unrelated
to the backtrace. For example, this was detected while adding devices.
Maybe the device that was added before this one entered the atomic
context and forgot to leave it.

The error seems to indicate that you're in an atomic context but that
interrupts are enabled, which would imply that preemption has been
disabled.

Perhaps you can call might_sleep() (which is what mutex_lock is
calling) to see if the BUG triggers at one of the might_sleep calls
that you added.

You said that you called in_atomic() from msm_bus_fabric_probe and
that it returned zero. Did you do this immediately before the
mutex_lock call that's complaining?

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com



More information about the Kernelnewbies mailing list