LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-29-2009, 11:44 AM   #1
shreshtha
LQ Newbie
 
Registered: Jul 2006
Location: India
Distribution: ubuntu
Posts: 13

Rep: Reputation: 0
Can page fault happen during ISR?


Hi,
I am re-posting question posted by Daniel Rodrick <daniel.rodrick@gmai...> whose answer is still not very clear to me.

1) I read that an ISR cannot cause a page fault. Is the statement true?

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?

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?

My question is how Kernel assures that page fault doesn't happen during ISR? Is request_irq dues some miracle while registering the IRQ?

Thanks,
Shreshtha
 
Old 10-29-2009, 05:19 PM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by shreshtha View Post
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 View Post
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 View Post
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 View Post
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.
 
1 members found this post helpful.
Old 10-29-2009, 05:24 PM   #3
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Milwaukee, WI
Distribution: Mint
Posts: 6,642

Rep: Reputation: 69
Quote:
Originally Posted by shreshtha View Post
Hi,
I am re-posting question posted by Daniel Rodrick whose answer is still not very clear to me.
Is this an existing thread here at LQ, or something from another forum? Can you post a link to the original post?

Last edited by J.W.; 10-29-2009 at 05:25 PM.
 
Old 10-30-2009, 12:36 AM   #4
shreshtha
LQ Newbie
 
Registered: Jul 2006
Location: India
Distribution: ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
Original link to the post

hi
this was posted in some other post
here is the link

http://www.nabble.com/Why-can%27t-an...td8517056.html
 
Old 10-30-2009, 01:10 AM   #5
shreshtha
LQ Newbie
 
Registered: Jul 2006
Location: India
Distribution: ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
My understanding

Hi David1357,
thanks a lot for your inputs.
here is my understanding now -

Double fault and triple fault is what happen if something nasty done in ISR or done forcibly (e.g. sometimes Linux does during shutdown).
In ISR, page fault cannot happen until we do it forcibly. Kernel pages are not page-able and all data are non page-able as allocated using kmalloc. So no page fault can happen during ISR.

I take a situation where code access some NULL pointer.
MMU (Memory Management Unit) will come in to action will generate page fault. But Page fault routine will also fail as no such page exists. NOTE: these all happened while ISR took a back seat. And then finally it will go to system crash without returning to executing ISR.
It is clear that without a NULL pointer reference its not possible to access a paged out data. Or is it possible? But how?

Looking in to DoubleFault and TripleFault also adds some light in to this topic.
http://en.wikipedia.org/wiki/Double_fault
http://en.wikipedia.org/wiki/Triple_fault

Thanks and Regards,
Shreshtha
 
  


Reply

Tags
fault, irq, page


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
kprobe-fault handler(how to generate page fault) hnshashi Linux - Newbie 0 11-13-2008 01:25 AM
Wine: page fault on read access to... computergeekxp Linux - Newbie 4 06-30-2008 07:20 AM
How to make page numbers happen in Openoffice.org Writer royeo Linux - Newbie 12 11-28-2006 10:57 AM
Page Fault in Nonpaged Area XPediTioN Slackware 0 09-30-2003 08:57 AM
RedHat 8.0 ---> W2k - Page Fault Abrid Linux - Newbie 1 09-18-2003 11:34 AM


All times are GMT -5. The time now is 11:57 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