Sunday 15 August 2021

NetBSD/hppa on QEMU - System Information

NetBSD on PA-RISC

Originally inspired by OpenBSD/hppa the current NetBSD/hppa started as a port for HP 9000/700 systems and carried the name NetBSD/hp700. An initial experimental source release with NetBSD 2.0 in 2004, was followed by a binary release with NetBSD 3.0 in 2005. For NetBSD 7.0 in 2021 the port adopted the 'hppa' architecture name. The port now covers most PA-RISC HP 9000 systems, albeit in 32-mode.

Platform

HP developed the Precision Architecture (HP-PA or PA-RISC) RISC processor during the early 1980s in order to consolidate its compute platforms on to two architectures: Intel x86 and HP PA-RISC. The PA-RISC based HP 9000 series 700 entered the market in 1991

Emulator and Platform

The QEMU system emulator provides a 32-bit PA-RISC emulation based on the HP Visualize B160L (9000/778), a 1996 HP-UX workstation. From HP Visualize B132L, B160L, B180L PA-RISC Workstations - OpenPA.net the B160L system specifications are:

  • CPU: PA-7300LC 160 MHz
  • RAM: 32 MiB to 1.5 GiB max.
  • Bus: GSC, EISA, PCI
  • Storage controllers:
    • NCR 53C710 narrow SCSI-2
    • NCR 53C720 Fast-Wide HVD SCSI-2
  • Network interface: Intel 82596CA 10 Mb/s ethernet
  • Graphics: Visualize-EG (Graffiti) 2MB
  • Audio: Harmony

The emulated system doesn't implement the audio, ethernet or SCSI controllers (yet), instead replacing the SCSI controllers and ethernet interface with PCI devices to provide the same functionality:

  • CPU: one (or more) PA-7300LC at 250 MHz
  • RAM: 512 MiB default, up to 3.0 GiB
  • Bus: GSC, EISA, PCI
  • Storage controllers: Symbios Logic 53c895 Fast Wide LVD SCSI-2, PCI
  • Network interface: DEC Tulip 21142/43 100 Mb/s ethernet, PCI
  • Graphics: HPA208LC1280 aka. Artist

The addition of multi-processor (SMP) support diverges from the source workstation, but provides an alternative means for increasing the system performance.

Emulator Command

Translating this into a QEMU system emulation command:

qemu-system-hppa \
    --machine hppa \
    -m size=1536M \
    -hda hda_NetBSD9_hppa.qcow2 \
    -cdrom NetBSD-9.2-hppa.iso \
    -net nic,model=e1000 \
    -net "user,guestfwd=:10.0.2.1:22-cmd:netcat 127.0.0.1 22,hostfwd=::2222-:22" \
    -vga none \
    -boot order=cd \
    -no-reboot \
    -name 'NetBSD 9 on HP B160L'

A couple of things worth noting here:

  • While the 'hppa' machine gives a healthy 512 MiB of memory by default I've increased it to 1.5 GiB, the maximum in a real B160L
  • Due to an issue with the NetBSD tlp driver (Tulip) not being able to detect the network connection (NOCARRIER), the default Tulip card has been swapped for an Intel e1000 network adapter (NetBSD wm).
  • The user networking port forwarding rules provide a host/guest route for ssh connections:
    • Host to guest: ssh -p 2222 localhost
    • Guest to host: ssh 10.0.2.1
  • The graphics is disabled to avoid issues with NetBSD detecting the graphics card

System Information

So let's see what the operating system has to say about emulated platform...

uname

Operating system name, version, revision and platform information.

% uname -a
NetBSD qhp-netbsd.home 9.2 NetBSD 9.2 (GENERIC) #0: Wed May 12 13:15:55 UTC 2021  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/hppa/compile/GENERIC hppa

So a "NetBSD" kernel, on a node named "qhp-netbsd.home", kernel release "9.2", version "NetBSD 9.2 (GENERIC) #0: Wed May 12 13:15:55 UTC 2021 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/hppa/compile/GENERIC", platform architecture "hppa".

dmesg

System boot messages:

% dmesg
[     1.000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[     1.000000]     2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[     1.000000]     2018, 2019, 2020 The NetBSD Foundation, Inc.  All rights reserved.
[     1.000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[     1.000000]     The Regents of the University of California.  All rights reserved.

[     1.000000] NetBSD 9.2 (GENERIC) #0: Wed May 12 13:15:55 UTC 2021
[     1.000000] 	mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/hppa/compile/GENERIC
[     1.000000] HP9000/778/B160L (Merlin L2 160)
[     1.000000] real mem = 1536 MB (73728 reserved for PROM, 1522 MB used by NetBSD)
[     1.000000] avail mem = 1495 MB
[     1.000000] timecounter: Timecounters tick every 10.000 msec
[     1.000000] Kernelized RAIDframe activated
[     1.000000] mainbus0 (root) [flex fff80000]
[     1.000000] pdc0 at mainbus0
[     1.000000] power0 at mainbus0
[     1.000000] cpu0 at mainbus0 hpa 0xfffb0000 path 48 irq 31: PA7300LC (Velociraptor) rev 0
[     1.000000] cpu0: PCXL2, PA-RISC 1.1e, lev 1, cat A, 250 MHz clk
[     1.000000] cpu0: shadows, 0K/0K D/I caches, 256 shared TLB, 0/0 D/I BTLBs
[     1.000000] cpu0: no floating point
[     1.000000] mem0 at mainbus0 hpa 0xfffbf000 path 63: viper rev 0, ctrl 0x0 size 1536MB
[     1.000000] phantomas0 at mainbus0 hpa 0xffc00000 path 8
[     1.000000] dino0 at phantomas0 hpa 0xfff80000 path 8/0: Dino V3.1
[     1.000000] "Core RS-232C" at dino0 (type 0xa, sv 0x8c) hpa 0xfff83000 path 8/0/63 not configured
[     1.000000] pci0 at dino0 bus 0
[     1.000000] pci0: i/o space, memory space enabled
[     1.000000] esiop0 at pci0 dev 0 function 0: Symbios Logic 53c895a (ultra2-wide scsi)
[     1.000000] esiop0: using on-board RAM
[     1.000000] esiop0: interrupting at irq 0
[     1.000000] scsibus0 at esiop0: 16 targets, 8 luns per target
[     1.000000] wm0 at pci0 dev 1 function 0: Intel i82540EM 1000BASE-T Ethernet (rev. 0x03)
[     1.000000] wm0: interrupting at irq 1
[     1.000000] wm0: 32-bit 33MHz PCI bus
[     1.000000] wm0: 64 words (6 address bits) MicroWire EEPROM
[     1.000000] wm0: Ethernet address 52:54:00:12:34:56
[     1.000000] wm0: 0x200402<LOCK_EECD,IOH_VALID,WOL>
[     1.000000] makphy0 at wm0 phy 1: Marvell 88E1011 Gigabit PHY, rev. 0
[     1.000000] makphy0: Failed to access EADR. Are you an emulator?
[     1.000000] makphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
[     1.000000] lasi0 at phantomas0 hpa 0xffc00000 path 8/16 irq 28: rev 0.0
[     1.000000] gsc0 at lasi0
[     1.000000] lpt1 at gsc0 hpa 0xffd02000 path 8/16/0 irq 7
[     1.000000] com2 at gsc0 hpa 0xffd05000 path 8/16/4 irq 5: ns8250 or ns16450, no fifo
[     1.000000] timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
[     1.000010] timecounter: Timecounter "itimer" frequency 250000000 Hz quality 100
[     1.000010] scsibus0: waiting 2 seconds for devices to settle...
[     3.297646] sd0 at scsibus0 target 0 lun 0: <QEMU, QEMU HARDDISK, 2.5+> disk fixed
[     3.344310] sd0: 4096 MB, 8322 cyl, 16 head, 63 sec, 512 bytes/sect x 8388608 sectors
[     3.401280] cd0 at scsibus0 target 2 lun 0: <QEMU, QEMU CD-ROM, 2.5+> cdrom removable
[     3.821134] boot device: sd0
[     3.896230] root on sd0a dumps on sd0b
[     4.135077] root file system type: ffs
[     4.155878] kern.module.path=/stand/hppa/9.2/modules
[    26.225041] esiop0: autoconfiguration error: phase mismatch without command
[    26.225041] esiop0: autoconfiguration error: unhandled scsi interrupt, sist=0x80 sstat1=0x0 DSA=0x2ac9961 DSP=0x50
[    26.262119] esiop0: scsi bus reset
[    26.262119] sd0: async, 8-bit transfers, tagged queueing
[    26.275994] cd0: async, 8-bit transfers, tagged queueing
[    35.140937] esiop0: autoconfiguration error: phase mismatch without command
[    35.140937] esiop0: autoconfiguration error: unhandled scsi interrupt, sist=0x80 sstat1=0x0 DSA=0x1 DSP=0x50
[    35.177145] esiop0: scsi bus reset
[    35.414770] esiop0: autoconfiguration error: phase mismatch without command
[    35.414770] esiop0: autoconfiguration error: unhandled scsi interrupt, sist=0x80 sstat1=0x0 DSA=0x1 DSP=0x50
[    35.450893] esiop0: scsi bus reset
[   124.754068] esiop0: autoconfiguration error: phase mismatch without command
[   124.754068] esiop0: autoconfiguration error: unhandled scsi interrupt, sist=0x80 sstat1=0x0 DSA=0x2ac91e1 DSP=0x50
[   124.795951] esiop0: scsi bus reset

Lots of stuff here, so I'll only pick out some highlights...

  • Identification of the system as a HP B160L
  • Report the 1.5 GiB memory
  • Processor details as a PA7300L, aka. PCXL2
  • Identification of chipsets and devices
  • Some SCSI errors

sysctl

The system configuration tool 'sysctl' (NetBSD sysctl) provides information about various aspects of the system configuration. Since we're interested in how the operating system sees the emulated system hardware, the 'hw' hierarchy is of interest:

% sysctl -a | grep '^hw'
hw.machine = hppa
hw.model = HP9000/778/B160L (Merlin L2 160)
hw.ncpu = 1
hw.byteorder = 4321
hw.physmem = 1610612736
hw.usermem = 1610612736
hw.pagesize = 4096
hw.disknames = sd0 cd0
hw.machine_arch = hppa
hw.alignbytes = 7
hw.cnmagic = \x2b\x2b\x2b\x2b\x2b
hw.physmem64 = 1610612736
hw.usermem64 = 1610612736
hw.iostatnames = sd0 cd0
hw.ncpuonline = 1
hw.uhso.autoswitch = 1
hw.wsevent.default_version = 1
hw.firmware.path = /libdata/firmware:/usr/libdata/firmware:/usr/pkg/libdata/firmware:/usr/pkg/libdata
hw.wm0.txrx_workqueue = 0

Here we have the system architecture, the system model, the number of processors and the connected disks.

As well as the hardware ('hw') section, there is also a machine dependent ('machdep') section:

% sysctl -a | grep '^machdep'
machdep.booted_kernel = netbsd
machdep.lcd_blink = 0
machdep.power_switch.state = on
machdep.power_switch.control = enabled

Some stuff about the system power management, and the front panel LCD heartbeat control. The B160L doesn't have a front panel LCD, instead using LEDs to show system activity, including an LED for the system heartbeat, but other HP 9000 models featured an LCD in this role.

pcictl

The PCI bus configuration tool 'pcictl' (NetBSD pcictl) provides a means to look at the installed PCI devices:

% pcictl pci0 list
000:00:0: Symbios Logic 53c895A (SCSI mass storage)
000:01:0: Intel i82540EM 1000baseT Ethernet (ethernet network, revision 0x03)

And we see the expected PCI devices: the default SCSI controller and the Intel e1000 ethernet card, which replaced the default DEC Tulip ethernet card.

scsictl

The SCSI configuration tool 'scsictl' (NetBSD scsictl) allows us to get information about the installed SCSI devices. In this case we have the system hard-disk and the CD-ROM drive, which can be seen in the 'sysctl' output:

hw.disknames = sd0 cd0

Using these device names we can get a bit more information:

# scsictl sd0 identify
/dev/rsd0: scsibus0 target 0 lun 0 <QEMU, QEMU HARDDISK, 2.5+>
# scsictl cd0 identify
/dev/rcd0: scsibus0 target 2 lun 0 <QEMU, QEMU CD-ROM, 2.5+>

So we have the QEMU emulated hard-disk, that maps to the hard-disk image file that was specified on the command-line, and the QEMU emulated optical drive.

Benchmark

Since this is an emulated machine an obvious question is, how well does it perform compared to the real thing? To find out we're going to need a benchmark.

BogoMips

The BogoMips (Wikipedia) pseudo-benchmark has a behavior where the score is related to the processor clock speed, and has an easily available collection of results from a range of systems (see BogoMips mini-Howto). This is helpful in this case since the performance of processors of this era typically scaled with clock speed. So let's get some results using the standalone BogoMips 1.4.1 program and see what it says:

Calibrating delay loop... 45.77 BogoMIPS
Calibrating delay loop... 73.72 BogoMIPS
Calibrating delay loop... 26.11 BogoMIPS
Calibrating delay loop... 46.79 BogoMIPS
Calibrating delay loop... 75.36 BogoMIPS

The host system load appears prety constant so that doesn't look like a cause for the variablity. Checking the NetBSD/hppa end, top indicates the system is burning a lot of time (>90%) in "interupt" states which would explain the variblity and is likely connected to the SCSI errors.

Other that the very low outlier, these BogoMips results look to be inline with the HP-UX 11i results, suggesting they reflect the actual performance.

OpenSSL

The OpenSSL library of cryptographic methods provides a means to test the performance of the methods. Using this we can get a feel for the computational performance of a system, and comparisons with real hardware and other emulations can show how well a particular emulation performs. Since we are mainly interested in old hardware, we'll test using two of the older methods: MD5 and RSA.

% openssl speed md5
Doing md5 for 3s on 16 size blocks: 248980 md5's in 2.30s
Doing md5 for 3s on 64 size blocks: 233838 md5's in 2.28s
Doing md5 for 3s on 256 size blocks: 163364 md5's in 2.30s
Doing md5 for 3s on 1024 size blocks: 84138 md5's in 2.30s
Doing md5 for 3s on 8192 size blocks: 14457 md5's in 2.29s
Doing md5 for 3s on 16384 size blocks: 7471 md5's in 2.29s
OpenSSL 1.1.1k  25 Mar 2021
NetBSD 9.2
options:bn(32,32) rc4(int) des(long) aes(partial) idea(int) blowfish(ptr) 
gcc version 7.5.0 (NetBSD nb4 20200810) 
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
md5               1732.03k     6563.87k    18183.12k    37459.70k    51716.92k    53451.91k
% openssl speed rsa
Doing 512 bits private rsa's for 10s: 234 512 bits private RSA's in 7.67s
Doing 512 bits public rsa's for 10s: 3318 512 bits public RSA's in 7.63s
Doing 1024 bits private rsa's for 10s: 54 1024 bits private RSA's in 7.76s
Doing 1024 bits public rsa's for 10s: 1331 1024 bits public RSA's in 7.58s
Doing 2048 bits private rsa's for 10s: 11 2048 bits private RSA's in 8.20s
Doing 2048 bits public rsa's for 10s: RSA verify failure
4294967295:error:0407008A:rsa routines:RSA_padding_check_PKCS1_type_1:invalid padding:/usr/src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_pk1.c:67:
4294967295:error:04067072:rsa routines:rsa_ossl_public_decrypt:padding check failed:/usr/src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_ossl.c:588:
-1 2048 bits public RSA's in 0.25s
Doing 3072 bits private rsa's for 10s: 4 3072 bits private RSA's in 8.95s
Doing 3072 bits public rsa's for 10s: 216 3072 bits public RSA's in 7.66s
Doing 4096 bits private rsa's for 10s: 1 4096 bits private RSA's in 19.58s
Doing 4096 bits public rsa's for 10s: RSA verify failure
4294967295:error:0407008A:rsa routines:RSA_padding_check_PKCS1_type_1:invalid padding:/usr/src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_pk1.c:67:
4294967295:error:04067072:rsa routines:rsa_ossl_public_decrypt:padding check failed:/usr/src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_ossl.c:588:
-1 4096 bits public RSA's in 6.03s
OpenSSL 1.1.1k  25 Mar 2021
NetBSD 9.2
options:bn(32,32) rc4(int) des(long) aes(partial) idea(int) blowfish(ptr) 
gcc version 7.5.0 (NetBSD nb4 20200810) 
                  sign    verify    sign/s verify/s
rsa  512 bits 0.032778s 0.002300s     30.5    434.9
rsa 1024 bits 0.143704s 0.005695s      7.0    175.6
rsa 2048 bits 0.745455s -0.250000s      1.3     -4.0
rsa 3072 bits 2.237500s 0.035463s      0.4     28.2
rsa 4096 bits 19.580000s -6.030000s      0.1     -0.2

The errors in the RSA test suggest there are issues with the implementation on this platform, and indicate that the strange looking RSA results (how do we get negative verifies per second) are invalid. The failures do not appear to be deterministic, suggesting the errors are connected to the random number parts of the method. While it looks like some runs work correctly, the errors make all the RSA results suspect.

Extracting the relevant figures for comparisons (see OpenSSL Speed Results):

  • OpenSSL speed MD5 8,192 bytes: 51,716.92k
  • OpenSSL speed RSA 4,096 bytes sign/s: invalid
  • OpenSSL speed RSA 4,096 bytes verify/s: invalid

So allowing for the limited results obtained, the MD5 results are possibly indicative of computational workload performance.

Thoughts

Performance seems to be a problem, with tasks often feeling sluggish. From the message log it looks like the SCSI driver is having problems and the errors from the OpenSSL speed test could indicate other issues.

Further Sources

More information can be found at:


No comments: