kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: nilesh.tayade@netscout.com (nilesh)
To: kernelnewbies@lists.kernelnewbies.org
Subject: spin_lock and scheduler confusion
Date: Fri, 07 Jan 2011 13:19:02 +0530	[thread overview]
Message-ID: <1294386542.1620.14.camel@nilesh-desktop> (raw)
In-Reply-To: <AANLkTi=QT7j7AA=nZofUYFS-kDskkCj7OghGjmUHjfK1@mail.gmail.com>

On Fri, 2011-01-07 at 13:05 +0530, Rajat Sharma wrote:
> As I remember timer interrupt as well is an NMI so, it is possible
> (although not advised) to call schedule function while holding
> spinlock on same core.
> 
> spin_lock_irqsave();
> schedule();
> spin_lock_irqrestore();
> 
> however if you have debugging options turned on like
> CONFIG_DEBUG_SPINLOCK, you may likely get kernel warning for
> 'scheduling in atomic context'.
> 
> Then what can happen if this core is allowed to switched to new
> process? Consider the case where new process as well tries to aquire
> same spin_lock() which new process can not aquire and start spinning
> for the lock for ever :). Likewise, other cores will also get locked
> down.
> 
> However stil you can detect softlockup through NMI watchdog.

Sorry if I am building up the confusion here. But as Dave Hylands
initially mentioned, there will be no timer interrupt. So shouldn't the
NMI watchdog get triggered then? No interrupts -> system freeze -> NMI
Wdt reboot. 

http://slacksite.com/slackware/nmi.html

> 
> Rajat

-- 
Thanks,
Nilesh

  reply	other threads:[~2011-01-07  7:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <D69C90565D53114396BF743585AF5A09122E61E90F@VSHINMSMBX01.vshodc.lntinfotech.com>
2011-01-05 22:23 ` spin_lock and scheduler confusion Viral Mehta
2011-01-07  3:51   ` Alexandre Courbot
2011-01-07  3:56   ` Mulyadi Santosa
2011-01-07  5:28   ` Dave Hylands
2011-01-07  6:27     ` Tayade, Nilesh
2011-01-07  7:02       ` Tirtha Ghosh
2011-01-07  7:35         ` Rajat Sharma
2011-01-07  7:49           ` nilesh [this message]
2011-01-07  8:03             ` anish singh
2011-01-07  9:31               ` nilesh
2011-01-07 13:58                 ` Rajat Sharma
2011-01-07 15:49           ` Dave Hylands
2011-01-07 15:51       ` Dave Hylands
2011-01-07 17:46     ` Viral Mehta
2011-01-08 10:58       ` Rajat Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294386542.1620.14.camel@nilesh-desktop \
    --to=nilesh.tayade@netscout.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).