Saturday, 22 May 2021

Solaris 2.6 for SPARC (sun4m) on QEMU - System Information

Solaris 2.6

In 1992 Sun Microsystems (Wikipedia) released the first version of their System V release 4 based UNIX operating system, named Solaris 2.0 (Wikipedia). Over the next few years Solaris 2 releases replaced SunOS (Wikipedia), Sun's earlier BSD based UNIX, for new systems. By the last release of the Solaris 2.x line in 1997 (Solaris 2.6 aka. SunOS 5.6), Solaris was well established as the operating system on Sun's SPARC systems. However a reminder of the pedigree of the operating systems was left, in the use of "SunOS" as the internal name of the operating system, appearing in the output of various commands.

QEMU and SPARC

QEMU supports emulation of 32-bit SPARC and 64-bit UltraSAPRC systems suitable for running Solaris for SPARC.

Many examples can be found online, of installing Solaris on QEMU emulated SPARC systems:

It readily apparent, from the volume of Solaris on QEMU descriptions and tutorials, that QEMU is a popular solution for running older version of SunOS and Solaris on SPARC platforms. Given the popularity of Solaris back in the 1990s and the amount of software developed for the platform, it is unsurprising that there is an interest in having a reliable way to run such systems, without having to deal with the ageing hardware.

So can we tell if a Solaris system is running on QEMU? Well there are various commands to get information about the system in Solaris (see UNIX System Information - Sun Solaris), so do any of them give hints?

QEMU Setup

The default emulated 32-bit SPARC system in QEMU is a SPARCstation 5 (Wikipedia), with a configuration of:

  • Buses: Mbus & Sbus
  • CPU: microSPARC II
  • RAM: 128 MiB (max. 256 MiB)
  • SCSI controller: Sun esp (Emulex SCSI Processor)
  • Network controller: Sun LANCE (based on AMD Lance)
  • Graphics: Sun TCX

Since UNIX systems always like more memory, and modern systems have loads in comparison to this emulated system, I'm maxing the memory configuration to 256 MiB for the emulated system (when using the server class system emulations more memory is available, my experimentation suggests 1856 MiB is the upper limit for the SPARCstation 10 and 20 emulations).

System Information

So lets see what the system has to say for itself...

uname

Operating system name, version and architecture.

# uname -a
SunOS qemu-sol26 5.6 Generic_105181-05 sun4m sparc SUNW,SPARCstation-5

So SunOS release 5.6, aka. Solaris 2.6, version Generic_105181-05, on an Mbus Sun-4 (SPARC) system aka. sun4m, which is a SPARCstation 5.

arch

Application and kernel architecture.

# arch
sun4
# arch -k
sun4m

The SPARCstation 5 is a 32-bin SPARC system based on Mbus so sun4m for the kernel, and sun4 for the user-space support.

showrev

Software revision information

# showrev
Hostname: qemu-sol26
Hostid: 80123456
Release: 5.6
Kernel architecture: sun4m
Application architecture: sparc
Hardware provider: Sun_Microsystems
Domain: 
Kernel version: SunOS 5.6 Generic 105181-05 March 1998

Again a sun4m class system running SunOS 5.6 (aka. Solaris 2.6).

/etc/release

Operating system release information.

# cat /etc/release
                  Solaris 2.6 5/98 s297s_hw3smccServer_09 SPARC
           Copyright 1998 Sun Microsystems, Inc.  All Rights Reserved.
                           Assembled on 24 April 1998

Here we get the marketing name (Solaris 2.6), details of the release kit (5/98) and that this is on SPARC.

dmesg

System log messages

# dmesg
May 14 15:34
SunOS Release 5.6 Version Generic_105181-05 [UNIX(R) System V Release 4.0]
Copyright (c) 1983-1997, Sun Microsystems, Inc.
vac: enabled in write through mode
cpu0: FMI,MB86904 (mid 0 impl 0x0 ver 0x4 clock 1144 MHz)
mem = 262144K (0x10000000)
avail mem = 259100672
Ethernet address = 52:54:0:12:34:56
root nexus = SUNW,SPARCstation-5
iommu0 at root: obio 0x10000000
sbus0 at iommu0: obio 0x10001000
espdma0 at sbus0: SBus slot 5 0x8400000
esp0:   esp-options=0x46
esp0 at espdma0: SBus slot 5 0x8800000 sparc ipl 4
esp0 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000
sd0 at esp0: target 0 lun 0
sd0 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0
        <SUN2.1G cyl 2733 alt 2 hd 19 sec 80>
sd2 at esp0: target 2 lun 0
sd2 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@2,0
root on /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0:a fstype ufs
obio0 at root
zs0 at obio0: obio 0x100000 sparc ipl 12
zs0 is /obio/zs@0,100000
zs1 at obio0: obio 0x0 sparc ipl 12
zs1 is /obio/zs@0,0
cpu 0 initialization complete - online
ledma0 at sbus0: SBus slot 5 0x8400010
le0 at ledma0: SBus slot 5 0x8c00000 sparc ipl 6
le0 is /iommu@0,10000000/sbus@0,10001000/ledma@5,8400010/le@5,8c00000
dump on /dev/dsk/c0t0d0s1 size 151224K

Lots of stuff about the system and devices here, but nothing obvious pointing to QEMU.

Based on other systems running on QEMU, if the disk drive names were shown, their name would indicate that Solaris was running on QEMU.

psrinfo

Processor information

# psrinfo -v
Status of processor 0 as of: 05/14/21 15:38:54
  Processor has been on-line since 05/14/21 15:18:22.
  The sparc processor operates at 1144 MHz,
        and has a sparc floating point processor.

Wow that clock speed seems a bit excessive... and is much higher than the Sun OpenBoot firmware reports (the QEMU supplied OpenBIOS firmware doesn't feature the cpu-info command used here):

ok .version
Release 2.15 Version 5 created 95/03/29 14:21:55
ok cpu-info
CPU FMI,MB86904 Rev. 2.3 : 144.0 Mhz 
SBus (Divide By 2)       : 572.0 Mhz 
DRAM Refresh Setting     : 7 
DRAM Speed Setting       : 0

So this looks like a difference in how the clock speeds are derived by these commands. The processor frequency of 1144 MHz is double the Sbus frequency of 572 MHz, and the reported CPU frequency of 144 MHz looks like it could be a truncation to three digits of 1144 MHz.

Booting using the QEMU supplied version of the OpenBIOS firmware, instead of the Sun OpenBoot firmware, gives a different result from psrinfo with a processor frequency that is more in keeping with a SPARCstation 5.

# psrinfo -v
Status of processor 0 as of: 05/16/21 14:18:08
  Processor has been on-line since 05/16/21 14:08:11.
  The sparc processor operates at 170 MHz,
        and has a sparc floating point processor.

So it looks to a be an effect of how the processor frequency is derived, which depends on the information in the system firmware.

Checking with an alternative Sun OpenBoot PROM, which supports the 170 MHz TurboSPARC, shows similar behavior to the regular OpenBoot version, although the information is presented differently:

ok .version
Release 2.29 Version 50 created 97/01/13 11:24:50
ok cpu-info
CPU FMI,MB86907 Rev. fffffffa.3 : 661.0 Mhz 
SBus (Divide IOCLK By 6) : 110.7 Mhz 
AFX clock divisor        : 2 
IO Clock divisor         : 3 
Ecache size              : None (0) 
DRAM Refresh Setting     : 2 
DRAM Speed Setting       : 5 
ok module-info
CPU FMI,MB86907 Rev. fffffffa.3 : 661.0 Mhz 
SBus (Divide IOCLK By 6) : 110.7 Mhz 

So OpenBoot reports a CPU with a clock of >600MHz and an Sbus clock of >100 MHz, and the operating system says:

# psrinfo -v
Status of processor 0 as of: 05/16/21 14:44:17
  Processor has been on-line since 05/16/21 14:42:50.
  The sparc processor operates at 1661 MHz,
        and has a sparc floating point processor.

So similar to before... While the numbers are a bit different, it still looks like there is truncation in the numbers OpenBoot is reporting (661.0 MHz vs. 1661 MHz). So does the performance live up to these figures? In order to find out we're going to need to use a benchmark.

prtconf

Report system configuration:

# prtconf
System Configuration:  Sun Microsystems  sun4m
Memory size: 256 Megabytes
System Peripherals (Software Nodes):
SUNW,SPARCstation-5
    packages (driver not attached)
        disk-label (driver not attached)
        deblocker (driver not attached)
        obp-tftp (driver not attached)
    options, instance #0
    aliases (driver not attached)
    openprom (driver not attached)
    iommu, instance #0
        sbus, instance #0
            espdma, instance #0
                esp, instance #0
                    sd (driver not attached)
                    st (driver not attached)
                    sd, instance #0
                    sd, instance #1 (driver not attached)
                    sd, instance #2
                    sd, instance #3 (driver not attached)
                    sd, instance #4 (driver not attached)
                    sd, instance #5 (driver not attached)
                    sd, instance #6 (driver not attached)
            SUNW,bpp (driver not attached)
            ledma, instance #0
                le, instance #0
            SUNW,CS4231 (driver not attached)
            power-management (driver not attached)
            SUNW,tcx, instance #0
    obio, instance #0
        zs, instance #0
        zs, instance #1
        eeprom (driver not attached)
        slavioconfig (driver not attached)
        auxio (driver not attached)
        counter (driver not attached)
        interrupt (driver not attached)
        power (driver not attached)
        SUNW,fdtwo (driver not attached)
    memory (driver not attached)
    virtual-memory (driver not attached)
    FMI,MB86904 (driver not attached)
    pseudo, instance #0

So lots of info about the installed devices presented in a tree. What do we have:

  • RAM: 256 Megabytes
  • System: SUNW,SPARCstation-5 => SPARCstation 5
  • SCSI controller: esp
  • Parallel port: SUNW,bpp
  • Network controller: le => Sun LANCE
  • Audio: SUNW,CS4231
  • Graphics: SUNW,tcx => Sun TCX
  • Floppy controller: SUNW,fdtwo
  • CPU: FMI,MB86904 => microSPARC II

Which is the expected hardware for the emulated SPARCstation 5. But still no hints that this is on QEMU...

Benchmark

BogoMips

BogoMips (Wikipedia) is a "busy doing nothing" pseudo benchmark, used in the Linux kernel, that happens to reflect processor clock speeds. So it seems like a good fit for working out how the emulated machine compares to real hardware, while addressing the processor frequency issue. The BogoMips mini-Howto contains a list of BogoMips results for various SPARC systems either running Linux (4.12. Sparc systems) or other operating systems (4.17. Non-Linux systems (reference only)) so we have some results to compare with.

Since we're not running Linux we'll use a portable implementation (bogo-1.2.tar.gz) of about the same era as most of the collected results. And to allow for variation we'll use a wrapper script to run the program 5 times:

% ./bogo.sh
Calibrating delay loop.. ok - 332.00 BogoMips
Calibrating delay loop.. ok - 334.00 BogoMips
Calibrating delay loop.. ok - 332.00 BogoMips
Calibrating delay loop.. ok - 330.00 BogoMips
Calibrating delay loop.. ok - 332.00 BogoMips

So that looks to be about 330 to 335 BogoMips. For the 32-bit SPARC processors the BogoMips score is approximately equivalent to the processor clock frequency, so we can estimate that this emulated SPARCstation 5 has the equivalent of a 330 MHz SPARC processor. The fastest processor available for the SPARCstation 5 was the 170 MHz TurboSPARC, which is close to half of our observed 330 Mhz.

So the claimed >1000 MHz speeds, are bogus. At a guess they probably reflect a hypothetical maximum speed for the processor, given more powerful hardware than I'm using. For practical purposes this may also help with software that checks these figures during installation.

Thoughts

Solaris running on a QEMU emulated SPARC system, looks to be close to indistinguishable from Solaris running on real SPARC system. The only differences observed were significantly better performance and the reporting of an unlikely processor clock speed.

The observed performance of the system however is telling since it was not achievable on the SPARCstation 5. However this would be unlikely to cause problems, the SPARCstation 5 came with a range of SPARC processor variants (microSPARC and TurboSPARC) running a a range of processor clock speeds (70, 85, 110 160 or 170 MHz). So system performance wasn't fixed when dealing with real hardware, and for most applications faster would generally be considered a good thing.

From experience with other operating systems running on QEMU, the giveaway feature is usually the disk drive manufacture and model names. So it may be that the disk management tools would reveal the true nature of the system.

QEMU Command

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

$ qemu-system-sparc \
    -machine 'SS-5' \
    -bios ss5.bin \
    -m size=256M \
    -hda hda_ss5_sun_solaris.qcow2 \
    -cdrom Solaris_2.6_SPARC_5-98.iso \
    -net nic -net user \
    -name 'Solaris 2.6 on SPARCstation 5'

Once the OpenBoot firmware has started, the system on disk was started with:

ok boot disk0

Since the target operating system is Sun Solaris using the Sun OpenBoot firmware maximises compatibility. The QEMU supplied OpenBIOS can also be used and works fine.


No comments: