Can the Linux Linked List API be used safely inside of an interrupt handler? -


i writing device driver custom piece of hardware using linux kernel 2.6.33. need using dma transfer data , device. output dma, thinking keep track of several output buffers using linked list api (struct list_head, list_add(), etc.).

when device finished dma transfer, raises interrupt. interrupt handler retrieve item in linked list transfer, , remove list.

my question is, safe thing inside of interrupt handler? or there inherent race conditions in api make not safe?

the small section in linux device drivers, 3rd ed. doesn't make mention of this. section in essential linux device drivers more complete not touch on subject.

edit: beginning think may not race condition free msh suggests, due note listed in list_empty_careful() function:

* note: using list_empty_careful() without synchronization * can safe if activity can happen * list entry list_del_init(). eg. cannot used * if cpu re-list_add() it. 

http://lxr.free-electrons.com/source/include/linux/list.h?v=2.6.33;a=powerpc#l202

note plan add queue in process context , remove queue in interrupt context. not need synchronization around functions list?

it safe use kernel linked lists in interrupt context, but retrieving in interrupt handlers bad idea. in interrupt handler should acknowledge interrupt, schedule "bottom half" , quit. processing should done "bottom half" (bottom half piece of deferred work - there several suitable mechanisms - tasklets, work queue, etc).


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -