Skip site navigation (1)Skip section navigation (2)
Date:      Thu,  3 Jun 2004 19:29:42 +0300 (EEST)
From:      Nikos Ntarmos <ntarmos@ceid.upatras.gr>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        ntarmos@ceid.upatras.gr
Subject:   alpha/67538: Giant-owned panic when compiling with lang/compaq-cc
Message-ID:  <20040603162942.DCFB427C@Gatekeeper.ceid.upatras.gr>
Resent-Message-ID: <200406031640.i53GePI1008506@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         67538
>Category:       alpha
>Synopsis:       Giant-owned panic when compiling with lang/compaq-cc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-alpha
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 03 09:40:24 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Nikos Ntarmos
>Release:        FreeBSD 5.2-CURRENT alpha
>Organization:
NetCInS Lab. - CEID - UPatras - Greece
>Environment:
System: FreeBSD Gatekeeper.ceid.upatras.gr 5.2-CURRENT FreeBSD 5.2-CURRENT #17: Wed Jun 2 01:26:26 EEST 2004 root@Gatekeeper.ceid.upatras.gr:/vinum/usr.cur/obj/vinum/usr.cur/src/sys/GATEKEEPER alpha


	DEC Alpha 164SX, 21164PC 533MHz
	FreeBSD 5.2-CURRENT (as of Jun 2, but reproduceable in older revisions as well)
>Description:
Compiling a C program with lang/compaq-cc on my 164SX (PCA56) panics the machine with:
panic: mutex Giant owned at /vinum/usr.cur/src/sys/kern/kern_thread.c:1445
at line 742 in file /vinum/usr.cur/src/sys/kern/kern_mutex.c
Stack backtrace:
db_print_backtrace() at 0xfffffc0000573418 = db_print_backtrace+0x18
backtrace() at 0xfffffc000043f52c = backtrace+0x2c
__panic() at 0xfffffc000043f690 = __panic+0x150
_mtx_assert() at 0xfffffc0000433e0c = _mtx_assert+0xec
thread_wait() at 0xfffffc0000450650 = thread_wait+0x30
kern_wait() at 0xfffffc0000423b90 = kern_wait+0x430
linux_wait4() at 0xfffffe0002ab9550 = linux_wait4+0x58
syscall() at 0xfffffc00005831dc = syscall+0x35c
XentSys() at 0xfffffc0000573f50 = XentSys+0x64
--- syscall (365) ---
--- user mode ---
panic

Calling doadump() after this produces a seemingly irrelevant dump:
[root@Gatekeeper]:/var/crash# gdb -k /boot/kernel/kernel.debug vmcore.0
GNU gdb 5.2.1 (FreeBSD)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "alpha-undermydesk-freebsd"...
panic: mutex Giant owned at /vinum/usr.cur/src/sys/kern/kern_thread.c:1445
panic messages:
---
---
Reading symbols from /boot/kernel/vinum.ko...done.
Loaded symbols for /boot/kernel/vinum.ko
Reading symbols from /boot/kernel/osf1.ko...done.
Loaded symbols for /boot/kernel/osf1.ko
Reading symbols from /boot/kernel/linux.ko...done.
Loaded symbols for /boot/kernel/linux.ko
#0  0xfffffc000043f008 in doadump ()
    at /vinum/usr.cur/src/sys/kern/kern_shutdown.c:235
235             savectx(&dumppcb);
(kgdb) bt
#0  0xfffffc000043f008 in doadump ()
    at /vinum/usr.cur/src/sys/kern/kern_shutdown.c:235
#1  0xfffffc0000387660 in db_fncall (dummy1=0, dummy2=0, dummy3=0, dummy4=0x0)
    at /vinum/usr.cur/src/sys/ddb/db_command.c:551
#2  0xfffffc0000387284 in db_command (last_cmdp=0xfffffc00006b3c00,
    cmd_table=0x0, aux_cmd_tablep=0xfffffc0000666af8,
    aux_cmd_tablep_end=0xfffffc0000666b18)
    at /vinum/usr.cur/src/sys/ddb/db_command.c:348
#3  0xfffffc0000387438 in db_command_loop ()
    at /vinum/usr.cur/src/sys/ddb/db_command.c:475
#4  0xfffffc000038bb08 in db_trap (type=0, code=0)
    at /vinum/usr.cur/src/sys/ddb/db_trap.c:73
#5  0xfffffc0000572b40 in kdb_trap (a0=1, a1=0, a2=0, entry=3,
    regs=0xfffffe0012c8d948)
    at /vinum/usr.cur/src/sys/alpha/alpha/db_interface.c:208
#6  0xfffffc0000582db8 in trap (a0=1, a1=10, a2=28704, entry=3,
    framep=0xfffffe0012c8d948) at /vinum/usr.cur/src/sys/alpha/alpha/trap.c:378
#7  0xfffffc0000572cb8 in Debugger (msg=)
    at /vinum/usr.cur/src/sys/alpha/alpha/db_interface.c:277
(kgdb)
>How-To-Repeat:
Try compiling the following source code using lang/compaq-cc:
-- begin source code --

#include <unistd.h>
#include <stdlib.h>
      
#define MAXARRAY 250000
      
struct shr_data {
  unsigned long int   Pinakas[MAXARRAY];
};
  
void QUICKSORT( struct shr_data *array,
                unsigned long int l,
                unsigned long int r )
{
  unsigned long int tmp, i = l + 1, k = r - 1;

  while( i <= k ) { 
    if ( array->Pinakas[ i ] < array->Pinakas[ l ] )
      i ++;
    else {
      tmp = array->Pinakas[ i ];
      array->Pinakas[ i ] = array->Pinakas[ k ];
      array->Pinakas[ k ] = tmp;
      k --;
    }
  }   

  k ++;
  i --;
  
  tmp = array->Pinakas[ l ];
  array->Pinakas[ l ] = array->Pinakas[ i ];
  array->Pinakas[ i ] = tmp;
                
  if ( l < i ) QUICKSORT( array, l, i );
  if ( r > k ) QUICKSORT( array, k, r );
}
      
int main()
{
  struct shr_data* array;
  unsigned long i;
      
  srandom( getpid() );
  array = (struct shr_data*)malloc(sizeof(struct shr_data));
  
  for ( i = 0; i < 250000; i ++ )
    array->Pinakas[ i ] = random();
  
  QUICKSORT( array, 0, 250000 );
  
  free(array);
  return 0;
}

-- end source code --
I'll try to narrow down the source code that results in the crash. Just send-pr'ed this to add a data-point (and probably get some feedback). IMO this is a linux-emu-related problem. If I manage to get a working core (why does ddb get borked?), I'll follow-up to this.
>Fix:

	


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040603162942.DCFB427C>