Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vax/microvax3900 waits for an (practically) infinite duration when talking to anita (NetBSD) rather than a terminal. #478

Closed
utkarsh009 opened this issue Jul 17, 2017 · 7 comments

Comments

@utkarsh009
Copy link

utkarsh009 commented Jul 17, 2017

  • Context

I am one of the contributors to anita, the automated test suite for NetBSD https://github.com/gson1703/anita . We are planning to add support for simh to it for testing the NetBSD/vax port. It works by screenscaping the output sent by the emulator and sends predefined input to it. Starting from the commit e36873f, we are having problem trying to communicate with the emulator via anita. It used to work prior to that. We are logging the output sent by the emulator.

  • the expected behavior

Here's an example log for any working commit (expected behaviour):

expect('>>>')
recv(1500226851.201, '\r\nVAX simulator V3.9-0\r\n')
recv(1500226851.263, 'RQ: unit is read only\r\n')
recv(1500226851.864, '\r')
recv(1500226851.864, '\n')
recv(1500226852.124, '\x1b')
recv(1500226852.124, '[')
recv(1500226852.125, 'c')
recv(1500226854.042, '\r')
recv(1500226854.042, '\n')
recv(1500226854.043, '\r')
recv(1500226854.043, 'K')
recv(1500226854.043, 'A')
recv(1500226854.043, '6')
recv(1500226854.043, '5')
recv(1500226854.044, '5')
  • the actual behavior

And here's an example log for a commit that doesn't work:

 expect('>>>')
  recv(1500224137.060, '\r\n')
  recv(1500224137.077, 'MicroVAX 3900 simulator V4.0-0 Beta        git commit id: 2ddb7162        Build: Unsupported=include+lib\r\n')
  recv(1500224137.317, 'RQ3: unit is read only\r\n')
  recv(1500224137.398, '\r')
  recv(1500224137.417, '\n')
  recv(1500224137.661, '\x1b')
  recv(1500224137.677, '[c')

