Re: Why can't we sleep in an ISR?

2007-05-17 Thread Dong Feng
Hi, Phillip, I have said the gap between you and me is the definition of context. In Robert's definition, *context* is used in a classification method and really something in higher-level. And I used that term to explain why ISR can not sleep. If you do not like the name, name it your way and

Re: Why can't we sleep in an ISR?

2007-05-17 Thread Phillip Susi
Dong Feng wrote: OK. I think the gap between you and me is the definition of term *context*. If you go to Linux Kernel Development, 2nd Edition (ISBN 0-672-32720-1), Page 6, then you will read the following: in Linux, ... each processor is doing one of three things at any given moment:

Re: Why can't we sleep in an ISR?

2007-05-17 Thread Phillip Susi
Dong Feng wrote: OK. I think the gap between you and me is the definition of term *context*. If you go to Linux Kernel Development, 2nd Edition (ISBN 0-672-32720-1), Page 6, then you will read the following: in Linux, ... each processor is doing one of three things at any given moment:

Re: Why can't we sleep in an ISR?

2007-05-17 Thread Dong Feng
Hi, Phillip, I have said the gap between you and me is the definition of context. In Robert's definition, *context* is used in a classification method and really something in higher-level. And I used that term to explain why ISR can not sleep. If you do not like the name, name it your way and

Re: Why can't we sleep in an ISR?

2007-05-16 Thread Dong Feng
OK. I think the gap between you and me is the definition of term *context*. If you go to Linux Kernel Development, 2nd Edition (ISBN 0-672-32720-1), Page 6, then you will read the following: in Linux, ... each processor is doing one of three things at any given moment: 1. In kernel-space,

Re: Why can't we sleep in an ISR?

2007-05-16 Thread Phillip Susi
Dong Feng wrote: If what you say were true, then an ISR would be running in the same context as the interrupted process. Yes, and it is, as others have said in this thread, which is a good reason why ISRs can't sleep. But please check any article or book, it will say ISR running in

Re: Why can't we sleep in an ISR?

2007-05-16 Thread Phillip Susi
Dong Feng wrote: If what you say were true, then an ISR would be running in the same context as the interrupted process. Yes, and it is, as others have said in this thread, which is a good reason why ISRs can't sleep. But please check any article or book, it will say ISR running in

Re: Why can't we sleep in an ISR?

2007-05-16 Thread Dong Feng
OK. I think the gap between you and me is the definition of term *context*. If you go to Linux Kernel Development, 2nd Edition (ISBN 0-672-32720-1), Page 6, then you will read the following: in Linux, ... each processor is doing one of three things at any given moment: 1. In kernel-space,

Re: Why can't we sleep in an ISR?

2007-05-15 Thread Dong Feng
2007/5/16, Phillip Susi <[EMAIL PROTECTED]>: Dong Feng wrote: >> Doesn't it run in current process's context ? >> > > No. I think the concept of process context is a higher-level logical > concept. Though the interrupt share stack with the interrupted > process, in my opinion it logically does

RE: Why can't we sleep in an ISR?

2007-05-15 Thread David Schwartz
> No, the term context here has a specific meaning. It refers to those > things which flow from the current pointer, including the virtual memory > space, file descriptor table, current uid, and so forth. And none of these things are used by an ISR. > Because the > current pointer is not

Re: Why can't we sleep in an ISR?

2007-05-15 Thread Phillip Susi
Dong Feng wrote: Doesn't it run in current process's context ? No. I think the concept of process context is a higher-level logical concept. Though the interrupt share stack with the interrupted process, in my opinion it logically does not share the context with the process. No, the term

Re: Why can't we sleep in an ISR?

2007-05-15 Thread Dong Feng
Yes, you are right in this regard. An interrupt handler does steal the time slice from the interrupted process. So now I think it is considered an acceptable deviation in calculating the process run time as well as determine process scheduling because an ISR should take very short time to

Re: Why can't we sleep in an ISR?

2007-05-15 Thread Learning Linux
The interrupt handler's execution time will definitely defer the execution of the process, but I think it does not steal the process's time slice (the time_slice field not subtracted). It will definitely be substracted from the process's time slice. Because the timeslice is substracted in timer

Re: Why can't we sleep in an ISR?

2007-05-15 Thread Dong Feng
> > I don't think so but I am not sure. Aliter, i think so.How can an interrupt's execution time go unaccounted then? I guess it does not, only the current processes running time is accounted for. Thoughts? The interrupt handler's execution time will definitely defer the execution of the

Re: Why can't we sleep in an ISR?

2007-05-15 Thread Dong Feng
good enough, but i have a query regarding this then. On a 8K kernel stack system, doesn't interrupts share the stack associated with the current process which was interrupted? Yes, I think so. Doesn't interrupt steals the CPU slice time allocated to the running process to run? I don't

Re: Why can't we sleep in an ISR?

2007-05-15 Thread Dong Feng
good enough, but i have a query regarding this then. On a 8K kernel stack system, doesn't interrupts share the stack associated with the current process which was interrupted? Yes, I think so. Doesn't interrupt steals the CPU slice time allocated to the running process to run? I don't

Re: Why can't we sleep in an ISR?

2007-05-15 Thread Dong Feng
I don't think so but I am not sure. Aliter, i think so.How can an interrupt's execution time go unaccounted then? I guess it does not, only the current processes running time is accounted for. Thoughts? The interrupt handler's execution time will definitely defer the execution of the

Re: Why can't we sleep in an ISR?

2007-05-15 Thread Learning Linux
The interrupt handler's execution time will definitely defer the execution of the process, but I think it does not steal the process's time slice (the time_slice field not subtracted). It will definitely be substracted from the process's time slice. Because the timeslice is substracted in timer

Re: Why can't we sleep in an ISR?

2007-05-15 Thread Dong Feng
Yes, you are right in this regard. An interrupt handler does steal the time slice from the interrupted process. So now I think it is considered an acceptable deviation in calculating the process run time as well as determine process scheduling because an ISR should take very short time to

Re: Why can't we sleep in an ISR?

2007-05-15 Thread Phillip Susi
Dong Feng wrote: Doesn't it run in current process's context ? No. I think the concept of process context is a higher-level logical concept. Though the interrupt share stack with the interrupted process, in my opinion it logically does not share the context with the process. No, the term

RE: Why can't we sleep in an ISR?

2007-05-15 Thread David Schwartz
No, the term context here has a specific meaning. It refers to those things which flow from the current pointer, including the virtual memory space, file descriptor table, current uid, and so forth. And none of these things are used by an ISR. Because the current pointer is not changed on

Re: Why can't we sleep in an ISR?

2007-05-15 Thread Dong Feng
2007/5/16, Phillip Susi [EMAIL PROTECTED]: Dong Feng wrote: Doesn't it run in current process's context ? No. I think the concept of process context is a higher-level logical concept. Though the interrupt share stack with the interrupted process, in my opinion it logically does not share

Re: Why can't we sleep in an ISR?

2007-05-14 Thread Dong Feng
I agree that the reason an interrupt can not sleep is because an interrupt is not associated with any context. But I do not agree that it is specifically because the scheduler can not *resume* the context. In early version, the ISR always borrow the stack of the currently running process, so if

Re: Why can't we sleep in an ISR?

2007-05-14 Thread Rik van Riel
[EMAIL PROTECTED] wrote: Sleeping in an ISR is not fundamentally impossible - I could design a multitasker that permitted it - but has significant problems, and most multitaskers, including Linux, forbid it. You could design a system in which most ISRs can sleep, but even then you'll probably

Re: Why can't we sleep in an ISR?

2007-05-14 Thread Bahadir Balban
On 5/14/07, Learning Linux <[EMAIL PROTECTED]> wrote: Ok, but how about an ISR, that does not take any locks? Why can't we sleep in SUCH an ISR? LL - The killer reason why you can't sleep in an interrupt is because an interrupt is not associated with any context in the first place. What is a

Re: Why can't we sleep in an ISR?

2007-05-14 Thread linux
Sleeping in an ISR is not fundamentally impossible - I could design a multitasker that permitted it - but has significant problems, and most multitaskers, including Linux, forbid it. The first problem is the scheduler. "Sleeping" is actually a call into the scheduler to choose another process to

Re: Why can't we sleep in an ISR?

2007-05-14 Thread Dong Feng
My understanding is as follows. Whenever the kernel code sleeps, it means the latest process running in user space will have to wait for the event on which the kernel code sleeps. It makes sense for an exception handler to sleep because an exception handler always serves the latest process

Re: Why can't we sleep in an ISR?

2007-05-14 Thread Helge Hafting
Learning Linux wrote: I have a very basic doubt here ... what makes it impossible to sleep in an ISR? I mean, I know that the kernel preemption is disabled and the kernel will panic, but I could not understand why? First: an ISR is meant to be very quick. It is supposed to do only a minimum of

Re: Why can't we sleep in an ISR?

2007-05-14 Thread Learning Linux
> I have a very basic doubt here ... what makes it impossible to sleep > in an ISR? I mean, I know that the kernel preemption is disabled and > the kernel will panic, but I could not understand why? Because the interrupt which you are serving in the ISR has been masked to avoid preemption( true

Re: Why can't we sleep in an ISR?

2007-05-14 Thread Learning Linux
I have a very basic doubt here ... what makes it impossible to sleep in an ISR? I mean, I know that the kernel preemption is disabled and the kernel will panic, but I could not understand why? Because the interrupt which you are serving in the ISR has been masked to avoid preemption( true for

Re: Why can't we sleep in an ISR?

2007-05-14 Thread Helge Hafting
Learning Linux wrote: I have a very basic doubt here ... what makes it impossible to sleep in an ISR? I mean, I know that the kernel preemption is disabled and the kernel will panic, but I could not understand why? First: an ISR is meant to be very quick. It is supposed to do only a minimum of

Re: Why can't we sleep in an ISR?

2007-05-14 Thread Dong Feng
My understanding is as follows. Whenever the kernel code sleeps, it means the latest process running in user space will have to wait for the event on which the kernel code sleeps. It makes sense for an exception handler to sleep because an exception handler always serves the latest process

Re: Why can't we sleep in an ISR?

2007-05-14 Thread linux
Sleeping in an ISR is not fundamentally impossible - I could design a multitasker that permitted it - but has significant problems, and most multitaskers, including Linux, forbid it. The first problem is the scheduler. Sleeping is actually a call into the scheduler to choose another process to

Re: Why can't we sleep in an ISR?

2007-05-14 Thread Bahadir Balban
On 5/14/07, Learning Linux [EMAIL PROTECTED] wrote: Ok, but how about an ISR, that does not take any locks? Why can't we sleep in SUCH an ISR? LL - The killer reason why you can't sleep in an interrupt is because an interrupt is not associated with any context in the first place. What is a

Re: Why can't we sleep in an ISR?

2007-05-14 Thread Rik van Riel
[EMAIL PROTECTED] wrote: Sleeping in an ISR is not fundamentally impossible - I could design a multitasker that permitted it - but has significant problems, and most multitaskers, including Linux, forbid it. You could design a system in which most ISRs can sleep, but even then you'll probably

Re: Why can't we sleep in an ISR?

2007-05-14 Thread Dong Feng
I agree that the reason an interrupt can not sleep is because an interrupt is not associated with any context. But I do not agree that it is specifically because the scheduler can not *resume* the context. In early version, the ISR always borrow the stack of the currently running process, so if