Re: [PATCH/RFC] I/O-check interface for driver's error handling

From: linux-os <linux-os_at_analogic.com>
Date: 2005-03-03 05:03:47
On Wed, 2 Mar 2005, Linas Vepstas wrote:

> On Wed, Mar 02, 2005 at 11:28:01AM +0900, Hidetoshi Seto was heard to remark:
>>
>> Note that here is a difficulty: the MCA handler on some arch would run on
>> special context - MCA environment. In other words, since some MCA handler
[SNIPPED...]

>
> /**
> * queue up a pci error event to be dispatched to all listeners
> * of the pci error notifier call chain.  This routine is safe to call
> * within an interrupt context.  The actual event delivery
> * will be from a workque thread.
> */
>
> void eeh_queue_failure(struct pci_dev *dev)
> {
> 	struct eeh_event  *event;
>
>   event = kmalloc(sizeof(*event), GFP_ATOMIC);
>   if (event == NULL) {
>      printk (KERN_ERR "EEH: out of memory, event not handled\n");
>      return 1;
>   }
>
>   event->dev = dev;
>   event->reset_state = rets[0];
>   event->time_unavail = rets[2];
>
>   /* We may be called in an interrupt context */
>   spin_lock_irqsave(&eeh_eventlist_lock, flags);
     ^^^^^^^^^^^^^^^^^^
>   list_add(&event->list, &eeh_eventlist);
>   spin_unlock_irqrestore(&eeh_eventlist_lock, flags);
     ^^^^^^^^^^^^^^^^^^^^^

I don't think this is SMP safe from interrupt-context.
You need the lock when you are building the event-list,
not just when you queue it.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.11 on an i686 machine (5537.79 BogoMips).
  Notice : All mail here is now cached for review by Dictator Bush.
                  98.36% of all statistics are fiction.
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Mar 2 13:13:40 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:36 EST