As you can see, the emulator just keeps waiting for infinite duration after sending '[c'. Also, you might notice that for a working commit, there's a delay in between '[' and 'c' (look at the timestamps).
Do note, however, that running the emulator manually from the terminal works just fine.

  • the simulator configuration file (or commands) which were used when the problem occurred.

Here's the content of config file that we are using:

load -r /extra/vax/data/ka655x.bin
set cpu 32m
set rq0 ra92
set rq3 cdrom

attach rq0 work-file----extra-vax-data-NetBSD-7.1.0_PATCH-vax.iso+a4c29c41/wd0.img
attach -r rq3 /extra/vax/data/NetBSD-7.1.0_PATCH-vax.iso
boot cpu

After that, at the '>>>' prompt we issue: boot dua3

I made the following changes which gets past '[c' but now the there's a problem in system tests and the netbsd kernel isn't starting. Here's the output after applying the fix:

This is anita version 1.42
Downloading file:///bracket/vax/test/2017.07.15.18.52.21/release/images/NetBSD-8.99.1-vax.iso... OK
Creating hard disk image... done.
simh-vax /bracket/vax/test/2017.07.15.18.52.21/anita/netbsd.ini

MicroVAX 3900 simulator V4.0-0 Beta        git commit id: 2ddb7162        Build: Unsupported=include+lib
RQ3: unit is read only

KA655-B V5.3, VMB 2.7
Performing normal system tests.
40..39..38..37..36..35..34..33..32..31..

?53 2 0A FF 00 0000

P1=00000002  P2=00000028  P3=542D93A2  P4=00D40077  P5=00000000
P6=FFFFFFFF  P7=00000000  P8=00000000  P9=00000000 P10=20051CE0
r0=00000000  r1=20140110  r2=75E2AC22  r3=0002F787  r4=75E2AC2C
r5=2004E8F9  r6=00018678  r7=000186C8  r8=D42F1A42 ERF=80000000
30..29..28..27..

?55 2 02 FF 00 0001

P1=00000000  P2=00000028  P3=542D93A2  P4=00D40077  P5=00000000
P6=FFFFFFFF  P7=00000000  P8=00000000  P9=00000000 P10=20051CE0
r0=200551BE  r1=00000027  r2=00000055  r3=20140784  r4=2004EA6B
r5=2004EA8C  r6=200551C5  r7=00000000  r8=00000000 ERF=80000000
26..25..
24..23..22..21..20..19..18..17..16..15..14..13..12..11..10..09..
08..07..06..05..04..03..
Normal operation not possible.

>>>boot dua3
(BOOT/R5:0 DUA3



  2..
-DUA3
  1..0..


>> NetBSD/vax boot [1.12 (Sun Jul 16 11:56:25 UTC 2017)] <<
>> Press any key to abort autoboot  543210
getdisklabel: no disk label
|nfs_open: must mount first.
/-\|/open netbsd.vax: No such file or directory
> boot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ray interrupt: vector 0x18, ipl 31
stray interrupt: vector 0x18, ipl 31
stray interrupt: vector 0x18, ipl 31
stray interrupt: vector 0x18, ipl 31
stray interrupt: vector 0x18, ipl 31
stray interrupt: vector 0x18, ipl 31
stray interrupt: vector 0x18, ipl 31
stray interrupt: vector 0x18, ipl 31
stray interrupt: vector 0x18, ipl 31

I have attached the diff for this fix.
vax.txt

Any help with fixing the issue is appreciated.

Regards,
Utkarsh Anand

@markpizz
Copy link
Member

Hi Utkarsh,

While I'm looking at your suggested change to sim_timer.c, please try to run the latest code in the master branch (with and without your change) AND remove the "load -r /extra/vax/data/ka655x.bin" line from your configuration.

Also, please provide the output of SHOW VERSION and what is produced when you build the vax simulator with make...

Thanks.

  • Mark

@utkarsh009
Copy link
Author

utkarsh009 commented Jul 23, 2017

Here's what I get when I build the emulator:

utkarsh@utkarsh-GP62-6QE:/extra/simh-git$ make vax
lib paths are: /lib/x86_64-linux-gnu/ /usr/lib/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/libfakeroot/ /usr/lib/x86_64-linux-gnu/mesa-egl/ /usr/lib/x86_64-linux-gnu/mesa/ /usr/local/lib/
include paths are: /usr/include
using libm: /usr/lib/x86_64-linux-gnu/libm.so
using librt: /usr/lib/x86_64-linux-gnu/librt.so
using libpthread: /usr/lib/x86_64-linux-gnu/libpthread.so /usr/include/pthread.h
using regex: /usr/include/regex.h
using libdl: /usr/lib/x86_64-linux-gnu/libdl.so /usr/include/dlfcn.h
*** Info ***
*** Info *** The simulators you are building could provide more
*** Info *** functionality if video support were available on your system.
*** Info *** Install the development components of libSDL or libSDL2
*** Info *** packaged for your operating system distribution for
*** Info *** your Linux system:
*** Info ***        $ sudo apt-get install libsdl2-dev
*** Info ***    or
*** Info ***        $ sudo apt-get install libsdl-dev
*** Info ***
*** Warning ***
*** Warning *** all  Simulators are being built WITHOUT
*** Warning *** libpcap networking support
*** Warning ***
*** Warning *** To build simulator(s) with libpcap networking support you
*** Warning *** should install the libpcap development components for
*** Warning *** for your Linux system:
*** Warning ***        $ sudo apt-get install libpcap-dev
*** Warning ***
*** Info ***
*** Info *** Simulators on your Linux platform can also be built with
*** Info *** extended LAN Ethernet networking support by using VDE Ethernet.
*** Info ***
*** Info *** To build simulator(s) with extended networking support you
*** Info *** should install the vde2 package to provide this
*** Info *** functionality for your Linux system:
*** Info ***        $ sudo apt-get install libvdeplug-dev
*** Info ***
***
*** all  Simulators being built with:
*** - compiler optimizations and no debugging support. GCC Version: 6.3.0.
*** - Local LAN packet transports: TAP NAT(SLiRP)
***
*** git commit id is 7ed68aed6a60160c58b5d5ffc8be5228221a6f6c.
***
*** No SDL ttf support available.  BESM-6 video panel disabled.
***
gcc -std=gnu99 -U__STRICT_ANSI__  -O2 -finline-functions -fgcse-after-reload -fpredictive-commoning -fipa-cp-clone -fno-unsafe-loop-optimizations -fno-strict-overflow -Wno-unused-result -DSIM_GIT_COMMIT_ID=7ed68aed6a60160c58b5d5ffc8be5228221a6f6c -DSIM_COMPILER="GCC Version: 6.3.0" -I . -D_GNU_SOURCE -DUSE_READER_THREAD -DSIM_ASYNCH_IO  -DHAVE_REGEX_H -DHAVE_DLOPEN=so -DHAVE_UTIME -DHAVE_GLOB  sim_BuildROMs.c -o BIN/BuildROMs
BIN/BuildROMs
rm -f BIN/BuildROMs
gcc -std=gnu99 -U__STRICT_ANSI__  -O2 -finline-functions -fgcse-after-reload -fpredictive-commoning -fipa-cp-clone -fno-unsafe-loop-optimizations -fno-strict-overflow -Wno-unused-result -DSIM_GIT_COMMIT_ID=7ed68aed6a60160c58b5d5ffc8be5228221a6f6c -DSIM_COMPILER="GCC Version: 6.3.0" -I . -D_GNU_SOURCE -DUSE_READER_THREAD -DSIM_ASYNCH_IO  -DHAVE_REGEX_H -DHAVE_DLOPEN=so -DHAVE_UTIME -DHAVE_GLOB  VAX/vax_cpu.c VAX/vax_cpu1.c VAX/vax_fpa.c VAX/vax_io.c VAX/vax_cis.c VAX/vax_octa.c  VAX/vax_cmode.c VAX/vax_mmu.c VAX/vax_stddev.c VAX/vax_sysdev.c VAX/vax_sys.c  VAX/vax_syscm.c VAX/vax_syslist.c VAX/vax_vc.c VAX/vax_lk.c VAX/vax_vs.c VAX/vax_2681.c PDP11/pdp11_rl.c PDP11/pdp11_rq.c PDP11/pdp11_ts.c PDP11/pdp11_dz.c PDP11/pdp11_lp.c PDP11/pdp11_tq.c PDP11/pdp11_xq.c PDP11/pdp11_vh.c PDP11/pdp11_cr.c PDP11/pdp11_td.c PDP11/pdp11_io_lib.c scp.c sim_console.c sim_fio.c sim_timer.c sim_sock.c sim_tmxr.c sim_ether.c sim_tape.c sim_disk.c sim_serial.c sim_video.c sim_imd.c sim_card.c -DVM_VAX -DUSE_INT64 -DUSE_ADDR64 -DUSE_SIM_VIDEO -I VAX -I PDP11 -DHAVE_TAP_NETWORK -DUSE_NETWORK -Islirp -Islirp_glue -Islirp_glue/qemu -DHAVE_SLIRP_NETWORK -DUSE_SIMH_SLIRP_DEBUG slirp/*.c slirp_glue/*.c   -o BIN/microvax3900 -lm -lrt -lpthread -ldl  
cp BIN/microvax3900 BIN/vax

Here's the output for SHOW VERSION:

MicroVAX 3900 simulator V4.0-0 Beta git commit id: 7ed68ae
sim> SHOW VERSION
MicroVAX 3900 simulator V4.0-0 Beta
Simulator Framework Capabilities:
64b data
64b addresses
Threaded Ethernet Packet transports:TAP:NAT:UDP
Idle/Throttling support is available
Virtual Hard Disk (VHD) support
RAW disk and CD/DVD ROM support
Asynchronous I/O support (Lock free asynchronous event queue)
Asynchronous Clock support
FrontPanel API Version 4
Host Platform:
Compiler: GCC 6.3.0 20170406
Simulator Compiled as C arch: x64 (Release Build) on Jul 23 2017 at 20:07:38
Memory Access: Little Endian
Memory Pointer Size: 64 bits
Large File (>2GB) support
SDL Video support: No Video Support
RegEx support for EXPECT commands
OS clock resolution: 1ms
Time taken by msleep(1): 1ms
OS: Linux utkarsh-GP62-6QE 4.10.0-28-generic #32-Ubuntu SMP Fri Jun 30 05:32:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
git commit id: 7ed68ae

Here's what I output without the suggested changes:

This is anita version 1.42
Creating hard disk image... done.
simh-vax work-file----extra-vax-data-NetBSD-7.1.0_PATCH-vax.iso+a4c29c41/netbsd.ini

MicroVAX 3900 simulator V4.0-0 Beta        git commit id: 7ed68aed
RQ3: unit is read only
Loading boot code from internal ka655x.bin

^[[?62;c

Here's the output with the suggested changes:

This is anita version 1.42
Creating hard disk image... done.
simh-vax work-file----extra-vax-data-NetBSD-7.1.0_PATCH-vax.iso+a4c29c41/netbsd.ini

MicroVAX 3900 simulator V4.0-0 Beta        git commit id: 7ed68aed
RQ3: unit is read only
Loading boot code from internal ka655x.bin


KA655-B V5.3, VMB 2.7
^[[?62;cPerforming normal system tests.
40..39..38..37..36..35..34..33..32..31..

?53 2 0A FF 00 0000

P1=00000002  P2=00000028  P3=49852664  P4=00D40077  P5=00000000
P6=FFFFFFFF  P7=00000000  P8=00000000  P9=00000000 P10=20051CE0
r0=00000000  r1=20140110  r2=78FAB949  r3=0002F1C3  r4=78FAB953
r5=2004E8F9  r6=00018678  r7=000186C8  r8=C986AD04 ERF=80000000
30..29..28..27..

?55 2 02 FF 00 0001

P1=00000000  P2=00000028  P3=49852664  P4=00D40077  P5=00000000
P6=FFFFFFFF  P7=00000000  P8=00000000  P9=00000000 P10=20051CE0
r0=200551BE  r1=00000027  r2=00000055  r3=20140784  r4=2004EA6B
r5=2004EA8C  r6=200551C5  r7=00000000  r8=00000000 ERF=80000000
26..25..
24..23..22..21..20..19..18..17..16..15..14..13..12..11..10..09..
08..07..06..05..04..03..
Normal operation not possible.

>>>boot dua3
(BOOT/R5:0 DUA3



  2..
-DUA3
  1..0..


>> NetBSD/vax boot [1.11 (Sun May  7 19:13:20 IST 2017)] <<
>> Press any key to abort autoboot 0
getdisklabel: no disk label
nfs_open: must mount first.
open netbsd.vax: No such file or directory
> boot netbsd
getdisklabel: no disk label
nfs_open: must mount first.
3101284+172988 [230064+220192]=0x38d904
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 7.1.0_PATCH (GENERIC) #0: Sun May  7 19:20:21 IST 2017
	root@localhost.localdomain:/extra/vax_7_1/sys/arch/vax/compile/GENERIC
MicroVAX 3800/3900
total memory = 32708 KB
avail memory = 27568 KB
kern.module.path=/stand/vax/7.1/modules
mainbus0 (root)
cpu0 at mainbus0: KA655, CVAX microcode rev 6 Firmware rev 83
lance at mainbus0 not configured
uba0 at mainbus0: Q22
dz1 at uba0 csr 160100 vec 304 ipl 17
mtc0 at uba0 csr 174500 vec 774 ipl 17
mscpbus0 at mtc0: version 5 model 3
mscpbus0: DMA burst size set to 4
uda0 at uba0 csr 172150 vec 770 ipl 17
mscpbus1 at uda0: version 3 model 3
mscpbus1: DMA burst size set to 4
qt0 at uba0 csr 174440 vec 764 ipl 17
qt0: delqa-plus in Turbo mode, hardware address 08:00:2b:b8:a1:e3
rlc0 at uba0 csr 174400 vec 160 ipl 17
rl0 at rlc0 drive 0: RL01, drive not loaded
rl1 at rlc0 drive 1: RL01, drive not loaded
rl2 at rlc0 drive 2: RL01, drive not loaded
rl3 at rlc0 drive 3: RL01, drive not loaded
ts0 at uba0 csr 172520 vec 224 ipl 17: TS11
ts0: rev 0, extended features disabled, transport offline
mt0 at mscpbus0 drive 0: TK50
mt1 at mscpbus0 drive 1: TK50
mt2 at mscpbus0 drive 2: TK50
mt3 at mscpbus0 drive 3: TK50
ra0 at mscpbus1 drive 0: RA92
ra1 at mscpbus1 drive 1: RD54
ra2 at mscpbus1 drive 2: RD54
racd0 at mscpbus1 drive 3: RRD40

The kernel now boots after removing the 'load -r' line but there are still errors in the system checks.

Regards,
Utkarsh Anand

@markpizz
Copy link
Member

I reformatted your last response to include the desired output inline in the text since downloading and examining separate files is tedious. I also reduced the make output to just the relevant 'make vax' rather than all the simulators...

In any case, looking at your suggested change, I'm wondering how you got to that change?

The original code subtracts 1 from the result of sim_activate_time() which always adds one to the activation time of specified unit if the unit is active (which it should be on the code paths that your change includes).

I know there are problems with some of the timer code, but tracking these down is hard due:

  1. Debugging some of this is affected by Heisenberg effects.
  2. Many of the unusual cases occur far into execution and debug output can rapidly get massive and too much data to interpret for problems.

Your test case happens very early in the simulator's execution, so it would seem to be an excellent case to track down at least one problem. Can you provide the pieces I would need to reproduce this?

Thanks.

  • Mark

@utkarsh009
Copy link
Author

I'm wondering how you got to that change?

I got to that change just by looking at the output of : git show e36873f

Can you provide the pieces I would need to reproduce this?

Just clone this repo and run the it with the following command:

python /path/to/anita/anita test http://ftp.netbsd.org/pub/NetBSD/iso/7.1/NetBSD-7.1-vax.iso

@markpizz
Copy link
Member

Thanks. I see the failure. I'll let you know what I find.

markpizz added a commit that referenced this issue Aug 1, 2017
@markpizz
Copy link
Member

markpizz commented Aug 1, 2017

Hi Utkarsh,

Please give the latest code a try and let me know how things look now.

Thanks.

  • Mark

@utkarsh009
Copy link
Author

Sorry! I got busy. The latest build, as of now, fixes the issue. 😄

dthittner pushed a commit to dthittner/simh that referenced this issue Nov 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants