kernel threads in drivers using the RT patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm studying how to develop drivers in a real time OS and how do they work. I'm using Ubuntu 10.04 with the 2.6.31-11-rt patch installed. I'm trying to run a kernel thread from my driver (kernel context). I create the kthread in the module_init, I change its real time priority and then make it run .
Code shown below:

thread_handler=*(struct task_struct *)kthread_create(my_tasklet_handler, (void*)&datos,"thread_handler");
  if (IS_ERR(&thread_handler)){
     return PTR_ERR(&thread_handler);
printk(KERN_WARNING "<pci> (init_module) Error creating Thread handler\n");
  }
params->sched_priority=20;
result = sched_setscheduler(&thread_handler, SCHED_FIFO, params);
result=wake_up_process(&thread_handler);

Params is global struct sched_param * and struct thread_handler a global task_struct.

I stop the Kthread in the module_exit using res=kthread_stop(&thread_handler);

The kthread "thread_handler" has a while (1) loop and it is stopped in a semaphore, waiting for the interrupt handler. When it wakes up each time it calls kthread_should_stop() and depending on that break out of the loop or run.

My problem is, when trying to establish the rtprio kthread, the whole computer get blocked and I only can restart it. If I delete this part, then kthread runs, and works well. With the ps command I can see it has a 24 NON real time priority. Then the problem come when uninstalling my module with rmmod. In the kthread_stop function, everything gets blocked.

Could someone tell what am I doing wrong? Or just give me some help about kernel threads in the RT Patch?

Thanks a lot

Mónica
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux