Basically what I'm trying to do is to add a WorkQueue every interrupt, but after exactly 100001 interrupts, the systemm fails and the interrupt doesn't work anymore "irq 63: nobody cared (try booting with the "irqpoll" option)".
This is my code:
Inside.h file:
typedef struct work_struct GFA_DMA_QUEUE_Work_Struct_t;
typedef struct
{
uint32_t dma_length;
uint8_t * dma_page_pointer;
} GFA_DMA_QUEUE_Work_Data_t;
typedef struct
{
GFA_DMA_QUEUE_Work_Struct_t Work;
GFA_DMA_QUEUE_Work_Data_t Data;
GFA_DMA_QUEUE_Work_t;
}
Inside .c file:
static struct workqueue_struct * GFA_DMA_QUEUE_workqueue;
GFA_DMA_QUEUE_Work_t * dma_queue_work;
create_task( dma_page_pointer,dma_length)
{
//.....
dma_queue_work = (GFA_DMA_QUEUE_Work_t *) kmalloc( sizeof(GFA_DMA_QUEUE_Work_t), __GFP_NOFAIL | GFP_KERNEL );
dma_queue_work->Data.dma_length = dma_length;
dma_queue_work->Data.dma_page_pointer = dma_page_pointer;
INIT_WORK ( (GFA_DMA_QUEUE_Work_Struct_t *)dma_queue_work, GFA_DMA_QUEUE_queue_handler);
retVal = queue_work (GFA_DMA_QUEUE_workqueue, (GFA_DMA_QUEUE_Work_Struct_t * )dma_queue_work);
}
static void GFA_DMA_QUEUE_queue_handler( GFA_DMA_QUEUE_Work_Struct_t * Dma_Queue_Work )
{
//.....
kfree( dma_queue_work );
}
Inside the interrupt:
I just call create_tasks() function with the right parameters.
And after 100001 interrupts, I got "irq 63: nobody cared (try booting with the "irqpoll" option)". The system was working as it should be.
The time that the interrupt needs to create the task in about 6uSecs, so is not a problem.
I unmount the module and mount again and everytime that the interruption arrives to 100001 failed.
Could be a memory leak? Is the a way to check memory leaks in the kernel module?
Do you have and idea that it could be happening?
Thanks,
GFP_KERNELwithin interrupt handler? Really? Almost every manual about Linux kernel programming tells that this is prohibited. You need to useGFP_ATOMICand be ready to allocation failures. - Tsyvarev