LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 10-07-2010, 07:10 AM   #1
gtirtha
LQ Newbie
 
Registered: Oct 2010
Posts: 6

Rep: Reputation: 1
Workq problem


Hi All,

On my current work, I have been dealing with workq.
In my ISR I am scheduling a workq to read interrupt status registers. Before scheduling I have a check if(!work_pending(work)).
This is because, even in case of different interrupt, already scheduled workq can serve. But if currently scheduled workq is running, then we will schedule another one to ensure no interrupt is missed.

Now, I have observed, when we queuing a work i.e insert_work(), linux set WORK_STRUCT_PENDING bit of work->data. And in run_workqueue() it clears the same. Which theoretically means, whenever a work is within queue its WORK_STRUCT_PENDING will be set and once it will get the CPU to run WORK_STRUCT_PENDING will be cleared.

As per this logic, my if(!work_pending(work)) should work good, but I have seen, if interrupts are generated very fast, say if I continuously generate any interrupt (which are placed at initial positions of interrupt status register) for 30-40 sec, my interrupt bits will be unread (those are read and clear bits). and so further these interrupt wont be generated until some other interrupt occurred and cause to schedule a workq to read all status registers.

I am using I2C to read the status registers.

Any, reason for this behavior???

my demo code

Code:
static void my_workq(struct work_struct *work)
{
	for MAX_NUM_STATUS_REGISTER 
		read all and store in a local variable
        for all set bit in local variable call corresponding handler
}

static irqreturn_t my_isr(int irq, void *dev_id)
{
	if(!work_pending(mywork))
		schedule_work(mywork);
}
 
  


Reply



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
Sound Card problem(every time i install linux i have diffirent hardware problem) jacka1l Linux - Newbie 7 08-11-2005 06:10 AM
Lan configuration problem - NFS boot problem - RX&TX packets errors 242VDM242 Linux - Networking 4 11-25-2004 01:35 PM
Internet and LAN access is unstable-is this a hardware problem or a software problem? soren625 Linux - Networking 1 06-07-2004 06:43 AM
perl problem? apache problem? cgi problem? WorldBuilder Linux - Software 1 09-17-2003 07:45 PM
Not as much of a Solaris problem rether hardware Ultra 10 problem (video card) neo77777 Solaris / OpenSolaris 7 06-24-2003 08:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:45 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration