Quote:
Originally Posted by shreshtha
1) I read that an ISR cannot cause a page fault. Is the statement true?
|
Page faults are exceptions, and exceptions cannot interrupt ISRs.
I am not sure what would actually happen while inside an ISR if you tried to force access to memory that was paged out. I assume that on an Intel processor, some hardware mechanism would be triggered in the memory management unit which would eventually result in a kernel oops.
Quote:
Originally Posted by shreshtha
2) In the case it is true, how are situations like this handled: an
ISR tries to use a data item that has been swapped out?
|
Once again, I am not sure what would actually happen while inside an ISR if you tried to force access to memory that was paged out. See my answer above.
Quote:
Originally Posted by shreshtha
3) I have the following argument that convinces me that the statement
is false. When an ISR causes a page fault, the page fault handler is
invoked since its priority is higher. When it finishes the control
goes back to ISR, just like the normal case of nested ISR execution.
Hence an ISR can cause page fault. Is any thing wrong with this
argument?
|
There is everything wrong with this argument. Page faults are exceptions, and exceptions are lower priority than interrupts.
Quote:
Originally Posted by shreshtha
My question is how Kernel assures that page fault doesn't happen during ISR? Is request_irq dues some miracle while registering the IRQ?
|
Driver writers assure that page faults will not happen during an ISR by only using memory that cannot be paged out. Memory allocated by kmalloc and its relatives cannot be paged out.
DEVIL'S ADVOCATE:
Even if page faults could occur during an ISR, they would bog the system down until it stopped. Memory is paged out to one of the slowest devices in the system: the hard drive. If ISRs had to wait for a page to be read from the hard drive, they would run too long and cause other interrupts to be mishandled, which would eventually lead to a slowdown and then a halt.