public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maneesh Soni <maneesh@in.ibm.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Rusty <rusty@rustcorp.com.au>
Subject: smp_call_function & BH handlers
Date: Tue, 27 Nov 2001 18:57:39 +0530	[thread overview]
Message-ID: <20011127185739.H14200@in.ibm.com> (raw)

Hi,

Why is it ok to call smp_call_function from bottom half handlers? This 
could lead to deadlock in the way which we encounterd. (tried on 2.4.14 kernel)

CPU 0				     CPU 1
-----				     -----	
schedule()			     do_fork
   read_lock(&tasklist_lock)	     spinning for write_lock_irq(&tasklist_lock)
	.
	.
	.
  interrupted by a timer handler
    calls smp_call_function()
      waiting for response from CPU 1

IMO this looks like a genereic problem and not specific to tasklist_lock and can
happen with other locks also. The solution for the above problem can be 

(1) Do not use smp_call_function even from bottom half handlers.
(2) Enabling interrupts if CPU has to spin due to xxx_lock_irq() and disabling
    them when the CPU gets the lock.

Though the deadlock we faced doesnot occur, using read_lock_irq(&tasklist_lock)
in schedule(). 

The comments above smp_call_function() also say that it can return negative
status code upon failure. But it doesnot do that and keep waiting for response
from other cpus. Why is it necessary to wait for response if we specify nowait
in the parameter?

I hope I have not missed anything here. 

Thanks
Maneesh

-- 
Maneesh Soni
IBM Linux Technology Center, 
IBM India Software Lab, Bangalore.
Phone: +91-80-5044999 email: maneesh@in.ibm.com
http://lse.sourceforge.net/locking/rcupdate.html



             reply	other threads:[~2001-11-27 13:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-27 13:27 Maneesh Soni [this message]
2001-11-27 15:28 ` smp_call_function & BH handlers Ingo Molnar
2001-11-27 16:29   ` Maneesh Soni
2001-11-27 18:38     ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2001-11-27 19:30 Dipankar Sarma

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=20011127185739.H14200@in.ibm.com \
    --to=maneesh@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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