Subject: UVM on MIPS problems (still!)
To: None <port-mips@NetBSD.ORG>
From: Michael L. Hitch <mhitch@lightning.oscs.montana.edu>
List: port-mips
Date: 05/24/1998 23:12:46
  I've been trying to get more information on what is causing
my pmax UVM kernel to hang with pagedaemon waiting on "getblk".

  I added a call to Debugger() in getblk() when the current
process was pagedaemon.  The stack traceback at that point
was confusing until I tracked down a problem with the MIPS
stacktrace being unable to traceback through some UVM procedures.

  The stack traceback shows a very strange thing:  it appears
that pagedaemon is trying to write a page to a file.  Even
stranger, that file is /bin/test.

  I also found that the UVM kernel clobbers file permissions.
The first time I noticed it, 'su' lost suid, which I thought was
something I had done wrong.  After it happened several times more
to 'su' and 'rcmd', on two different systems, I figured it had
to be something with the kernel.

  Putting some debugging output in uvn_put(), I found that
uvn_put() was getting called quite a few times on numerous
files.  I wouldn't think uvn_put() should get called like that.
It would appear that for some reason, the pages are not
being marked clean when they should be.  [That may very well
due to something in pmap.c though.]

  The following shows the information when pagedaemon hangs.
The first inactive page found by pagedaemon appears to be the
first page of /bin/test, and it doesn't have PG_CLEAN set.


# ls -li /bin/test
5184 -r-xr-xr-x  2 bin  bin  54956 May 23 14:25 /bin/test
# /tmp/grabmem
0 scans 3201 free
0 scans 2940 free
0 scans 2680 free
0 scans 2420 free
0 scans 2156 free
0 scans 1893 free
0 scans 1636 free
0 scans 1379 free
0 scans 1112 free
0 scans 855 free
0 scans 598 free
0 scans 341 free
0 scans 80 free
pagedaemon: woke up
pagedaemon: scan inactive 0x801aa928
PAGE 0x80211d8c:
  flags=0x40, pqflags=0x2, vers=1, wire_count=0, pa=0x5c4000
  uobject=0xc0044000, uanon=0x0, offset=0x0 loan_count=0
  page not busy, no owner
pagedaemon: pageout
PAGE 0x80211d8c:
  flags=0x50, pqflags=0x2, vers=1, wire_count=0, pa=0x5c4000
  uobject=0xc0044000, uanon=0x0, offset=0x0 loan_count=0
  owning process = 2, tag=scan_inactive
  checking object list
  page found on object list
  checking pageq list
  page found on pageq list
uvn_put: 0xc0044000 offset 0 npages 1
uvn_put: type VREG, usecount 0, writecount 0, refcount 0,
	tag VT_UFS, ino 5184, on dev 21, 0
uvn_put: 0xc0044000 offset 1000 npages 1
uvn_put: type VREG, usecount 1, writecount 0, refcount 1,
	tag VT_UFS, ino 5184, on dev 21, 0
getblk: pagedaemon sleeping, flags 900210 dev 1500 count 2000 addr 0xc0921000
Stopped at      _Debugger+0x4:  jr      ra
db> t
_Debugger+4 (0,0,0,0) ra 8006c4e8 sz 0
_getblk+130 (0,0,2000,0) ra 8006ba28 sz 72
_bread+40 (0,0,2000,0) ra 800f3ce0 sz 56
_ffs_balloc+290 (0,0,2000,c002dc00) ra 800f8490 sz 216
_ffs_write+2d8 (ffffdae0,0,2000,c002dc00) ra 80143460 sz 160
_uvn_io+f70 (ffffdae0,0,2000,c002dc00) ra 80141d24 sz 128
_uvn_put+70 (ffffdae0,0,2000,c002dc00) ra 80131a2c sz 48
_uvm_pager_put+c8 (ffffdae0,0,2000,c002dc00) ra 80141470 sz 64
_uvn_flush+904 (ffffdae0,0,2000,19) ra 8013f8c0 sz 216
_uvn_detach+bcc (ffffdae0,0,2000,19) ra 80143b04 sz 56
_uvm_vnp_uncache+138 (ffffdae0,0,2000,19) ra 800f8504 sz 56
_ffs_write+34c (ffffddb8,0,2000,19) ra 80143460 sz 160
_uvn_io+f70 (ffffddb8,0,2000,19) ra 80141d24 sz 128
_uvn_put+70 (ffffddb8,0,2000,19) ra 80131a2c sz 48
_uvm_pager_put+c8 (ffffddb8,0,2000,19) ra 8013396c sz 64
_uvmpd_scan_inactive+8a8 (801aa928,0,2000,19) ra 80134084 sz 248
_uvmpd_scan+520 (801aa928,0,2000,19) ra 8013307c sz 48
_uvm_pageout+cb8 (801aa928,0,2000,19) ra 80040aa4 sz 64
80040a6c+38 (801aa928,0,2000,19) ra 800316bc sz 24
_mips1_proc_trampoline+8 (801aa928,0,2000,19) ra 0 sz 0
User-level: pid 2
db> x/i 80040a6c
_main+0x96c:    addiu   sp,sp,-24
db> c
^CStopped at      _Debugger+0x4:  jr      ra
db> ps/w
 PID          COMMAND     EMUL  PRI UTIME STIME WAIT-MSG    WAIT-CHANNEL
 19           grabmem   netbsd    4   4.8   2.8 flt_noram5  _uvmexp+0x10
 9          mount_mfs   netbsd   32   0.0   1.4 mfsidl      0xc007ee00
 3                 sh   netbsd   32   0.0   1.9 wait        0xc0043e00
 2         pagedaemon   netbsd   17   0.0   2.2 getblk      0x801cb2b0
 1               init   netbsd   32   0.0   0.1 wait        0xc002b200
 0            swapper   netbsd    4   0.0   0.0 scheduler   _proc0
db> machine halt
halted.


KN02-CA V2.0g    (PC: 0x80031b24, SP: 0xffffdaf0)
>>

Michael

-- 
Michael L. Hitch			mhitch@montana.edu
Computer Consultant
Information Technology Center
Montana State University	Bozeman, MT	USA