Re: Systems FREEZES when IOCTL is issued from user-space program
Der Herr Hofrat <[email protected]> Sun, 13 Nov 2005 21:18:54 +0100 (CET)
| Newsgroups | gmane.linux.real-time.rtlinux.general |
|---|---|
| Message-ID | <[email protected]> |
> HI > I am working on a device driver for a uni robot project. The driver is like a job-based (or queue-based ) driver. Each job in the queue is like some bit-patterns that has to be maintained for some amount of time in the parallel port. After completeting one such job, the driver picks the next job and repeats. For holding the bit-pattern i am using "clock_nanosleep." When the queue is empty, i.e. there is no job to be performed, the driver thread simple goes to sleep mode by "pthread_suspend_np( pthread_self())." When one job enters the queue... througth IOCTL issued from user-space program, the driver-thread is woken up using "pthread_wakeup_np( g_driver_thread)." Now, am i doing anything wrong here ? > > I am asking this because, sometimes when i do "ioctl" from user-space program (specially to "add" a job) to the driver, the whole SYSTEM FREEZES !!! and there is no way other than to reset the computer. A little juggling with the code.. somehow solves the problem.. but again reappers when i reboot the computer and run the user-space program again !!!. A lil shuffling of the code solves the problem but again reappears after one reboot !!!!!. Interestingly.. all other ioctl ( other than "adding" job ) works absolutely fine. And the code that deals with "adding job" is very simple, and it doesn't deal with any pointer or such, just that at the end it checks whether the job that is being added now is the first job of the queue or not, and in that case, it does a "pthread_wakeup_np( g_driver_thread)." > > Later, just to test, i added one "job" in the "init_module" , but that doesn't create any problem. It seems the problem is only created when the same thing is done from user-space program !!!!.. i am running totally crazy here.... plz help > It is hard to say what is going wrong if you don't provide any info on the kernel/rtlinux version involved - my best guess is that the wakeup is not actually rt-safe - have you checked if it is ? >From the symptoms you describe one could speculate that you have a memory leak somewhere and thus adding jobs is more or less randoomly messing up some memory area - but its hard to diagnose without seeing any code. hofrat _______________________________________________ Rtl mailing list [email protected] http://hq.fsmlabs.com/mailman/listinfo/rtl http:/www.rtlinux-gpl.org/