kern/77537: Conditional breakpoints hang on SMP machines

Greg 'groggy' Lehey grog at
Mon Feb 14 16:30:27 PST 2005

>Number:         77537
>Category:       kern
>Synopsis:       Conditional breakpoints hang on SMP machines
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 15 00:30:26 GMT 2005
>Originator:     Greg 'groggy' Lehey
>Release:        FreeBSD 6.0-CURRENT i386
Rocksoft Ltd
System: FreeBSD 6.0-CURRENT FreeBSD 6.0-CURRENT #0: Mon Feb 14 09:38:49 CST 2005     grog at  i386

	Kernels built in mid-December 2004 and mid-February 2005
	exhibit this problem.


	During a normal user-level debugging session, I set a
        conditional breakpoint that should run about 125,000 times
        before being hit.  When I did this, it stopped after a while,
        though: the gdb process hung in a WAIT state, repeatedly.

 	I then ran it under ktrace and found that it stopped with:

	 12325 gdb      CALL  ptrace(12,0x3026,0xbfbfd5e0,0)
	 12325 gdb      RET   ptrace 0
	 12325 gdb      CALL  ptrace(PT_STEP,0x3026,0x1,0)
	 12325 gdb      RET   ptrace 0
	 12325 gdb      CALL  wait4(0xffffffff,0xbfbfd808,0,0)

        This is the same sequence that repeats itself thousands of
        times in the trace: it should continue with

	 12325 gdb      RET   wait4 12326/0x3026
	 12325 gdb      CALL  kill(0x3026,0)
	 12325 gdb      RET   kill 0
	 12325 gdb      CALL  ptrace(PT_GETREGS,0x3026,0xbfbfd5c0,0)

        But it didn't: it hung.  I originally ran with a 6-CURRENT of
        mid-December 2005, but upgraded to 6-CURRENT as of 14 February
        2005 and confirmed that the problem remains.
	As described above.

	Not currently known.  A workaround appears to be to disable
	all except one CPU with sysctl -w machdep.hlt_cpus=14 (this is
	a 4 processor machine).  This also confirms my suspicion that
	it's a race condition.

	If somebody will give me a few clues about where to look, I'm
	happy to take a look at this myfself.

More information about the freebsd-bugs mailing list