lkml.org 
[lkml]   [2014]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCHv5 2/4] mailbox: Introduce framework for mailbox
Date
On Wednesday 21 May 2014 18:27:01 Mark Brown wrote:
> > + /* The queued TX requests are simply aborted, no callbacks are made */
> > + spin_lock_irqsave(&chan->lock, flags);
> > + chan->cl = NULL;
> > + chan->active_req = NULL;
> > + if (chan->txdone_method == (TXDONE_BY_POLL | TXDONE_BY_ACK))
> > + chan->txdone_method = TXDONE_BY_POLL;
> > +
> > + module_put(chan->mbox->dev->driver->owner);
> > + spin_unlock_irqrestore(&chan->lock, flags);
>
> Is the module_put() safe in atomic context?
>

I'm pretty sure it is:

void module_put(struct module *module)
{
if (module) {
preempt_disable();
smp_wmb(); /* see comment in module_refcount */
__this_cpu_inc(module->refptr->decs);

trace_module_put(module, _RET_IP_);
preempt_enable();
}
}

This disables preemption around everything it does, so everything inside
is definitely safe in nonpreemptible context.

Arnd


\
 
 \ /
  Last update: 2014-05-21 20:41    [W:0.105 / U:27.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site