LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 05-21-2009, 03:29 AM   #1
webquinty
Member
 
Registered: Apr 2008
Location: Espaņa
Distribution: Suse
Posts: 210

Rep: Reputation: 32
Some doubts about develop a linux driver.


Hello,

I have develop a linux driver and it works fine.

But I have some doubts it. For example I have a PCI card with FPGA and it have two CAN ports. Anyway, I can write and read pci registers.

My problem is that I do not what happen is there are two threads with RT priority. For example thread one with priority -90 and thread two with priority -85. In this conditions, thread one can interrupt thread two. Then, my questions is, if thread two try to read 4 registers from PCI and thread one interrupt it to write other 4 register in pci card, what is the result???

I am interesting in all threads can completed all read or all write register without interrupt. I have read information about atomic and spinlock but I not sure if it is necessary.

I am very sorry if I have not explained correctly.

Best reagards.
 
Old 05-21-2009, 07:03 PM   #2
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,377

Rep: Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108
Spinlocks et al are absolutely necessary. You must design your entire driver so that it uses these mechanisms correctly and appropriately. This is the solution to your problem.

Consider this: your driver code will be executed thousands of times a second. If the odds are "one in a million" that this-or-that timing problem might occur, then the odds are near-100% that the system will crash-and-burn in just a few minutes (at best).

Remember also: there may be multiple CPUs involved. Therefore, the number of timing-possibilities cannot be predicted. Your logic therefore must use kernel locking mechanisms in such a way that race-conditions cannot occur.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Doubts about timers in linux kernel iamjayanth Linux - Kernel 5 01-31-2012 06:53 PM
Doubts about PCIe device driver rwpa Linux - Newbie 4 12-10-2008 08:25 AM
How to develop PCI BUS DRIVER ? xp4105 Linux - Kernel 0 10-18-2007 02:57 AM
Questions from a new linux convert... the doubts wedgea18 Linux - Newbie 8 02-08-2006 01:47 PM
Linux shell doubts pongsu Linux - General 5 09-25-2003 02:51 PM


All times are GMT -5. The time now is 07:56 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration