All of lore.kernel.org
 help / color / mirror / Atom feed
* mixing interupts and threads.
@ 2008-07-07  4:45 ravikumar
  2008-07-07  4:56 ` Scott Lovenberg
  2008-07-07 10:19 ` Matthew Wilcox
  0 siblings, 2 replies; 3+ messages in thread
From: ravikumar @ 2008-07-07  4:45 UTC (permalink / raw)
  To: kernel-janitors

Hello All ,
I've a few questions.
1. Lets suppose i've some critical section and it is synchronized with 
locks. A thread came and  it's  execution  is in the middle of critical 
section, at this time an interrupt was occurred which  also executes 
critical section. As interrupts can't wait on any lock it will get lock 
and try to execute the critical section and above thread was not yet 
completed. So inconsistency . How this was handled in Linux.
2.Some process is running in kernel mode, at this a kill was sent to 
this process, does this signal will delivered to the process while it is 
in kernel mode.

And also please provide some links  how threads ,signals and interrupts 
will be mixed.

Regards,
Ravikumar.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mixing interupts and threads.
  2008-07-07  4:45 mixing interupts and threads ravikumar
@ 2008-07-07  4:56 ` Scott Lovenberg
  2008-07-07 10:19 ` Matthew Wilcox
  1 sibling, 0 replies; 3+ messages in thread
From: Scott Lovenberg @ 2008-07-07  4:56 UTC (permalink / raw)
  To: kernel-janitors

ravikumar wrote:
> Hello All ,
> I've a few questions.
> 1. Lets suppose i've some critical section and it is synchronized with 
> locks. A thread came and  it's  execution  is in the middle of 
> critical section, at this time an interrupt was occurred which  also 
> executes critical section. As interrupts can't wait on any lock it 
> will get lock and try to execute the critical section and above thread 
> was not yet completed. So inconsistency . How this was handled in Linux.
> 2.Some process is running in kernel mode, at this a kill was sent to 
> this process, does this signal will delivered to the process while it 
> is in kernel mode.
>
> And also please provide some links  how threads ,signals and 
> interrupts will be mixed.
>
> Regards,
> Ravikumar.
1.)This should play out slightly different on uniprocessor vs. SMP, but, 
IIRC, during a critical section on uniprocessor IRQs are masked and 
queued as they come in.  In SMP, they should be routed to another 
processor, which should queue them if they need locked resources.  
Someone please correct me if I'm incorrect.

2.)I do not know the answer to this question. :)  Does anyone else know?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mixing interupts and threads.
  2008-07-07  4:45 mixing interupts and threads ravikumar
  2008-07-07  4:56 ` Scott Lovenberg
@ 2008-07-07 10:19 ` Matthew Wilcox
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Wilcox @ 2008-07-07 10:19 UTC (permalink / raw)
  To: kernel-janitors

On Mon, Jul 07, 2008 at 10:03:26AM +0530, ravikumar wrote:
> 1. Lets suppose i've some critical section and it is synchronized with 
> locks. A thread came and  it's  execution  is in the middle of critical 
> section, at this time an interrupt was occurred which  also executes 
> critical section. As interrupts can't wait on any lock it will get lock 
> and try to execute the critical section and above thread was not yet 
> completed. So inconsistency . How this was handled in Linux.

I recommend you read the excellent
Documentation/DocBook/kernel-locking.tmpl.  If you run 'make pdfdocs',
you can read it as a pdf (other output formats also available).

The short answer to your question is that interrupts should be disabled
while the thread is holding the spinlock.

> 2.Some process is running in kernel mode, at this a kill was sent to 
> this process, does this signal will delivered to the process while it is 
> in kernel mode.

Yes.  If you examine the implementation of, say,
mutex_lock_interruptible(), you'll see how it checks to see whether
signals are pending.  Other functions ending in _interruptible() will
likely do similar checks.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-07 10:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-07  4:45 mixing interupts and threads ravikumar
2008-07-07  4:56 ` Scott Lovenberg
2008-07-07 10:19 ` Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.