LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* stepping through atomic_dec_return
@ 2005-10-07 17:15 Michael Richardson
  2005-10-07 17:46 ` Michael Richardson
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Richardson @ 2005-10-07 17:15 UTC (permalink / raw)
  To: linuxppc-embedded

-----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-----

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-10-07 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-07 17:15 stepping through atomic_dec_return Michael Richardson
2005-10-07 17:46 ` Michael Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox