Re: the computer hungs when using LKM

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

 



On Thu, 2005-04-14 at 16:15 +0800, qiang zeng wrote:
> The program works
> fine,but sometimes it hungs for no reason, for example, the LKM is
> loaded , but the pc is left alone with writing anything.

This sounds like some kind of locking/deadlock problem.  Here are a few
things to think about.  

Are you obtaining any locks?   
Multiple locks at once?  
Do you obtain them in the correct order and with the correct methods?

I notices you use lock_kernel();  From what I gather, this is kind of
frowned upon for performance and cleanliness reasons ;)  Better to lock
ONLY what data you actually need to protect.

Also,
f = filp_open("/tmp/log.txt", O_CREAT | O_APPEND, 00600);
Look like you are attempting to do direct file I/O.  Kernel code is not
the place for this kind of thing.  What you SHOULD do is use one of the
kernelspace --> userspace communication mediums.  I think the Netlink
architecture would work well for this sort of thing.  Here is a good
Linux Journal link for Netlink: http://www.linuxjournal.com/article/7356

Hope this helps.


-- 
Jason J. Herne <hernejj@xxxxxxxxxxxx>


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux