From mboxrd@z Thu Jan 1 00:00:00 1970 From: "pradeep singh" <2500.pradeep@gmail.com> Subject: Re: Why can't we sleep in an ISR? Date: Mon, 14 May 2007 12:40:14 +0530 Message-ID: <366312910705140010m78b215a2t1753445e81120288@mail.gmail.com> References: <9f1dc2cf0705132337k13aa3ccesc575d4550492a24e@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_143789_22170823.1179126614873" Return-path: DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=NO6DVaoevk3aBzcSvoQI2n+Hbkg0VbO9etjpDqOmU4sMU7Btcr2FI/Tjj74bRnIfxuUo00T7NCc37ghHwdkm3xdm0WvpLNPJDBcy5nkomixNfc2oU3SsocdREmNi7hiqbNA+G/4jP6A3aYG/H9qvin9dwuCeOTS9XcC1/wpmnso= In-Reply-To: <9f1dc2cf0705132337k13aa3ccesc575d4550492a24e@mail.gmail.com> Sender: kernelnewbies-bounce@nl.linux.org Errors-to: kernelnewbies-bounce@nl.linux.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: List-subscribe: List-owner: List-post: List-archive: To: Learning Linux Cc: kernelnewbies@nl.linux.org, linux-newbie@vger.kernel.org, linux-kernel@vger.kernel.org ------=_Part_143789_22170823.1179126614873 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 5/14/07, 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? Because the interrupt which you are serving in the ISR has been masked to avoid preemption( true for maskable inetrrupts ).Any locks you are holding in ISR are now with you solely. So, if you try to sleep you take the locks you untill you are rescheduled and complete. This may lead to a deadlock for the lock resource. Thus to avoid this, kernel developers disable preemption and also on every schedule check if you are *in_interrupt*, if you are, you are probably doing something really bad.So its better to panic in such case. This is my naive understanding. Please CMIIW. Thanks TIA, > > LL > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to ecartis@nl.linux.org > Please read the FAQ at http://kernelnewbies.org/FAQ > > -- play the game ------=_Part_143789_22170823.1179126614873 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

On 5/14/07, Learning Linux <learninglinux4@gmail.com> 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?

Because the interrupt which you are serving in the ISR has been masked to avoid preemption( true for maskable inetrrupts ).Any locks you are holding in ISR are now with you solely. So, if you try to sleep you take the locks you untill you are rescheduled and complete. This may lead to a deadlock for the lock resource.
Thus to avoid this, kernel developers disable preemption and also on every schedule check if you are *in_interrupt*, if you are, you are probably doing something really bad.So its better to panic in such case.

This is my naive understanding.
Please CMIIW.

Thanks

TIA,

LL

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ




--
play the game ------=_Part_143789_22170823.1179126614873-- -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