LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Richardson" <mcr@sandelman.ottawa.on.ca>
To: linuxppc-embedded@ozlabs.org
Subject: stepping through atomic_dec_return
Date: Fri, 07 Oct 2005 13:15:28 -0400	[thread overview]
Message-ID: <19942.1128705328@marajade.sandelman.ottawa.on.ca> (raw)

-----BEGIN PGP SIGNED MESSAGE-----


I have what I think is a semaphore problem.
Certainly there is an attempt to down(&sem) when sem->count ==
0. (that's my root cause, which I'm now going to examine)

However, down() in semaphore.h should just fail and call __down().

The problem seems to be that loop in atomic_dec_return(), which 
uses lwarx/stwcw seems to never end:

"1:	lwarx	%0,0,%1		# atomic_dec_return\n\
	addic	%0,%0,-1\n"
	PPC405_ERR77(0,%1)
"	stwcx.	%0,0,%1\n\
	bne-	1b"
	SMP_ISYNC
	: "=&r" (t)
	: "r" (&v->counter)
	: "cc", "memory");

lwarx sets the "RESERVED" bit, and stwcx, copies that to the CR0[EQ]
bit, which bne tests. 

I don't know what the "-" in the bne means.  Is it significant?

I checked, and CONFIG_IBM405_ERR77 is in my .config, so that shouldn't
be the issue. (I think the work around is just a performance issue on
devices without the defect)

I can see how setting through this code with the debugger could cause a
problem, since there would be debug exceptions, and there would be other
code in the debug stubs that could set the RESERVED=0.  It's hard to
know, but it seems unlikely to me.

(This is a UP system)

However, I would expect that I can set a break point after this call and
things would work fine. They do not, I get stuck in this loop.

Any comments?


- -- 
]       ON HUMILITY: to err is human. To moo, bovine.           |  firewalls  [
]   Michael Richardson,    Xelerance Corporation, Ottawa, ON    |net architect[
] mcr@xelerance.com      http://www.sandelman.ottawa.on.ca/mcr/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Finger me for keys

iQCVAwUBQ0atLYqHRg3pndX9AQGtNwQAsys7tNm+oVKkSptxYPbWf4KYCgibCRrt
Utb+8XR44dmIbVSeZdPZntR2Jklu00cFrNWw/2pk+Rv0tWdaiynbqRHdrkaVi9xS
9GEmf6v9FsbElIgeZP3/8FY7cuLu5PIDkuwU9can/mYJ1iZEMbLh4YcSJoNFHHws
ooLSWbz9uV8=
=hh8M
-----END PGP SIGNATURE-----

             reply	other threads:[~2005-10-07 17:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-07 17:15 Michael Richardson [this message]
2005-10-07 17:46 ` stepping through atomic_dec_return Michael Richardson

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=19942.1128705328@marajade.sandelman.ottawa.on.ca \
    --to=mcr@sandelman.ottawa.on.ca \
    --cc=linuxppc-embedded@ozlabs.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