Re: [PATCH] NMI request/release, version 4

From: Dipankar Sarma (dipankar@gamebox.net)
Date: Thu Oct 24 2002 - 02:50:04 EST


Ok, some more comments -

On Wed, Oct 23, 2002 at 03:14:52PM -0500, Corey Minyard wrote:
> +void release_nmi(struct nmi_handler *handler)
> +{
> + wait_queue_t q_ent;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&nmi_handler_lock, flags);
> + list_del_rcu(&(handler->link));
> +
> + /* Wait for handler to finish being freed. This can't be
> + interrupted, we must wait until it finished. */
> + init_waitqueue_head(&(handler->wait));
> + init_waitqueue_entry(&q_ent, current);
> + add_wait_queue(&(handler->wait), &q_ent);
> + call_rcu(&(handler->rcu), free_nmi_handler, handler);
> + for (;;) {
> + set_current_state(TASK_UNINTERRUPTIBLE);
> + if (list_empty(&(handler->link)))
> + break;
> + spin_unlock_irqrestore(&nmi_handler_lock, flags);
> + schedule();
> + spin_lock_irqsave(&nmi_handler_lock, flags);
> + }
> + remove_wait_queue(&(handler->wait), &q_ent);
> + spin_unlock_irqrestore(&nmi_handler_lock, flags);
> +}

Can release_nmi() be done from irq context ? If not, I don't see
why spin_lock_irqsave() is required here. If it can be called
from irq context, then I can't see how you can schedule()
(or wait_for_completion() for that matter :)).

Thanks
Dipankar
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Oct 31 2002 - 22:00:22 EST