mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: Davide Libenzi <davidel@xmailserver.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	hch@lst.de, Benjamin LaHaise <bcrl@redhat.com>
Subject: Re: interrupt checks for spinlocks
Date: 04 Nov 2002 13:31:30 +0000	[thread overview]
Message-ID: <1036416690.1106.27.camel@irongate.swansea.linux.org.uk> (raw)
In-Reply-To: <20021104003906.GB12891@holomorphy.com>

On Mon, 2002-11-04 at 00:39, William Lee Irwin III wrote:
> That would appear to require cycle detection, but it sounds like a
> potential breakthrough usage of graph algorithms in the kernel.
> (I've always been told graph algorithms would come back to haunt me.)
> Or maybe not, deadlock detection has been done before.

For a spinlock it doesn't appear to be insoluble.

Suppose we do the following

For
	spin_lock(&foo)

	current->waiting = foo;
	foo->waiting += current;

	If foo is held
		Check if foo is on current->locks
			If it is then we shot ourself in the foot
		Check if any member of foo->waiting is waiting on a lock
			we hold (in current->locks)
			If it is then we shot ourselves in both feet
		
	When we get the lock
	foo->waiting -= current;
	foo->held = current;
	current->locks = foo;

For
	spin_unlock(&foo)
	
	if(current->locks != foo)
		We released the locks in the wrong order

	remoe foo from current->locks



Alan


  parent reply	other threads:[~2002-11-04 13:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-03 22:08 William Lee Irwin III
2002-11-04  0:15 ` Davide Libenzi
2002-11-04  0:39   ` William Lee Irwin III
2002-11-04  1:39     ` Davide Libenzi
2002-11-04  1:39       ` William Lee Irwin III
2002-11-04  5:18       ` Randy.Dunlap
2002-11-04 15:47         ` Davide Libenzi
2002-11-04 13:31     ` Alan Cox [this message]
     [not found] <mailman.1036362421.16883.linux-kernel2news@redhat.com>
     [not found] ` <200211040028.gA40S8600593@devserv.devel.redhat.com>
     [not found]   ` <20021104002813.GZ16347@holomorphy.com>
2002-11-04  0:42     ` Pete Zaitcev
2002-11-04  0:53       ` William Lee Irwin III
2002-11-04  1:18         ` Robert Love
2002-11-04  1:42           ` William Lee Irwin III
2002-11-04  3:01             ` Robert Love
2002-11-04  3:04               ` William Lee Irwin III
2002-11-04  3:22               ` William Lee Irwin III
2002-11-04  3:36               ` Zwane Mwaikambo

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=1036416690.1106.27.camel@irongate.swansea.linux.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=bcrl@redhat.com \
    --cc=davidel@xmailserver.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wli@holomorphy.com \
    /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

all inboxes | Powered by JetHome®