Thursday 13 May 2021

Linux for SPARC (32-bit) on QEMU (sun4m) - System Information

Introduction

The system emulator QEMU provides a way to run old SunOS/Solaris for SPARC software on modern systems. A number of sites provide tutorials on how to do this, including pointers to archives of the operating system media and software sites, for example:

Having set up a couple of emulated SPARCstation 5 (Wikipedia) systems running:

  • Debian Linux 4.0 (etch) for SPARC
  • SunOS 4.1.4 aka. Solaris 1.4
  • Solaris 2.6 aka. SunOS 5.6

I figure it would be interesting to see the QEMU system has to tell us about itself when using the commands from previous UNIX System Information posts.

Let's start with Linux...

Debian Linux 4.0 (etch) for SPARC on QEMU

Using an Debian Linux 4.0 (etch) for SPARC installation disk image from https://people.debian.org/~aurel32/qemu/sparc/ with the defaults for QEMU's SPARC emulation:

  • Machine: Sun SPARCstation 5
  • RAM: 128 MB
  • CPU: microSPARC II; FMI,MB86904 Rev. 2.3
  • Framebuffer: TCX

Information about the original installation process can be found on Debian on an emulated SPARC machine.

So let's try some commands...

uname

Debian Linux 4.0 (etch) for SPARC uses a Linux 2.6 series kernel

$ uname -a
Linux debian-sparc 2.6.18-6-sparc32 #1 Fri Dec 12 16:29:52 UTC 2008 sparc GNU/Linux

lsb_release

The Linux Standard Base release information provides a little bit more:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 4.0 (etch)
Release:	4.0
Codename:	etch

Confirming the release information, and giving the release codename.

/proc/cpuinfo

The emulated SPARCstation 5 uses a microSPARC II (Wikipedia)

$ cat /proc/cpuinfo
cpu             : Fujitsu  MB86904
fpu             : Fujitsu MB86910 or Weitek WTL1164/5
promlib         : Version 3 Revision 2
prom            : 2.25
type            : sun4m
ncpus probed    : 1
ncpus active    : 1
CPU0Bogo        : 313.75
CPU0ClkTck      : 0
MMU type        : Fujitsu Swift
contexts        : 256
nocache total   : 2252800
nocache used    : 1382144

The physical SPARCstation 5 used a microSPARC II processor at 75, 85 or 110 MHz or a TurboSPARC at 160 or 170 MHz.

dmesg

The system messages report on the discovery of hardware and loading of suitable drivers:

$ dmesg
PROMLIB: Sun Boot Prom Version 3 Revision 2
Linux version 2.6.18-6-sparc32 (Debian 2.6.18.dfsg.1-23etch1) (dannf@debian.org) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #1 Fri Dec 12 16:29:52 UTC 2008
ARCH: SUN4M
TYPE: SPARCstation 5
Ethernet address: 52:54:0:12:34:56
Boot time fixup v1.6. 4/Mar/98 Jakub Jelinek (jj@ultra.linux.cz). Patching kernel for srmmu[Fujitsu Swift]/iommu
On node 0 totalpages: 27255
DMA zone: 27255 pages, LIFO batch:7
PROM: Built device tree with 23190 bytes of memory.
Power off control detected.
Built 1 zonelists. Total pages: 27255
Kernel command line: root=/dev/sda2 ro
PID hash table entries: 512 (order: 9, 2048 bytes)
start_kernel(): bug: interrupts were enabled early
Console: colour dummy device 80x25
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 105628k/114560k available (1640k kernel code, 8780k reserved, 404k data, 136k init, 0k highmem)
Calibrating delay loop... 313.75 BogoMIPS (lpj=1568768)
Mount-cache hash table entries: 512
checking if image is initramfs... it is
Freeing initrd memory: 3159k freed
NET: Registered protocol family 16
IOMMU: impl 0 vers 5 table 0xf3200000[262144 B] map [65536 b]
sbus0: Clock 21.1250 MHz
dma0: Revision 2
dma1: Revision 2
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 4096 bind 2048)
TCP reno registered
ioremap: done with statics, switching to malloc
apc: power management initialized
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
Initializing Cryptographic API
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 128x48
/iommu@0,10000000/sbus@0,10001000/SUNW,tcx@3,800000: TCX at 0:50800000, 8-bit onlyffd37520: ttyS0 at MMIO 0x71100000 (irq = 44) is a zs
ffd37520: ttyS1 at MMIO 0x71100004 (irq = 44) is a zs
ffd37798: Keyboard at MMIO 71000000 (irq = 44) is a zs
ffd37798: Mouse at MMIO 71000004 (irq = 44) is a zs
Floppy drive(s): fd0 is 1.44M
FDC 0 is a S82078B
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
rtc_sun_init: Registered Mostek RTC driver.
mice: PS/2 mouse device common for all mice
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Freeing unused kernel memory: 136k freed
input: Sun Type 5 keyboard as /class/input/input0
SCSI subsystem initialized
esp0: IRQ 36 SCSI ID 7 Clk 40MHz CCYC=25000 CCF=8 TOut 167 NCR53C9XF(espfast)
scsi0 : Sparc ESP100A-FAST
Vendor: QEMU Model: QEMU HARDDISK Rev: 2.5+
Type: Direct-Access ANSI SCSI revision: 05
Vendor: QEMU Model: QEMU CD-ROM Rev: 2.5+
Type: CD-ROM ANSI SCSI revision: 05
SCSI device sda: 20971520 512-byte hdwr sectors (10737 MB)
sda: Write Protect is off
sda: Mode Sense: 63 00 00 08
SCSI device sda: drive cache: write back
SCSI device sda: 20971520 512-byte hdwr sectors (10737 MB)
sda: Write Protect is off
sda: Mode Sense: 63 00 00 08
SCSI device sda: drive cache: write back
sda: sda1 sda2 sda3 sda4
sd 0:0:0:0: Attached scsi disk sda
EXT3-fs: INFO: recovery required on readonly filesystem.
EXT3-fs: write access will be enabled during recovery.
kjournald starting. Commit interval 5 seconds
EXT3-fs: recovery complete.
EXT3-fs: mounted filesystem with ordered data mode.
sr0: scsi3-mmc drive: 16x/50x cd/rw xa/form2 cdda tray
Uniform CD-ROM driver Revision: 3.20
sr 0:0:2:0: Attached scsi CD-ROM sr0
sd 0:0:0:0: Attached scsi generic sg0 type 0
sr 0:0:2:0: Attached scsi generic sg1 type 5
input: Sun Mouse as /class/input/input1
Adding 506036k swap on /dev/sda4. Priority:-1 extents:1 across:506036k
EXT3 FS on sda2, internal journal
loop: loaded (max 8 devices)
sunlance.c:v2.02 8/24/03 Miguel de Icaza (miguel@nuclecu.unam.mx)
SunLance: using auto-carrier-detection.
eth0: LANCE 52:54:00:12:34:56
device-mapper: ioctl: 4.7.0-ioctl (2006-06-24) initialised: dm-devel@redhat.com
kjournald starting. Commit interval 5 seconds
EXT3 FS on sda1, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
NET: Registered protocol family 10
lo: Disabled Privacy Extensions
IPv6 over IPv4 tunneling driver
lp: driver loaded but no devices found

Lots of stuff in here... notable things are:

  • device names for the disk drives featuring "QEMU"
  • Sbus clock of ~21MHz which is within the spec range of 16 to 25 MHz
  • Sun Type 5 Keyboard and Sun Mouse devices for input. Although the mouse driver mentions PS/2 the Sun Mouse was based on the Mouse Systems Bus Mouse.
  • SCSI interface identification giving device and chipset.

Thoughts

The BogoMIPS (Wikipedia; TLDP) result given in /proc/cpuinfo and dmesg, of 313.75 suggests much better performance than the original Sun SPARCstation 5 hardware.

This generation of SPARC processors give BogoMIPS results that are approximately equal to their clock speed, so the BogoMIPS result of 313.75 suggests the emulated processor would be equivalent to a SPARC clocked at about 315 MHz. Comparing with the results recorded for SPARC systems in the BogoMIPS Mini-HOWTO this suggests performance on par with the early UltraSPARC systems. Due to the layers of virtualization and emulation involved here there will be quite a bit of variation between boots, but looking at a couple of other results (367.00, 371.09, 367.00) it seems this was at the lower end of the variation.

Not bad for an emulated processor running in a virtual machine (Debian 10 on VirtualBox on MS Windows 10) on a processor more than 10 years old (Intel i7-860), especially since the default emulation is being used with no additional tuning.

QEMU Command

For those interested, the emulated system, using OpenBIOS, was started using the command:

$ qemu-system-sparc -machine 'SS-5' -hda debian_etch_sparc.qcow2 -net nic -net user -name 'Debian Linux 4.0 (etch) on SPARCstation 5'

In this case OpenBIOS automatically starts Linux from the main disk.


Benchmarks

It would be useful to have an additional performance measure, besides the BogoMips psuedo-benchmark. Fortunately Debian Linux includes an option...

OpenSSL

Using the speed test of some older cryptographic methods provided by OpenSSL:

$ openssl speed md5
Doing md5 for 3s on 16 size blocks: 234309 md5's in 3.01s
Doing md5 for 3s on 64 size blocks: 218978 md5's in 3.01s
Doing md5 for 3s on 256 size blocks: 178454 md5's in 3.01s
Doing md5 for 3s on 1024 size blocks: 128596 md5's in 3.01s
Doing md5 for 3s on 8192 size blocks: 34335 md5's in 3.01s
OpenSSL 0.9.8c 05 Sep 2006
built on: Thu May  8 01:39:50 UTC 2008
options:bn(64,32) md2(int) rc4(ptr,char) des(idx,cisc,16,long) aes(partial) blowfish(ptr) 
compiler: gcc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DB_ENDIAN -DTERMIO -O3 -g -Wall
available timing options: TIMES TIMEB HZ=100 [sysconf value]
timing function used: times
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
md5               1245.50k     4656.01k    15177.48k    43748.27k    93445.95k
$ openssl speed rsa
Doing 512 bit private rsa's for 10s: 1162 512 bit private RSA's in 9.99s
Doing 512 bit public rsa's for 10s: 6615 512 bit public RSA's in 10.01s
Doing 1024 bit private rsa's for 10s: 332 1024 bit private RSA's in 10.00s
Doing 1024 bit public rsa's for 10s: 4877 1024 bit public RSA's in 10.01s
Doing 2048 bit private rsa's for 10s: 79 2048 bit private RSA's in 10.00s
Doing 2048 bit public rsa's for 10s: 2513 2048 bit public RSA's in 10.02s
Doing 4096 bit private rsa's for 10s: 14 4096 bit private RSA's in 10.62s
Doing 4096 bit public rsa's for 10s: 864 4096 bit public RSA's in 10.01s
OpenSSL 0.9.8c 05 Sep 2006
built on: Thu May  8 01:39:50 UTC 2008
options:bn(64,32) md2(int) rc4(ptr,char) des(idx,cisc,16,long) aes(partial) blowfish(ptr) 
compiler: gcc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DB_ENDIAN -DTERMIO -O3 -g -Wall
available timing options: TIMES TIMEB HZ=100 [sysconf value]
timing function used: times
                  sign    verify    sign/s verify/s
rsa  512 bits 0.008597s 0.001513s    116.3    660.8
rsa 1024 bits 0.030120s 0.002052s     33.2    487.2
rsa 2048 bits 0.126582s 0.003987s      7.9    250.8
rsa 4096 bits 0.758571s 0.011586s      1.3     86.3

Extracting the relevant benchmark figures:

  • OpenSSL speed MD5 8,192 bytes: 93,445.95k
  • OpenSSL speed RSA 4,096 bytes sign/s: 1.3
  • OpenSSL speed RSA 4,096 bytes verify/s: 86.3

And adding them to the collection: OpenSSL Speed Results


No comments: