macppc can't modify pages in swap

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

macppc can't modify pages in swap

George Koehler-2
>Synopsis: macppc can't modify pages in swap
>Category: powerpc
>Environment:
        System      : OpenBSD 6.4
        Details     : OpenBSD 6.4-current (GENERIC) #312: Fri Dec 14 09:54:07 MST 2018
                         [hidden email]:/usr/src/sys/arch/macppc/compile/GENERIC

        Architecture: OpenBSD.macppc
        Machine     : macppc
>Description:
        My PowerBook5,4 suffers from corrupt memory after it begins to
use swap.  This causes random crashes or infinite loops in programs
like fvwm, g++, tmux, top, xterm.  This problem only happens in
OpenBSD/macppc, not when the same machine is running Mac OS X, and
also not in a virtual machine running OpenBSD/amd64.
        My test program can write pages but can't modify them, as if
OpenBSD is ignoring writes to pages after they got swapped out and in.

>How-To-Repeat:
        The attached program check64.c reliably reproduces the
problem.  The program allocates 1G of memory because my PowerBook has
1G of RAM, so the program must use swap.
        The program writes deterministic random numbers to memory,
then reads and checks these numbers.  The seed 1 sequence has no
errors.  The seed 2 sequence has 234632192 errors, and all the errors
match the seed 1 sequence.  The seed 3 and seed 4 sequences have
more errors, and keep the 234632192 seed 1 matches.

$ cc -O2 -o check64 check64.c
$ ulimit -d $(ulimit -dH)
$ ./check64
w................................................................
r................................................................
correct: 268435456, errors: 0
w................................................................
rnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnm........
first error: address 0xbf08c000, have 0x77eef724, expect 0xa25febaf
correct: 33803264, errors: 234632192, seed 1: 234632192
w................................................................
rnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnm....
first error: address 0xbf08c000, have 0x77eef724, expect 0xf217f5cf
correct: 17140736, errors: 251294720, seed 1: 234632192
w................................................................
rnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
first error: address 0xbf08c000, have 0x77eef724, expect 0xeeab3b77
correct: 0, errors: 268435456, seed 1: 234632192
w..^C

>Fix:
        Don't know.
        The second attachment is the output of `eeprom -p` as root.


dmesg:
OpenBSD 6.4-current (GENERIC) #312: Fri Dec 14 09:54:07 MST 2018
    [hidden email]:/usr/src/sys/arch/macppc/compile/GENERIC
real mem = 1073741824 (1024MB)
avail mem = 1027256320 (979MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root: model PowerBook5,4
cpu0 at mainbus0: 7447A (Revision 0x101): 1333 MHz: 512KB L2 cache
mem0 at mainbus0
spdmem0 at mem0: 1GB DDR SDRAM non-parity PC2700CL2.5
memc0 at mainbus0: uni-n rev 0xd2
"hw-clock" at memc0 not configured
kiic0 at memc0 offset 0xf8001000
iic0 at kiic0
adt0 at iic0 addr 0xae: adt7460 rev 0x62
mpcpcibr0 at mainbus0 pci: uni-north
pci0 at mpcpcibr0 bus 0
pchb0 at pci0 dev 11 function 0 "Apple UniNorth AGP" rev 0x00
agp at pchb0 not configured
radeondrm0 at pci0 dev 16 function 0 "ATI Radeon Mobility M10" rev 0x00
drm0 at radeondrm0
radeondrm0: irq 48
mpcpcibr1 at mainbus0 pci: uni-north
pci1 at mpcpcibr1 bus 0
macobio0 at pci1 dev 23 function 0 "Apple Intrepid" rev 0x00
openpic0 at macobio0 offset 0x40000: version 0x4614 feature 3f0302 LE
macgpio0 at macobio0 offset 0x50
"modem-reset" at macgpio0 offset 0x1d not configured
"modem-power" at macgpio0 offset 0x1c not configured
macgpio1 at macgpio0 offset 0x9: irq 47
"programmer-switch" at macgpio0 offset 0x11 not configured
dfs0 at macgpio0 offset 0x6b: speeds: 1333, 666 MHz
"gpio4" at macgpio0 offset 0x1e not configured
"gpio5" at macgpio0 offset 0x6f not configured
"gpio6" at macgpio0 offset 0x70 not configured
"extint-gpio4" at macgpio0 offset 0x5c not configured
"gpio11" at macgpio0 offset 0x75 not configured
"extint-gpio15" at macgpio0 offset 0x67 not configured
"escc-legacy" at macobio0 offset 0x12000 not configured
zs0 at macobio0 offset 0x13000: irq 22,23
zstty0 at zs0 channel 0
zstty1 at zs0 channel 1
aoa0 at macobio0 offset 0x10000: irq 30,1,2
"timer" at macobio0 offset 0x15000 not configured
adb0 at macobio0 offset 0x16000: irq 25, via-pmu, 3 targets
apm0 at adb0: battery flags 0x5, 98% charged
piic0 at adb0
iic1 at piic0
akbd0 at adb0 addr 2: PowerBook G4 keyboard (Inverted T)
wskbd0 at akbd0: console keyboard
ams0 at adb0 addr 3: EMP trackpad <tpad> 4-button, 400 dpi
wsmouse0 at ams0 mux 0
abtn0 at adb0 addr 7: brightness/volume/eject buttons
"battery" at macobio0 offset 0x0 not configured
"backlight" at macobio0 offset 0xf300 not configured
kiic1 at macobio0 offset 0x18000
iic2 at kiic1
wdc0 at macobio0 offset 0x20000 irq 24: DMA
atapiscsi0 at wdc0 channel 0 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: <MATSHITA, CD-RW CW-8123, CA0T> ATAPI 5/cdrom removable
cd0(wdc0:0:0): using BIOS timings, DMA mode 2
audio0 at aoa0
bwi0 at pci1 dev 18 function 0 "Broadcom BCM4306" rev 0x03: irq 52, address 00:0d:93:eb:35:ef
cbb0 at pci1 dev 19 function 0 "TI PCI1510 CardBus" rev 0x00: irq 53
ohci0 at pci1 dev 26 function 0 "Apple Intrepid USB" rev 0x00: irq 29, version 1.0, legacy support
ohci1 at pci1 dev 27 function 0 "NEC USB" rev 0x43: irq 63, version 1.0
ohci2 at pci1 dev 27 function 1 "NEC USB" rev 0x43: irq 63, version 1.0
ehci0 at pci1 dev 27 function 2 "NEC USB" rev 0x04: irq 63
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 configuration 1 interface 0 "NEC EHCI root hub" rev 2.00/1.00 addr 1
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 1 device 0 cacheline 0x8, lattimer 0x20
pcmcia0 at cardslot0
usb1 at ohci0: USB revision 1.0
uhub1 at usb1 configuration 1 interface 0 "Apple OHCI root hub" rev 1.00/1.00 addr 1
usb2 at ohci1: USB revision 1.0
uhub2 at usb2 configuration 1 interface 0 "NEC OHCI root hub" rev 1.00/1.00 addr 1
usb3 at ohci2: USB revision 1.0
uhub3 at usb3 configuration 1 interface 0 "NEC OHCI root hub" rev 1.00/1.00 addr 1
mpcpcibr2 at mainbus0 pci: uni-north
pci2 at mpcpcibr2 bus 0
kauaiata0 at pci2 dev 13 function 0 "Apple Intrepid ATA" rev 0x00
wdc1 at kauaiata0 irq 39: DMA
wd0 at wdc1 channel 0 drive 0: <FUJITSU MHT2060AT>
wd0: 16-sector PIO, LBA48, 57231MB, 117210240 sectors
wd0(wdc1:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 5
"Apple UniNorth Firewire" rev 0x81 at pci2 dev 14 function 0 not configured
gem0 at pci2 dev 15 function 0 "Apple Uni-N2 GMAC" rev 0x80: irq 41, address 00:0d:93:2d:f3:fa
eephy0 at gem0 phy 0: 88E1111 Gigabit PHY, rev. 1
uhidev0 at uhub1 port 1 configuration 1 interface 0 "Apple Computer HID-proxy" rev 2.00/15.86 addr 2
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 variable keys, 6 key codes
wskbd1 at ukbd0 mux 1
uhidev1 at uhub1 port 1 configuration 1 interface 1 "Apple Computer HID-proxy" rev 2.00/15.86 addr 2
uhidev1: iclass 3/1
ums0 at uhidev1: 5 buttons
wsmouse1 at ums0 mux 0
uhidev2 at uhub2 port 1 configuration 1 interface 0 "CHESEN USB Keyboard" rev 1.10/1.10 addr 2
uhidev2: iclass 3/1
ukbd1 at uhidev2: 8 variable keys, 6 key codes, country code 33
wskbd2 at ukbd1 mux 1
uhidev3 at uhub2 port 1 configuration 1 interface 1 "CHESEN USB Keyboard" rev 1.10/1.10 addr 2
uhidev3: iclass 3/0, 3 report ids
uhid0 at uhidev3 reportid 2: input=1, output=0, feature=0
uhid1 at uhidev3 reportid 3: input=3, output=0, feature=0
uhidev4 at uhub3 port 1 configuration 1 interface 0 "Logitech USB-PS/2 Optical Mouse" rev 2.00/11.10 addr 2
uhidev4: iclass 3/1
ums1 at uhidev4: 3 buttons, Z dir
wsmouse2 at ums1 mux 0
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
bootpath: /pci@f4000000/ata-6@d/disk@0:/bsd
root on wd0a (49f4879e4d2301f2.a) swap on wd0b dump on wd0b
initializing kernel modesetting (RV350 0x1002:0x4E50 0x1002:0x4E50).
error: [drm:pid0:radeon_get_bios] *ERROR* Unable to locate a BIOS ROM
error: [drm:pid0:radeon_agp_init] *ERROR* Unable to acquire AGP: 22
radeondrm0: 1280x854, 32bpp
wsdisplay0 at radeondrm0 mux 1: console (std, vt100 emulation), using wskbd0
wskbd1: connecting to wsdisplay0
wskbd2: connecting to wsdisplay0
wsdisplay0: screen 1-5 added (std, vt100 emulation)

usbdevs:
Controller /dev/usb0:
addr 01: 1033:0000 NEC, EHCI root hub
         high speed, self powered, config 1, rev 1.00
         driver: uhub0
Controller /dev/usb1:
addr 01: 106b:0000 Apple, OHCI root hub
         full speed, self powered, config 1, rev 1.00
         driver: uhub1
addr 02: 05ac:1000 Apple Computer, HID-proxy
         full speed, self powered, config 1, rev 15.86
         driver: uhidev0
         driver: uhidev1
Controller /dev/usb2:
addr 01: 1033:0000 NEC, OHCI root hub
         full speed, self powered, config 1, rev 1.00
         driver: uhub2
addr 02: 0a81:0101 CHESEN, USB Keyboard
         low speed, power 100 mA, config 1, rev 1.10
         driver: uhidev2
         driver: uhidev3
Controller /dev/usb3:
addr 01: 1033:0000 NEC, OHCI root hub
         full speed, self powered, config 1, rev 1.00
         driver: uhub3
addr 02: 046d:c00e Logitech, USB-PS/2 Optical Mouse
         low speed, power 98 mA, config 1, rev 11.10
         driver: uhidev4

pcidump:
Domain /dev/pci0:
 0:11:0: Apple UniNorth AGP
        0x0000: Vendor ID: 106b Product ID: 0034
        0x0004: Command: 0016 Status: 02b0
        0x0008: Class: 06 Subclass: 00 Interface: 00 Revision: 00
        0x000c: BIST: 00 Header Type: 00 Latency Timer: 10 Cache Line Size: 08
        0x0010: BAR empty (00000000)
        0x0014: BAR empty (00000000)
        0x0018: BAR empty (00000000)
        0x001c: BAR empty (00000000)
        0x0020: BAR empty (00000000)
        0x0024: BAR empty (00000000)
        0x0028: Cardbus CIS: 00000000
        0x002c: Subsystem Vendor ID: 0000 Product ID: 0000
        0x0030: Expansion ROM Base Address: 00000000
        0x0038: 00000000
        0x003c: Interrupt Pin: 00 Line: 00 Min Gnt: 00 Max Lat: 00
        0x0080: Capability 0x02: AGP
        0x0000: 0034106b 02b00016 06000000 00001008
        0x0010: 00000000 00000000 00000000 00000000
        0x0020: 00000000 00000000 00000000 00000000
        0x0030: 00000000 00000080 00000000 00000000
        0x0040: 00000840 00000000 08000002 00000000
        0x0050: 001000c0 00000000 00000000 00000000
        0x0060: 00000000 00000000 00000000 00000000
        0x0070: 00000000 00000000 00000000 00000000
        0x0080: 00100002 07000217 00000000 00000000
        0x0090: 00000000 00000000 00000001 00000400
        0x00a0: 00000000 00000000 00000000 00000000
        0x00b0: 00000000 00000000 00000000 00000000
        0x00c0: 00000000 00000000 00000000 00000000
        0x00d0: 00000000 00000000 00000000 00000000
        0x00e0: 00000000 00000000 00000000 00000000
        0x00f0: 00000000 00000000 00000000 00000000
 0:16:0: ATI Radeon Mobility M10
        0x0000: Vendor ID: 1002 Product ID: 4e50
        0x0004: Command: 0007 Status: 02b0
        0x0008: Class: 03 Subclass: 00 Interface: 00 Revision: 00
        0x000c: BIST: 00 Header Type: 00 Latency Timer: ff Cache Line Size: 08
        0x0010: BAR mem prefetchable 32bit addr: 0xb8000000/0x08000000
        0x0014: BAR io addr: 0x00000400/0x0100
        0x0018: BAR mem 32bit addr: 0xb0000000/0x00010000
        0x001c: BAR empty (00000000)
        0x0020: BAR empty (00000000)
        0x0024: BAR empty (00000000)
        0x0028: Cardbus CIS: 00000000
        0x002c: Subsystem Vendor ID: 1002 Product ID: 4e50
        0x0030: Expansion ROM Base Address: b0020001
        0x0038: 00000000
        0x003c: Interrupt Pin: 01 Line: ff Min Gnt: 08 Max Lat: 00
        0x0058: Capability 0x02: AGP
        0x0050: Capability 0x01: Power Management
                State: D0
        0x0000: 4e501002 02b00007 03000000 0000ff08
        0x0010: b8000008 00000401 b0000000 00000000
        0x0020: 00000000 00000000 00000000 4e501002
        0x0030: b0020001 00000058 00000000 000801ff
        0x0040: 00000000 00000000 00000000 4e501002
        0x0050: 06020001 00000000 00205002 4f000217
        0x0060: 00000200 00000000 00000000 00000000
        0x0070: 00000000 00000000 00000000 00000000
        0x0080: 00000005 00000000 00000000 00000000
        0x0090: 00000000 00000000 00000000 00000000
        0x00a0: 00000000 00000000 00000000 00000000
        0x00b0: 00000000 00000000 00000000 00000000
        0x00c0: 00000000 00000000 00000000 00000000
        0x00d0: 00000000 00000000 00000000 00000000
        0x00e0: 00000000 00000000 00000000 00000000
        0x00f0: 00000000 00000000 00000000 00000000
Domain /dev/pci1:
 0:18:0: Broadcom BCM4306
        0x0000: Vendor ID: 14e4 Product ID: 4320
        0x0004: Command: 0006 Status: 0010
        0x0008: Class: 02 Subclass: 80 Interface: 00 Revision: 03
        0x000c: BIST: 00 Header Type: 00 Latency Timer: 10 Cache Line Size: 00
        0x0010: BAR mem 32bit addr: 0xa0006000/0x00002000
        0x0014: BAR empty (00000000)
        0x0018: BAR empty (00000000)
        0x001c: BAR empty (00000000)
        0x0020: BAR empty (00000000)
        0x0024: BAR empty (00000000)
        0x0028: Cardbus CIS: 00000000
        0x002c: Subsystem Vendor ID: 106b Product ID: 004e
        0x0030: Expansion ROM Base Address: 00000000
        0x0038: 00000000
        0x003c: Interrupt Pin: 01 Line: 00 Min Gnt: 00 Max Lat: 00
        0x0040: Capability 0x01: Power Management
                State: D0
        0x0000: 432014e4 00100006 02800003 00001000
        0x0010: a0006000 00000000 00000000 00000000
        0x0020: 00000000 00000000 00000000 004e106b
        0x0030: 00000000 00000040 00000000 00000100
        0x0040: ffc20001 00004000 00000000 00000000
        0x0050: 00000000 00000000 00000000 00000000
        0x0060: 00000000 00000000 00000000 00000000
        0x0070: 00000000 00000000 00000000 00000000
        0x0080: 18001000 00000000 00000000 00000000
        0x0090: 00000000 00000200 00000000 00000000
        0x00a0: 00000000 00000000 00000000 00000000
        0x00b0: 000000bf 00000080 000000c0 00000000
        0x00c0: 00000000 00000000 00000000 00000000
        0x00d0: 00000000 00000000 00000000 00000000
        0x00e0: 00000000 00000000 00000000 00000000
        0x00f0: 00000000 00000000 00000000 00000000
 0:19:0: TI PCI1510 CardBus
        0x0000: Vendor ID: 104c Product ID: ac56
        0x0004: Command: 0007 Status: 0210
        0x0008: Class: 06 Subclass: 07 Interface: 00 Revision: 00
        0x000c: BIST: 00 Header Type: 02 Latency Timer: 10 Cache Line Size: 08
        0x0010: Cardbus Control Registers Base Address: a0004000
        0x0018: Primary Bus: 0 Cardbus Bus: 1 Subordinate Bus: 1
                Cardbus Latency Timer: 20
        0x001c: Memory Base 0: fffff000
        0x0020: Memory Limit 0: 00000000
        0x0024: Memory Base 1: fffff000
        0x0028: Memory Limit 1: 00000000
        0x002c: I/O Base 0: fffffffc
        0x0030: I/O Limit 0: 00000000
        0x0034: I/O Base 1: fffffffc
        0x0038: I/O Limit 1: 00000000
        0x003c: Interrupt Pin: 01 Line: ff Bridge Control: 04c0
        0x0040: Subsystem Vendor ID: 0000 Product ID: 0000
        0x0044: 16-bit Legacy Mode Base Address: 00000001
        0x00a0: Capability 0x01: Power Management
                State: D0
        0x0000: ac56104c 02100007 06070000 00021008
        0x0010: a0004000 020000a0 20010100 fffff000
        0x0020: 00000000 fffff000 00000000 fffffffc
        0x0030: 00000000 fffffffc 00000000 04c001ff
        0x0040: 00000000 00000001 00000000 00000000
        0x0050: 00000000 00000000 00000000 00000000
        0x0060: 00000000 00000000 00000000 00000000
        0x0070: 00000000 00000000 00000000 00000000
        0x0080: 08649060 00000000 00000000 00001002
        0x0090: 606600c0 00000000 00008000 00000000
        0x00a0: fe120001 00c00000 00000006 00000001
        0x00b0: 00000000 00000000 00000000 00000000
        0x00c0: 00000000 00000000 00000000 00000000
        0x00d0: 00000000 00000000 00000000 00000000
        0x00e0: 00000000 00000000 00000000 00000000
        0x00f0: 00000000 00000000 00000000 00000000
 0:23:0: Apple Intrepid
        0x0000: Vendor ID: 106b Product ID: 003e
        0x0004: Command: 0006 Status: 0200
        0x0008: Class: ff Subclass: 00 Interface: 00 Revision: 00
        0x000c: BIST: 00 Header Type: 00 Latency Timer: 10 Cache Line Size: 08
        0x0010: BAR mem 32bit addr: 0x80000000/0x00080000
        0x0014: BAR empty (00000000)
        0x0018: BAR empty (00000000)
        0x001c: BAR empty (00000000)
        0x0020: BAR empty (00000000)
        0x0024: BAR empty (00000000)
        0x0028: Cardbus CIS: 00000000
        0x002c: Subsystem Vendor ID: 0000 Product ID: 0000
        0x0030: Expansion ROM Base Address: 00000000
        0x0038: 00000000
        0x003c: Interrupt Pin: 00 Line: 00 Min Gnt: 00 Max Lat: 00
        0x0000: 003e106b 02000006 ff000000 00001008
        0x0010: 80000000 00000000 00000000 00000000
        0x0020: 00000000 00000000 00000000 00000000
        0x0030: 00000000 00000000 00000000 00000000
        0x0040: 00000000 00000000 00000000 00000000
        0x0050: 00000000 00000000 00000000 00000000
        0x0060: 00000000 00000000 00000000 00000000
        0x0070: 00000000 00000000 00000000 00000000
        0x0080: 00000000 00000000 00000000 00000000
        0x0090: 00000000 00000000 00000000 00000000
        0x00a0: 00000000 00000000 00000000 00000000
        0x00b0: 00000000 00000000 00000000 00000000
        0x00c0: 00000000 00000000 00000000 00000000
        0x00d0: 00000000 00000000 00000000 00000000
        0x00e0: 00000000 00000000 00000000 00000000
        0x00f0: 00000000 00000000 00000000 00000000
 0:26:0: Apple Intrepid USB
        0x0000: Vendor ID: 106b Product ID: 003f
        0x0004: Command: 0006 Status: 0200
        0x0008: Class: 0c Subclass: 03 Interface: 10 Revision: 00
        0x000c: BIST: 00 Header Type: 00 Latency Timer: 10 Cache Line Size: 08
        0x0010: BAR mem 32bit addr: 0xa0003000/0x00001000
        0x0014: BAR empty (00000000)
        0x0018: BAR empty (00000000)
        0x001c: BAR empty (00000000)
        0x0020: BAR empty (00000000)
        0x0024: BAR empty (00000000)
        0x0028: Cardbus CIS: 00000000
        0x002c: Subsystem Vendor ID: 0000 Product ID: 0000
        0x0030: Expansion ROM Base Address: 00000000
        0x0038: 00000000
        0x003c: Interrupt Pin: 01 Line: 00 Min Gnt: 03 Max Lat: 56
        0x0000: 003f106b 02000006 0c031000 00001008
        0x0010: a0003000 00000000 00000000 00000000
        0x0020: 00000000 00000000 00000000 00000000
        0x0030: 00000000 00000000 00000000 56030100
        0x0040: 00000000 00000000 00000000 00000000
        0x0050: 00000000 00000000 00000000 00000000
        0x0060: 00000000 00000007 00000000 00000000
        0x0070: 00000000 00000000 00000000 00000000
        0x0080: 00000000 00000000 00000000 00000000
        0x0090: 00000000 00000000 00000000 00000000
        0x00a0: 00000000 00000000 00000000 00000000
        0x00b0: 00000000 00000000 00000000 00000000
        0x00c0: 00000000 00000000 00000000 00000000
        0x00d0: 00000000 00000000 00000000 00000000
        0x00e0: 00000000 00000000 00000000 00000000
        0x00f0: 00000000 00000000 00000000 00000000
 0:27:0: NEC USB
        0x0000: Vendor ID: 1033 Product ID: 0035
        0x0004: Command: 0006 Status: 0210
        0x0008: Class: 0c Subclass: 03 Interface: 10 Revision: 43
        0x000c: BIST: 00 Header Type: 80 Latency Timer: 10 Cache Line Size: 08
        0x0010: BAR mem 32bit addr: 0xa0002000/0x00001000
        0x0014: BAR empty (00000000)
        0x0018: BAR empty (00000000)
        0x001c: BAR empty (00000000)
        0x0020: BAR empty (00000000)
        0x0024: BAR empty (00000000)
        0x0028: Cardbus CIS: 00000000
        0x002c: Subsystem Vendor ID: 1033 Product ID: 0035
        0x0030: Expansion ROM Base Address: 00000000
        0x0038: 00000000
        0x003c: Interrupt Pin: 01 Line: 00 Min Gnt: 01 Max Lat: 2a
        0x0040: Capability 0x01: Power Management
                State: D0
        0x0000: 00351033 02100006 0c031043 00801008
        0x0010: a0002000 00000000 00000000 00000000
        0x0020: 00000000 00000000 00000000 00351033
        0x0030: 00000000 00000040 00000000 2a010100
        0x0040: fe020001 00000000 00000000 00000000
        0x0050: 00000000 00000000 00000000 00000000
        0x0060: 00000000 00000000 00000000 00000000
        0x0070: 00000000 00000000 00000000 00000000
        0x0080: 00000000 00000000 00000000 00000000
        0x0090: 00000000 00000000 00000000 00000000
        0x00a0: 00000000 00000000 00000000 00000000
        0x00b0: 00000000 00000000 00000000 00000000
        0x00c0: 00000000 00000000 00000000 00000000
        0x00d0: 00000000 00000000 00000000 00000000
        0x00e0: 6cb03305 00000000 00000000 00000000
        0x00f0: 00000000 00000000 00000000 00000000
 0:27:1: NEC USB
        0x0000: Vendor ID: 1033 Product ID: 0035
        0x0004: Command: 0006 Status: 0210
        0x0008: Class: 0c Subclass: 03 Interface: 10 Revision: 43
        0x000c: BIST: 00 Header Type: 00 Latency Timer: 10 Cache Line Size: 08
        0x0010: BAR mem 32bit addr: 0xa0001000/0x00001000
        0x0014: BAR empty (00000000)
        0x0018: BAR empty (00000000)
        0x001c: BAR empty (00000000)
        0x0020: BAR empty (00000000)
        0x0024: BAR empty (00000000)
        0x0028: Cardbus CIS: 00000000
        0x002c: Subsystem Vendor ID: 1033 Product ID: 0035
        0x0030: Expansion ROM Base Address: 00000000
        0x0038: 00000000
        0x003c: Interrupt Pin: 02 Line: 00 Min Gnt: 01 Max Lat: 2a
        0x0040: Capability 0x01: Power Management
                State: D0
        0x0000: 00351033 02100006 0c031043 00001008
        0x0010: a0001000 00000000 00000000 00000000
        0x0020: 00000000 00000000 00000000 00351033
        0x0030: 00000000 00000040 00000000 2a010200
        0x0040: fe020001 00000000 00000000 00000000
        0x0050: 00000000 00000000 00000000 00000000
        0x0060: 00000000 00000000 00000000 00000000
        0x0070: 00000000 00000000 00000000 00000000
        0x0080: 00000000 00000000 00000000 00000000
        0x0090: 00000000 00000000 00000000 00000000
        0x00a0: 00000000 00000000 00000000 00000000
        0x00b0: 00000000 00000000 00000000 00000000
        0x00c0: 00000000 00000000 00000000 00000000
        0x00d0: 00000000 00000000 00000000 00000000
        0x00e0: 00000000 00000000 00000000 00000000
        0x00f0: 00000000 00000000 00000000 00000000
 0:27:2: NEC USB
        0x0000: Vendor ID: 1033 Product ID: 00e0
        0x0004: Command: 0006 Status: 0210
        0x0008: Class: 0c Subclass: 03 Interface: 20 Revision: 04
        0x000c: BIST: 00 Header Type: 00 Latency Timer: 10 Cache Line Size: 08
        0x0010: BAR mem 32bit addr: 0xa0000000/0x00000100
        0x0014: BAR empty (00000000)
        0x0018: BAR empty (00000000)
        0x001c: BAR empty (00000000)
        0x0020: BAR empty (00000000)
        0x0024: BAR empty (00000000)
        0x0028: Cardbus CIS: 00000000
        0x002c: Subsystem Vendor ID: 1033 Product ID: 00e0
        0x0030: Expansion ROM Base Address: 00000000
        0x0038: 00000000
        0x003c: Interrupt Pin: 03 Line: 00 Min Gnt: 10 Max Lat: 22
        0x0040: Capability 0x01: Power Management
                State: D0
        0x0000: 00e01033 02100006 0c032004 00001008
        0x0010: a0000000 00000000 00000000 00000000
        0x0020: 00000000 00000000 00000000 00e01033
        0x0030: 00000000 00000040 00000000 22100300
        0x0040: fe020001 00000000 00000000 00000000
        0x0050: 00000000 00000000 00000000 00000000
        0x0060: 003f2020 00000000 00000000 00000000
        0x0070: 00000000 00000000 00000000 00000000
        0x0080: 00000000 00000000 00000000 00000000
        0x0090: 00000000 00000000 00000000 00000000
        0x00a0: 00000000 00000000 00000000 00000000
        0x00b0: 00000000 00000000 00000000 00000000
        0x00c0: 00000000 00000000 00000000 00000000
        0x00d0: 00000000 00000000 00000000 00000000
        0x00e0: 6cb03305 00000000 00000001 c0080000
        0x00f0: 00000000 00000000 00000000 00000000
Domain /dev/pci2:
 0:13:0: Apple Intrepid ATA
        0x0000: Vendor ID: 106b Product ID: 003b
        0x0004: Command: 0006 Status: 8200
        0x0008: Class: ff Subclass: 00 Interface: 00 Revision: 00
        0x000c: BIST: 00 Header Type: 00 Latency Timer: 20 Cache Line Size: 08
        0x0010: BAR mem 32bit addr: 0xf5004000/0x00004000
        0x0014: BAR empty (00000000)
        0x0018: BAR empty (00000000)
        0x001c: BAR empty (00000000)
        0x0020: BAR empty (00000000)
        0x0024: BAR empty (00000000)
        0x0028: Cardbus CIS: 00000000
        0x002c: Subsystem Vendor ID: 0000 Product ID: 0000
        0x0030: Expansion ROM Base Address: 00000000
        0x0038: 00000000
        0x003c: Interrupt Pin: 00 Line: 00 Min Gnt: 00 Max Lat: 00
        0x0000: 003b106b 82000006 ff000000 00002008
        0x0010: f5004000 00000000 00000000 00000000
        0x0020: 00000000 00000000 00000000 00000000
        0x0030: 00000000 00000000 00000000 00000000
        0x0040: 00000000 00000000 00000000 00000000
        0x0050: 00000000 00000000 00000000 00000000
        0x0060: 00000000 00000000 00000000 00000000
        0x0070: 00000000 00000000 00000000 00000000
        0x0080: 00000000 00000000 00000000 00000000
        0x0090: 00000000 00000000 00000000 00000000
        0x00a0: 00000000 00000000 00000000 00000000
        0x00b0: 00000000 00000000 00000000 00000000
        0x00c0: 00000000 00000000 00000000 00000000
        0x00d0: 00000000 00000000 00000000 00000000
        0x00e0: 00000000 00000000 00000000 00000000
        0x00f0: 00000000 00000000 00000000 00000000
 0:14:0: Apple UniNorth Firewire
        0x0000: Vendor ID: 106b Product ID: 0031
        0x0004: Command: 0006 Status: 0290
        0x0008: Class: 0c Subclass: 00 Interface: 10 Revision: 81
        0x000c: BIST: 00 Header Type: 00 Latency Timer: 40 Cache Line Size: 08
        0x0010: BAR mem 32bit addr: 0xf5000000/0x00001000
        0x0014: BAR empty (00000000)
        0x0018: BAR empty (00000000)
        0x001c: BAR empty (00000000)
        0x0020: BAR empty (00000000)
        0x0024: BAR empty (00000000)
        0x0028: Cardbus CIS: 00000000
        0x002c: Subsystem Vendor ID: 106b Product ID: 5811
        0x0030: Expansion ROM Base Address: 00000000
        0x0038: 00000000
        0x003c: Interrupt Pin: 01 Line: 00 Min Gnt: 0c Max Lat: 18
        0x0044: Capability 0x01: Power Management
                State: D0
        0x0000: 0031106b 02900006 0c001081 00004008
        0x0010: f5000000 00000000 00000000 00000000
        0x0020: 00000000 00000000 00000000 5811106b
        0x0030: 00000000 00000044 00000000 180c0100
        0x0040: 00000000 7e020001 00000000 00000000
        0x0050: 00000000 00000000 00000000 00000000
        0x0060: 00000000 00000000 00000000 00000000
        0x0070: 00000000 00000000 00000000 00000000
        0x0080: 000d93ff fe2df3fa 00000000 00000000
        0x0090: 00000000 00000000 00000000 00000000
        0x00a0: 00000000 00000000 00000000 00000000
        0x00b0: 00000000 00000000 00000000 00000000
        0x00c0: 00000000 00000000 00000000 00000000
        0x00d0: 00000000 00000000 00000000 00000000
        0x00e0: 00000000 00000000 00000000 00000000
        0x00f0: 00000000 00000000 00000000 00000000
 0:15:0: Apple Uni-N2 GMAC
        0x0000: Vendor ID: 106b Product ID: 0032
        0x0004: Command: 0006 Status: 84a0
        0x0008: Class: 02 Subclass: 00 Interface: 00 Revision: 80
        0x000c: BIST: 00 Header Type: 00 Latency Timer: 20 Cache Line Size: 20
        0x0010: BAR mem 32bit addr: 0xf5200000/0x00200000
        0x0014: BAR empty (00000000)
        0x0018: BAR empty (00000000)
        0x001c: BAR empty (00000000)
        0x0020: BAR empty (00000000)
        0x0024: BAR empty (00000000)
        0x0028: Cardbus CIS: 00000000
        0x002c: Subsystem Vendor ID: 0000 Product ID: 0000
        0x0030: Expansion ROM Base Address: f5100000
        0x0038: 00000000
        0x003c: Interrupt Pin: 01 Line: ff Min Gnt: 40 Max Lat: 40
        0x0000: 0032106b 84a00006 02000080 00002020
        0x0010: f5200000 00000000 00000000 00000000
        0x0020: 00000000 00000000 00000000 00000000
        0x0030: f5100000 00000000 00000000 404001ff
        0x0040: 00000000 00000000 00000000 00000000
        0x0050: 00000000 00000000 00000000 00000000
        0x0060: 00000000 00000000 00000000 00000000
        0x0070: 00000000 00000000 00000000 00000000
        0x0080: 00000000 00000000 00000000 00000000
        0x0090: 00000000 00000000 00000000 00000000
        0x00a0: 00000000 00000000 00000000 00000000
        0x00b0: 00000000 00000000 00000000 00000000
        0x00c0: 00000000 00000000 00000000 00000000
        0x00d0: 00000000 00000000 00000000 00000000
        0x00e0: 00000000 00000000 00000000 00000000
        0x00f0: 00000000 00000000 00000000 00000000

acpidump:

check64.c (3K) Download Attachment
eeprom-p.gz (13K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: macppc can't modify pages in swap

Otto Moerbeek
On Sat, Dec 15, 2018 at 01:36:37PM -0500, George Koehler wrote:

> >Synopsis: macppc can't modify pages in swap
> >Category: powerpc
> >Environment:
> System      : OpenBSD 6.4
> Details     : OpenBSD 6.4-current (GENERIC) #312: Fri Dec 14 09:54:07 MST 2018
> [hidden email]:/usr/src/sys/arch/macppc/compile/GENERIC
>
> Architecture: OpenBSD.macppc
> Machine     : macppc
> >Description:
> My PowerBook5,4 suffers from corrupt memory after it begins to
> use swap.  This causes random crashes or infinite loops in programs
> like fvwm, g++, tmux, top, xterm.  This problem only happens in
> OpenBSD/macppc, not when the same machine is running Mac OS X, and
> also not in a virtual machine running OpenBSD/amd64.
> My test program can write pages but can't modify them, as if
> OpenBSD is ignoring writes to pages after they got swapped out and in.
>
> >How-To-Repeat:
> The attached program check64.c reliably reproduces the
> problem.  The program allocates 1G of memory because my PowerBook has
> 1G of RAM, so the program must use swap.
> The program writes deterministic random numbers to memory,
> then reads and checks these numbers.  The seed 1 sequence has no
> errors.  The seed 2 sequence has 234632192 errors, and all the errors
> match the seed 1 sequence.  The seed 3 and seed 4 sequences have
> more errors, and keep the 234632192 seed 1 matches.

This is a nasty bug indeed. Some developers already spent time on this
in the past, but they did not find the cause of the problem.

        -Otto

>
> $ cc -O2 -o check64 check64.c
> $ ulimit -d $(ulimit -dH)
> $ ./check64
> w................................................................
> r................................................................
> correct: 268435456, errors: 0
> w................................................................
> rnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnm........
> first error: address 0xbf08c000, have 0x77eef724, expect 0xa25febaf
> correct: 33803264, errors: 234632192, seed 1: 234632192
> w................................................................
> rnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnm....
> first error: address 0xbf08c000, have 0x77eef724, expect 0xf217f5cf
> correct: 17140736, errors: 251294720, seed 1: 234632192
> w................................................................
> rnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
> first error: address 0xbf08c000, have 0x77eef724, expect 0xeeab3b77
> correct: 0, errors: 268435456, seed 1: 234632192
> w..^C
>
> >Fix:
> Don't know.
> The second attachment is the output of `eeprom -p` as root.
>
>
> dmesg:
> OpenBSD 6.4-current (GENERIC) #312: Fri Dec 14 09:54:07 MST 2018
>     [hidden email]:/usr/src/sys/arch/macppc/compile/GENERIC
> real mem = 1073741824 (1024MB)
> avail mem = 1027256320 (979MB)
> mpath0 at root
> scsibus0 at mpath0: 256 targets
> mainbus0 at root: model PowerBook5,4
> cpu0 at mainbus0: 7447A (Revision 0x101): 1333 MHz: 512KB L2 cache
> mem0 at mainbus0
> spdmem0 at mem0: 1GB DDR SDRAM non-parity PC2700CL2.5
> memc0 at mainbus0: uni-n rev 0xd2
> "hw-clock" at memc0 not configured
> kiic0 at memc0 offset 0xf8001000
> iic0 at kiic0
> adt0 at iic0 addr 0xae: adt7460 rev 0x62
> mpcpcibr0 at mainbus0 pci: uni-north
> pci0 at mpcpcibr0 bus 0
> pchb0 at pci0 dev 11 function 0 "Apple UniNorth AGP" rev 0x00
> agp at pchb0 not configured
> radeondrm0 at pci0 dev 16 function 0 "ATI Radeon Mobility M10" rev 0x00
> drm0 at radeondrm0
> radeondrm0: irq 48
> mpcpcibr1 at mainbus0 pci: uni-north
> pci1 at mpcpcibr1 bus 0
> macobio0 at pci1 dev 23 function 0 "Apple Intrepid" rev 0x00
> openpic0 at macobio0 offset 0x40000: version 0x4614 feature 3f0302 LE
> macgpio0 at macobio0 offset 0x50
> "modem-reset" at macgpio0 offset 0x1d not configured
> "modem-power" at macgpio0 offset 0x1c not configured
> macgpio1 at macgpio0 offset 0x9: irq 47
> "programmer-switch" at macgpio0 offset 0x11 not configured
> dfs0 at macgpio0 offset 0x6b: speeds: 1333, 666 MHz
> "gpio4" at macgpio0 offset 0x1e not configured
> "gpio5" at macgpio0 offset 0x6f not configured
> "gpio6" at macgpio0 offset 0x70 not configured
> "extint-gpio4" at macgpio0 offset 0x5c not configured
> "gpio11" at macgpio0 offset 0x75 not configured
> "extint-gpio15" at macgpio0 offset 0x67 not configured
> "escc-legacy" at macobio0 offset 0x12000 not configured
> zs0 at macobio0 offset 0x13000: irq 22,23
> zstty0 at zs0 channel 0
> zstty1 at zs0 channel 1
> aoa0 at macobio0 offset 0x10000: irq 30,1,2
> "timer" at macobio0 offset 0x15000 not configured
> adb0 at macobio0 offset 0x16000: irq 25, via-pmu, 3 targets
> apm0 at adb0: battery flags 0x5, 98% charged
> piic0 at adb0
> iic1 at piic0
> akbd0 at adb0 addr 2: PowerBook G4 keyboard (Inverted T)
> wskbd0 at akbd0: console keyboard
> ams0 at adb0 addr 3: EMP trackpad <tpad> 4-button, 400 dpi
> wsmouse0 at ams0 mux 0
> abtn0 at adb0 addr 7: brightness/volume/eject buttons
> "battery" at macobio0 offset 0x0 not configured
> "backlight" at macobio0 offset 0xf300 not configured
> kiic1 at macobio0 offset 0x18000
> iic2 at kiic1
> wdc0 at macobio0 offset 0x20000 irq 24: DMA
> atapiscsi0 at wdc0 channel 0 drive 0
> scsibus1 at atapiscsi0: 2 targets
> cd0 at scsibus1 targ 0 lun 0: <MATSHITA, CD-RW CW-8123, CA0T> ATAPI 5/cdrom removable
> cd0(wdc0:0:0): using BIOS timings, DMA mode 2
> audio0 at aoa0
> bwi0 at pci1 dev 18 function 0 "Broadcom BCM4306" rev 0x03: irq 52, address 00:0d:93:eb:35:ef
> cbb0 at pci1 dev 19 function 0 "TI PCI1510 CardBus" rev 0x00: irq 53
> ohci0 at pci1 dev 26 function 0 "Apple Intrepid USB" rev 0x00: irq 29, version 1.0, legacy support
> ohci1 at pci1 dev 27 function 0 "NEC USB" rev 0x43: irq 63, version 1.0
> ohci2 at pci1 dev 27 function 1 "NEC USB" rev 0x43: irq 63, version 1.0
> ehci0 at pci1 dev 27 function 2 "NEC USB" rev 0x04: irq 63
> usb0 at ehci0: USB revision 2.0
> uhub0 at usb0 configuration 1 interface 0 "NEC EHCI root hub" rev 2.00/1.00 addr 1
> cardslot0 at cbb0 slot 0 flags 0
> cardbus0 at cardslot0: bus 1 device 0 cacheline 0x8, lattimer 0x20
> pcmcia0 at cardslot0
> usb1 at ohci0: USB revision 1.0
> uhub1 at usb1 configuration 1 interface 0 "Apple OHCI root hub" rev 1.00/1.00 addr 1
> usb2 at ohci1: USB revision 1.0
> uhub2 at usb2 configuration 1 interface 0 "NEC OHCI root hub" rev 1.00/1.00 addr 1
> usb3 at ohci2: USB revision 1.0
> uhub3 at usb3 configuration 1 interface 0 "NEC OHCI root hub" rev 1.00/1.00 addr 1
> mpcpcibr2 at mainbus0 pci: uni-north
> pci2 at mpcpcibr2 bus 0
> kauaiata0 at pci2 dev 13 function 0 "Apple Intrepid ATA" rev 0x00
> wdc1 at kauaiata0 irq 39: DMA
> wd0 at wdc1 channel 0 drive 0: <FUJITSU MHT2060AT>
> wd0: 16-sector PIO, LBA48, 57231MB, 117210240 sectors
> wd0(wdc1:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 5
> "Apple UniNorth Firewire" rev 0x81 at pci2 dev 14 function 0 not configured
> gem0 at pci2 dev 15 function 0 "Apple Uni-N2 GMAC" rev 0x80: irq 41, address 00:0d:93:2d:f3:fa
> eephy0 at gem0 phy 0: 88E1111 Gigabit PHY, rev. 1
> uhidev0 at uhub1 port 1 configuration 1 interface 0 "Apple Computer HID-proxy" rev 2.00/15.86 addr 2
> uhidev0: iclass 3/1
> ukbd0 at uhidev0: 8 variable keys, 6 key codes
> wskbd1 at ukbd0 mux 1
> uhidev1 at uhub1 port 1 configuration 1 interface 1 "Apple Computer HID-proxy" rev 2.00/15.86 addr 2
> uhidev1: iclass 3/1
> ums0 at uhidev1: 5 buttons
> wsmouse1 at ums0 mux 0
> uhidev2 at uhub2 port 1 configuration 1 interface 0 "CHESEN USB Keyboard" rev 1.10/1.10 addr 2
> uhidev2: iclass 3/1
> ukbd1 at uhidev2: 8 variable keys, 6 key codes, country code 33
> wskbd2 at ukbd1 mux 1
> uhidev3 at uhub2 port 1 configuration 1 interface 1 "CHESEN USB Keyboard" rev 1.10/1.10 addr 2
> uhidev3: iclass 3/0, 3 report ids
> uhid0 at uhidev3 reportid 2: input=1, output=0, feature=0
> uhid1 at uhidev3 reportid 3: input=3, output=0, feature=0
> uhidev4 at uhub3 port 1 configuration 1 interface 0 "Logitech USB-PS/2 Optical Mouse" rev 2.00/11.10 addr 2
> uhidev4: iclass 3/1
> ums1 at uhidev4: 3 buttons, Z dir
> wsmouse2 at ums1 mux 0
> vscsi0 at root
> scsibus2 at vscsi0: 256 targets
> softraid0 at root
> scsibus3 at softraid0: 256 targets
> bootpath: /pci@f4000000/ata-6@d/disk@0:/bsd
> root on wd0a (49f4879e4d2301f2.a) swap on wd0b dump on wd0b
> initializing kernel modesetting (RV350 0x1002:0x4E50 0x1002:0x4E50).
> error: [drm:pid0:radeon_get_bios] *ERROR* Unable to locate a BIOS ROM
> error: [drm:pid0:radeon_agp_init] *ERROR* Unable to acquire AGP: 22
> radeondrm0: 1280x854, 32bpp
> wsdisplay0 at radeondrm0 mux 1: console (std, vt100 emulation), using wskbd0
> wskbd1: connecting to wsdisplay0
> wskbd2: connecting to wsdisplay0
> wsdisplay0: screen 1-5 added (std, vt100 emulation)
>
> usbdevs:
> Controller /dev/usb0:
> addr 01: 1033:0000 NEC, EHCI root hub
> high speed, self powered, config 1, rev 1.00
> driver: uhub0
> Controller /dev/usb1:
> addr 01: 106b:0000 Apple, OHCI root hub
> full speed, self powered, config 1, rev 1.00
> driver: uhub1
> addr 02: 05ac:1000 Apple Computer, HID-proxy
> full speed, self powered, config 1, rev 15.86
> driver: uhidev0
> driver: uhidev1
> Controller /dev/usb2:
> addr 01: 1033:0000 NEC, OHCI root hub
> full speed, self powered, config 1, rev 1.00
> driver: uhub2
> addr 02: 0a81:0101 CHESEN, USB Keyboard
> low speed, power 100 mA, config 1, rev 1.10
> driver: uhidev2
> driver: uhidev3
> Controller /dev/usb3:
> addr 01: 1033:0000 NEC, OHCI root hub
> full speed, self powered, config 1, rev 1.00
> driver: uhub3
> addr 02: 046d:c00e Logitech, USB-PS/2 Optical Mouse
> low speed, power 98 mA, config 1, rev 11.10
> driver: uhidev4
>
> pcidump:
> Domain /dev/pci0:
>  0:11:0: Apple UniNorth AGP
> 0x0000: Vendor ID: 106b Product ID: 0034
> 0x0004: Command: 0016 Status: 02b0
> 0x0008: Class: 06 Subclass: 00 Interface: 00 Revision: 00
> 0x000c: BIST: 00 Header Type: 00 Latency Timer: 10 Cache Line Size: 08
> 0x0010: BAR empty (00000000)
> 0x0014: BAR empty (00000000)
> 0x0018: BAR empty (00000000)
> 0x001c: BAR empty (00000000)
> 0x0020: BAR empty (00000000)
> 0x0024: BAR empty (00000000)
> 0x0028: Cardbus CIS: 00000000
> 0x002c: Subsystem Vendor ID: 0000 Product ID: 0000
> 0x0030: Expansion ROM Base Address: 00000000
> 0x0038: 00000000
> 0x003c: Interrupt Pin: 00 Line: 00 Min Gnt: 00 Max Lat: 00
> 0x0080: Capability 0x02: AGP
> 0x0000: 0034106b 02b00016 06000000 00001008
> 0x0010: 00000000 00000000 00000000 00000000
> 0x0020: 00000000 00000000 00000000 00000000
> 0x0030: 00000000 00000080 00000000 00000000
> 0x0040: 00000840 00000000 08000002 00000000
> 0x0050: 001000c0 00000000 00000000 00000000
> 0x0060: 00000000 00000000 00000000 00000000
> 0x0070: 00000000 00000000 00000000 00000000
> 0x0080: 00100002 07000217 00000000 00000000
> 0x0090: 00000000 00000000 00000001 00000400
> 0x00a0: 00000000 00000000 00000000 00000000
> 0x00b0: 00000000 00000000 00000000 00000000
> 0x00c0: 00000000 00000000 00000000 00000000
> 0x00d0: 00000000 00000000 00000000 00000000
> 0x00e0: 00000000 00000000 00000000 00000000
> 0x00f0: 00000000 00000000 00000000 00000000
>  0:16:0: ATI Radeon Mobility M10
> 0x0000: Vendor ID: 1002 Product ID: 4e50
> 0x0004: Command: 0007 Status: 02b0
> 0x0008: Class: 03 Subclass: 00 Interface: 00 Revision: 00
> 0x000c: BIST: 00 Header Type: 00 Latency Timer: ff Cache Line Size: 08
> 0x0010: BAR mem prefetchable 32bit addr: 0xb8000000/0x08000000
> 0x0014: BAR io addr: 0x00000400/0x0100
> 0x0018: BAR mem 32bit addr: 0xb0000000/0x00010000
> 0x001c: BAR empty (00000000)
> 0x0020: BAR empty (00000000)
> 0x0024: BAR empty (00000000)
> 0x0028: Cardbus CIS: 00000000
> 0x002c: Subsystem Vendor ID: 1002 Product ID: 4e50
> 0x0030: Expansion ROM Base Address: b0020001
> 0x0038: 00000000
> 0x003c: Interrupt Pin: 01 Line: ff Min Gnt: 08 Max Lat: 00
> 0x0058: Capability 0x02: AGP
> 0x0050: Capability 0x01: Power Management
> State: D0
> 0x0000: 4e501002 02b00007 03000000 0000ff08
> 0x0010: b8000008 00000401 b0000000 00000000
> 0x0020: 00000000 00000000 00000000 4e501002
> 0x0030: b0020001 00000058 00000000 000801ff
> 0x0040: 00000000 00000000 00000000 4e501002
> 0x0050: 06020001 00000000 00205002 4f000217
> 0x0060: 00000200 00000000 00000000 00000000
> 0x0070: 00000000 00000000 00000000 00000000
> 0x0080: 00000005 00000000 00000000 00000000
> 0x0090: 00000000 00000000 00000000 00000000
> 0x00a0: 00000000 00000000 00000000 00000000
> 0x00b0: 00000000 00000000 00000000 00000000
> 0x00c0: 00000000 00000000 00000000 00000000
> 0x00d0: 00000000 00000000 00000000 00000000
> 0x00e0: 00000000 00000000 00000000 00000000
> 0x00f0: 00000000 00000000 00000000 00000000
> Domain /dev/pci1:
>  0:18:0: Broadcom BCM4306
> 0x0000: Vendor ID: 14e4 Product ID: 4320
> 0x0004: Command: 0006 Status: 0010
> 0x0008: Class: 02 Subclass: 80 Interface: 00 Revision: 03
> 0x000c: BIST: 00 Header Type: 00 Latency Timer: 10 Cache Line Size: 00
> 0x0010: BAR mem 32bit addr: 0xa0006000/0x00002000
> 0x0014: BAR empty (00000000)
> 0x0018: BAR empty (00000000)
> 0x001c: BAR empty (00000000)
> 0x0020: BAR empty (00000000)
> 0x0024: BAR empty (00000000)
> 0x0028: Cardbus CIS: 00000000
> 0x002c: Subsystem Vendor ID: 106b Product ID: 004e
> 0x0030: Expansion ROM Base Address: 00000000
> 0x0038: 00000000
> 0x003c: Interrupt Pin: 01 Line: 00 Min Gnt: 00 Max Lat: 00
> 0x0040: Capability 0x01: Power Management
> State: D0
> 0x0000: 432014e4 00100006 02800003 00001000
> 0x0010: a0006000 00000000 00000000 00000000
> 0x0020: 00000000 00000000 00000000 004e106b
> 0x0030: 00000000 00000040 00000000 00000100
> 0x0040: ffc20001 00004000 00000000 00000000
> 0x0050: 00000000 00000000 00000000 00000000
> 0x0060: 00000000 00000000 00000000 00000000
> 0x0070: 00000000 00000000 00000000 00000000
> 0x0080: 18001000 00000000 00000000 00000000
> 0x0090: 00000000 00000200 00000000 00000000
> 0x00a0: 00000000 00000000 00000000 00000000
> 0x00b0: 000000bf 00000080 000000c0 00000000
> 0x00c0: 00000000 00000000 00000000 00000000
> 0x00d0: 00000000 00000000 00000000 00000000
> 0x00e0: 00000000 00000000 00000000 00000000
> 0x00f0: 00000000 00000000 00000000 00000000
>  0:19:0: TI PCI1510 CardBus
> 0x0000: Vendor ID: 104c Product ID: ac56
> 0x0004: Command: 0007 Status: 0210
> 0x0008: Class: 06 Subclass: 07 Interface: 00 Revision: 00
> 0x000c: BIST: 00 Header Type: 02 Latency Timer: 10 Cache Line Size: 08
> 0x0010: Cardbus Control Registers Base Address: a0004000
> 0x0018: Primary Bus: 0 Cardbus Bus: 1 Subordinate Bus: 1
>        Cardbus Latency Timer: 20
> 0x001c: Memory Base 0: fffff000
> 0x0020: Memory Limit 0: 00000000
> 0x0024: Memory Base 1: fffff000
> 0x0028: Memory Limit 1: 00000000
> 0x002c: I/O Base 0: fffffffc
> 0x0030: I/O Limit 0: 00000000
> 0x0034: I/O Base 1: fffffffc
> 0x0038: I/O Limit 1: 00000000
> 0x003c: Interrupt Pin: 01 Line: ff Bridge Control: 04c0
> 0x0040: Subsystem Vendor ID: 0000 Product ID: 0000
> 0x0044: 16-bit Legacy Mode Base Address: 00000001
> 0x00a0: Capability 0x01: Power Management
> State: D0
> 0x0000: ac56104c 02100007 06070000 00021008
> 0x0010: a0004000 020000a0 20010100 fffff000
> 0x0020: 00000000 fffff000 00000000 fffffffc
> 0x0030: 00000000 fffffffc 00000000 04c001ff
> 0x0040: 00000000 00000001 00000000 00000000
> 0x0050: 00000000 00000000 00000000 00000000
> 0x0060: 00000000 00000000 00000000 00000000
> 0x0070: 00000000 00000000 00000000 00000000
> 0x0080: 08649060 00000000 00000000 00001002
> 0x0090: 606600c0 00000000 00008000 00000000
> 0x00a0: fe120001 00c00000 00000006 00000001
> 0x00b0: 00000000 00000000 00000000 00000000
> 0x00c0: 00000000 00000000 00000000 00000000
> 0x00d0: 00000000 00000000 00000000 00000000
> 0x00e0: 00000000 00000000 00000000 00000000
> 0x00f0: 00000000 00000000 00000000 00000000
>  0:23:0: Apple Intrepid
> 0x0000: Vendor ID: 106b Product ID: 003e
> 0x0004: Command: 0006 Status: 0200
> 0x0008: Class: ff Subclass: 00 Interface: 00 Revision: 00
> 0x000c: BIST: 00 Header Type: 00 Latency Timer: 10 Cache Line Size: 08
> 0x0010: BAR mem 32bit addr: 0x80000000/0x00080000
> 0x0014: BAR empty (00000000)
> 0x0018: BAR empty (00000000)
> 0x001c: BAR empty (00000000)
> 0x0020: BAR empty (00000000)
> 0x0024: BAR empty (00000000)
> 0x0028: Cardbus CIS: 00000000
> 0x002c: Subsystem Vendor ID: 0000 Product ID: 0000
> 0x0030: Expansion ROM Base Address: 00000000
> 0x0038: 00000000
> 0x003c: Interrupt Pin: 00 Line: 00 Min Gnt: 00 Max Lat: 00
> 0x0000: 003e106b 02000006 ff000000 00001008
> 0x0010: 80000000 00000000 00000000 00000000
> 0x0020: 00000000 00000000 00000000 00000000
> 0x0030: 00000000 00000000 00000000 00000000
> 0x0040: 00000000 00000000 00000000 00000000
> 0x0050: 00000000 00000000 00000000 00000000
> 0x0060: 00000000 00000000 00000000 00000000
> 0x0070: 00000000 00000000 00000000 00000000
> 0x0080: 00000000 00000000 00000000 00000000
> 0x0090: 00000000 00000000 00000000 00000000
> 0x00a0: 00000000 00000000 00000000 00000000
> 0x00b0: 00000000 00000000 00000000 00000000
> 0x00c0: 00000000 00000000 00000000 00000000
> 0x00d0: 00000000 00000000 00000000 00000000
> 0x00e0: 00000000 00000000 00000000 00000000
> 0x00f0: 00000000 00000000 00000000 00000000
>  0:26:0: Apple Intrepid USB
> 0x0000: Vendor ID: 106b Product ID: 003f
> 0x0004: Command: 0006 Status: 0200
> 0x0008: Class: 0c Subclass: 03 Interface: 10 Revision: 00
> 0x000c: BIST: 00 Header Type: 00 Latency Timer: 10 Cache Line Size: 08
> 0x0010: BAR mem 32bit addr: 0xa0003000/0x00001000
> 0x0014: BAR empty (00000000)
> 0x0018: BAR empty (00000000)
> 0x001c: BAR empty (00000000)
> 0x0020: BAR empty (00000000)
> 0x0024: BAR empty (00000000)
> 0x0028: Cardbus CIS: 00000000
> 0x002c: Subsystem Vendor ID: 0000 Product ID: 0000
> 0x0030: Expansion ROM Base Address: 00000000
> 0x0038: 00000000
> 0x003c: Interrupt Pin: 01 Line: 00 Min Gnt: 03 Max Lat: 56
> 0x0000: 003f106b 02000006 0c031000 00001008
> 0x0010: a0003000 00000000 00000000 00000000
> 0x0020: 00000000 00000000 00000000 00000000
> 0x0030: 00000000 00000000 00000000 56030100
> 0x0040: 00000000 00000000 00000000 00000000
> 0x0050: 00000000 00000000 00000000 00000000
> 0x0060: 00000000 00000007 00000000 00000000
> 0x0070: 00000000 00000000 00000000 00000000
> 0x0080: 00000000 00000000 00000000 00000000
> 0x0090: 00000000 00000000 00000000 00000000
> 0x00a0: 00000000 00000000 00000000 00000000
> 0x00b0: 00000000 00000000 00000000 00000000
> 0x00c0: 00000000 00000000 00000000 00000000
> 0x00d0: 00000000 00000000 00000000 00000000
> 0x00e0: 00000000 00000000 00000000 00000000
> 0x00f0: 00000000 00000000 00000000 00000000
>  0:27:0: NEC USB
> 0x0000: Vendor ID: 1033 Product ID: 0035
> 0x0004: Command: 0006 Status: 0210
> 0x0008: Class: 0c Subclass: 03 Interface: 10 Revision: 43
> 0x000c: BIST: 00 Header Type: 80 Latency Timer: 10 Cache Line Size: 08
> 0x0010: BAR mem 32bit addr: 0xa0002000/0x00001000
> 0x0014: BAR empty (00000000)
> 0x0018: BAR empty (00000000)
> 0x001c: BAR empty (00000000)
> 0x0020: BAR empty (00000000)
> 0x0024: BAR empty (00000000)
> 0x0028: Cardbus CIS: 00000000
> 0x002c: Subsystem Vendor ID: 1033 Product ID: 0035
> 0x0030: Expansion ROM Base Address: 00000000
> 0x0038: 00000000
> 0x003c: Interrupt Pin: 01 Line: 00 Min Gnt: 01 Max Lat: 2a
> 0x0040: Capability 0x01: Power Management
> State: D0
> 0x0000: 00351033 02100006 0c031043 00801008
> 0x0010: a0002000 00000000 00000000 00000000
> 0x0020: 00000000 00000000 00000000 00351033
> 0x0030: 00000000 00000040 00000000 2a010100
> 0x0040: fe020001 00000000 00000000 00000000
> 0x0050: 00000000 00000000 00000000 00000000
> 0x0060: 00000000 00000000 00000000 00000000
> 0x0070: 00000000 00000000 00000000 00000000
> 0x0080: 00000000 00000000 00000000 00000000
> 0x0090: 00000000 00000000 00000000 00000000
> 0x00a0: 00000000 00000000 00000000 00000000
> 0x00b0: 00000000 00000000 00000000 00000000
> 0x00c0: 00000000 00000000 00000000 00000000
> 0x00d0: 00000000 00000000 00000000 00000000
> 0x00e0: 6cb03305 00000000 00000000 00000000
> 0x00f0: 00000000 00000000 00000000 00000000
>  0:27:1: NEC USB
> 0x0000: Vendor ID: 1033 Product ID: 0035
> 0x0004: Command: 0006 Status: 0210
> 0x0008: Class: 0c Subclass: 03 Interface: 10 Revision: 43
> 0x000c: BIST: 00 Header Type: 00 Latency Timer: 10 Cache Line Size: 08
> 0x0010: BAR mem 32bit addr: 0xa0001000/0x00001000
> 0x0014: BAR empty (00000000)
> 0x0018: BAR empty (00000000)
> 0x001c: BAR empty (00000000)
> 0x0020: BAR empty (00000000)
> 0x0024: BAR empty (00000000)
> 0x0028: Cardbus CIS: 00000000
> 0x002c: Subsystem Vendor ID: 1033 Product ID: 0035
> 0x0030: Expansion ROM Base Address: 00000000
> 0x0038: 00000000
> 0x003c: Interrupt Pin: 02 Line: 00 Min Gnt: 01 Max Lat: 2a
> 0x0040: Capability 0x01: Power Management
> State: D0
> 0x0000: 00351033 02100006 0c031043 00001008
> 0x0010: a0001000 00000000 00000000 00000000
> 0x0020: 00000000 00000000 00000000 00351033
> 0x0030: 00000000 00000040 00000000 2a010200
> 0x0040: fe020001 00000000 00000000 00000000
> 0x0050: 00000000 00000000 00000000 00000000
> 0x0060: 00000000 00000000 00000000 00000000
> 0x0070: 00000000 00000000 00000000 00000000
> 0x0080: 00000000 00000000 00000000 00000000
> 0x0090: 00000000 00000000 00000000 00000000
> 0x00a0: 00000000 00000000 00000000 00000000
> 0x00b0: 00000000 00000000 00000000 00000000
> 0x00c0: 00000000 00000000 00000000 00000000
> 0x00d0: 00000000 00000000 00000000 00000000
> 0x00e0: 00000000 00000000 00000000 00000000
> 0x00f0: 00000000 00000000 00000000 00000000
>  0:27:2: NEC USB
> 0x0000: Vendor ID: 1033 Product ID: 00e0
> 0x0004: Command: 0006 Status: 0210
> 0x0008: Class: 0c Subclass: 03 Interface: 20 Revision: 04
> 0x000c: BIST: 00 Header Type: 00 Latency Timer: 10 Cache Line Size: 08
> 0x0010: BAR mem 32bit addr: 0xa0000000/0x00000100
> 0x0014: BAR empty (00000000)
> 0x0018: BAR empty (00000000)
> 0x001c: BAR empty (00000000)
> 0x0020: BAR empty (00000000)
> 0x0024: BAR empty (00000000)
> 0x0028: Cardbus CIS: 00000000
> 0x002c: Subsystem Vendor ID: 1033 Product ID: 00e0
> 0x0030: Expansion ROM Base Address: 00000000
> 0x0038: 00000000
> 0x003c: Interrupt Pin: 03 Line: 00 Min Gnt: 10 Max Lat: 22
> 0x0040: Capability 0x01: Power Management
> State: D0
> 0x0000: 00e01033 02100006 0c032004 00001008
> 0x0010: a0000000 00000000 00000000 00000000
> 0x0020: 00000000 00000000 00000000 00e01033
> 0x0030: 00000000 00000040 00000000 22100300
> 0x0040: fe020001 00000000 00000000 00000000
> 0x0050: 00000000 00000000 00000000 00000000
> 0x0060: 003f2020 00000000 00000000 00000000
> 0x0070: 00000000 00000000 00000000 00000000
> 0x0080: 00000000 00000000 00000000 00000000
> 0x0090: 00000000 00000000 00000000 00000000
> 0x00a0: 00000000 00000000 00000000 00000000
> 0x00b0: 00000000 00000000 00000000 00000000
> 0x00c0: 00000000 00000000 00000000 00000000
> 0x00d0: 00000000 00000000 00000000 00000000
> 0x00e0: 6cb03305 00000000 00000001 c0080000
> 0x00f0: 00000000 00000000 00000000 00000000
> Domain /dev/pci2:
>  0:13:0: Apple Intrepid ATA
> 0x0000: Vendor ID: 106b Product ID: 003b
> 0x0004: Command: 0006 Status: 8200
> 0x0008: Class: ff Subclass: 00 Interface: 00 Revision: 00
> 0x000c: BIST: 00 Header Type: 00 Latency Timer: 20 Cache Line Size: 08
> 0x0010: BAR mem 32bit addr: 0xf5004000/0x00004000
> 0x0014: BAR empty (00000000)
> 0x0018: BAR empty (00000000)
> 0x001c: BAR empty (00000000)
> 0x0020: BAR empty (00000000)
> 0x0024: BAR empty (00000000)
> 0x0028: Cardbus CIS: 00000000
> 0x002c: Subsystem Vendor ID: 0000 Product ID: 0000
> 0x0030: Expansion ROM Base Address: 00000000
> 0x0038: 00000000
> 0x003c: Interrupt Pin: 00 Line: 00 Min Gnt: 00 Max Lat: 00
> 0x0000: 003b106b 82000006 ff000000 00002008
> 0x0010: f5004000 00000000 00000000 00000000
> 0x0020: 00000000 00000000 00000000 00000000
> 0x0030: 00000000 00000000 00000000 00000000
> 0x0040: 00000000 00000000 00000000 00000000
> 0x0050: 00000000 00000000 00000000 00000000
> 0x0060: 00000000 00000000 00000000 00000000
> 0x0070: 00000000 00000000 00000000 00000000
> 0x0080: 00000000 00000000 00000000 00000000
> 0x0090: 00000000 00000000 00000000 00000000
> 0x00a0: 00000000 00000000 00000000 00000000
> 0x00b0: 00000000 00000000 00000000 00000000
> 0x00c0: 00000000 00000000 00000000 00000000
> 0x00d0: 00000000 00000000 00000000 00000000
> 0x00e0: 00000000 00000000 00000000 00000000
> 0x00f0: 00000000 00000000 00000000 00000000
>  0:14:0: Apple UniNorth Firewire
> 0x0000: Vendor ID: 106b Product ID: 0031
> 0x0004: Command: 0006 Status: 0290
> 0x0008: Class: 0c Subclass: 00 Interface: 10 Revision: 81
> 0x000c: BIST: 00 Header Type: 00 Latency Timer: 40 Cache Line Size: 08
> 0x0010: BAR mem 32bit addr: 0xf5000000/0x00001000
> 0x0014: BAR empty (00000000)
> 0x0018: BAR empty (00000000)
> 0x001c: BAR empty (00000000)
> 0x0020: BAR empty (00000000)
> 0x0024: BAR empty (00000000)
> 0x0028: Cardbus CIS: 00000000
> 0x002c: Subsystem Vendor ID: 106b Product ID: 5811
> 0x0030: Expansion ROM Base Address: 00000000
> 0x0038: 00000000
> 0x003c: Interrupt Pin: 01 Line: 00 Min Gnt: 0c Max Lat: 18
> 0x0044: Capability 0x01: Power Management
> State: D0
> 0x0000: 0031106b 02900006 0c001081 00004008
> 0x0010: f5000000 00000000 00000000 00000000
> 0x0020: 00000000 00000000 00000000 5811106b
> 0x0030: 00000000 00000044 00000000 180c0100
> 0x0040: 00000000 7e020001 00000000 00000000
> 0x0050: 00000000 00000000 00000000 00000000
> 0x0060: 00000000 00000000 00000000 00000000
> 0x0070: 00000000 00000000 00000000 00000000
> 0x0080: 000d93ff fe2df3fa 00000000 00000000
> 0x0090: 00000000 00000000 00000000 00000000
> 0x00a0: 00000000 00000000 00000000 00000000
> 0x00b0: 00000000 00000000 00000000 00000000
> 0x00c0: 00000000 00000000 00000000 00000000
> 0x00d0: 00000000 00000000 00000000 00000000
> 0x00e0: 00000000 00000000 00000000 00000000
> 0x00f0: 00000000 00000000 00000000 00000000
>  0:15:0: Apple Uni-N2 GMAC
> 0x0000: Vendor ID: 106b Product ID: 0032
> 0x0004: Command: 0006 Status: 84a0
> 0x0008: Class: 02 Subclass: 00 Interface: 00 Revision: 80
> 0x000c: BIST: 00 Header Type: 00 Latency Timer: 20 Cache Line Size: 20
> 0x0010: BAR mem 32bit addr: 0xf5200000/0x00200000
> 0x0014: BAR empty (00000000)
> 0x0018: BAR empty (00000000)
> 0x001c: BAR empty (00000000)
> 0x0020: BAR empty (00000000)
> 0x0024: BAR empty (00000000)
> 0x0028: Cardbus CIS: 00000000
> 0x002c: Subsystem Vendor ID: 0000 Product ID: 0000
> 0x0030: Expansion ROM Base Address: f5100000
> 0x0038: 00000000
> 0x003c: Interrupt Pin: 01 Line: ff Min Gnt: 40 Max Lat: 40
> 0x0000: 0032106b 84a00006 02000080 00002020
> 0x0010: f5200000 00000000 00000000 00000000
> 0x0020: 00000000 00000000 00000000 00000000
> 0x0030: f5100000 00000000 00000000 404001ff
> 0x0040: 00000000 00000000 00000000 00000000
> 0x0050: 00000000 00000000 00000000 00000000
> 0x0060: 00000000 00000000 00000000 00000000
> 0x0070: 00000000 00000000 00000000 00000000
> 0x0080: 00000000 00000000 00000000 00000000
> 0x0090: 00000000 00000000 00000000 00000000
> 0x00a0: 00000000 00000000 00000000 00000000
> 0x00b0: 00000000 00000000 00000000 00000000
> 0x00c0: 00000000 00000000 00000000 00000000
> 0x00d0: 00000000 00000000 00000000 00000000
> 0x00e0: 00000000 00000000 00000000 00000000
> 0x00f0: 00000000 00000000 00000000 00000000
>
> acpidump:

> /*
>  * Written in 2018 by George Koehler.  Public domain.
>  */
> #include <sys/mman.h>
> #include <stdint.h>
> #include <stdio.h>
>
> /*
>  * Allocate 1G of memory, because my machine has 1G of RAM,
>  * so my machine must swap.
>  */
> #define SIZE ((size_t)1024 * 1024 * 1024)
>
> /*
>  * This is sfc32, a deterministic random number generator adapted from
>  * public-domain code written by Chris Doty-Humphrey in PractRand 0.94
>  * (http://pracrand.sourceforge.net/).
>  */
> struct rng {
> uint32_t a;
> uint32_t b;
> uint32_t c;
> uint32_t counter;
> };
>
> static uint32_t
> raw32(struct rng *r)
> {
> uint32_t tmp = r->a + r->b + r->counter++;
> r->a = r->b ^ (r->b >> 9);
> r->b = r->c + (r->c << 3);
> r->c = ((r->c << 21) | (r->c >> (32-21))) + tmp;
> return tmp;
> }
>
> static void
> seed(struct rng *r, uint64_t s)
> {
> int i;
> r->a = 0;
> r->b = (s >> 0);
> r->c = (s >> 32);
> r->counter = 1;
> for (i = 0; i < 12; i++)
> raw32(r);
> }
>
> /*
>  * Tests RAM or swap by writing deterministic random numbers, then
>  * reading and checking the numbers.
>  */
> int
> main(void)
> {
> const int COLUMNS = 64;
> const int BYTES = SIZE / COLUMNS;
> const int WORDS = BYTES / sizeof(uint32_t);
> struct rng one, r;
> uint64_t my_seed;
> uint32_t e, expect, *first_error, h, have, o, *p, *ram[COLUMNS];
> size_t errors, log2, total_correct, total_errors, total_one;
> int col, i;
>
> /* Don't buffer stdout. */
> setvbuf(stdout, NULL, _IONBF, 0);
>
> /* Allocate memory in COLUMNS. */
> for (col = 0; col < COLUMNS; col++) {
> ram[col] = mmap(NULL, BYTES, PROT_READ|PROT_WRITE,
>    MAP_PRIVATE|MAP_ANON, -1, 0);
> if (ram[col] == MAP_FAILED) {
> printf("Can't mmap %zu bytes in column %d.\n",
>    (size_t)SIZE, col);
> return 1;
> }
> }
>
> for (my_seed = 1;; my_seed++) {
> /* Write random numbers to ram. */
> seed(&r, my_seed);
> putchar('w');
> for (col = 0; col < COLUMNS; col++) {
> p = ram[col];
> for (i = 0; i < WORDS; i++) {
> *p = raw32(&r);
> p++;
> }
> putchar('.');
> }
> putchar('\n');
>
> /* Check values in ram. */
> first_error = NULL;
> total_correct = total_errors = total_one = 0;
> seed(&r, my_seed);
> seed(&one, 1);
> putchar('r');
> for (col = 0; col < COLUMNS; col++) {
> errors = 0;
> p = ram[col];
> for (i = 0; i < WORDS; i++) {
> h = *p; /* in ram */
> e = raw32(&r); /* expected */
> o = raw32(&one); /* seed 1 */
> if (h == e) {
> total_correct++;
> } else {
> total_errors++;
> errors++;
> if (!first_error) {
> first_error = p;
> have = h;
> expect = e;
> }
> }
> if (h == o)
> total_one++;
> p++;
> }
> /* Show log2(errors) in this column. */
> for (log2 = 0; errors != 0; errors >>= 1)
> log2++;
> if (log2 == 0)
> putchar('.');
> else if (log2 < 10)
> putchar('0' + log2);
> else
> putchar('a' - 10 + log2);
> }
> putchar('\n');
> if (first_error) {
> printf("first error: address %p, "
>    "have %#lx, expect %#lx\n", first_error,
>    (unsigned long)have, (unsigned long)expect);
> }
> printf("correct: %zu, errors: %zu, seed 1: %zu\n",
>    total_correct, total_errors, total_one);
> }
> }


Reply | Threaded
Open this post in threaded view
|

Re: macppc can't modify pages in swap

George Koehler-2
In reply to this post by George Koehler-2
On Sat, 15 Dec 2018 13:36:37 -0500
George Koehler <[hidden email]> wrote:

> My test program can write pages but can't modify them, as if
> OpenBSD is ignoring writes to pages after they got swapped out and in.

By my guess, pmap_is_modified() is broken on powerpc.  It seems to
fail to return true, so uvm wouldn't know that the page is modified,
and then uvm wouldn't write the modified page to swap.

I am able to build kernels.  (My 1G of RAM is enough to build a kernel
without swapping.  512M of RAM might be enough, 256M might not.)  I
modified my kernel to add code like

        static int aaa = 0;
        ...
        if (!aaa) {
                printf("reached aaa: pmap_test_attrs\n");
                aaa = 1;
        }

to detect if code is reached.  pmap_is_modified(pg) is a macro [1]
for pmap_test_attrs(pg, PMAP_MOD), so I added my printf()s to
pmap_test_attrs() [2].

[1] /sys/arch/powerpc/include/pmap.h
[2] /sys/arch/powerpc/powerpc/pmap.c

When the system boots, as soon as the kernel runs init, it reaches
"aaa" (at the beginning of pmap_test_attrs()) and "bbb" (just
before the LIST_FOREACH loop).  I run my swap test, but the kernel
never reaches any printf() inside the loop.  It never reaches "ccc",
which is just after the PMAP_HASH_LOCK.  This suggests that the
kernel never enters the loop.

The hardware uses a hashtable of page table entries (pte).  When a
page is modified, the hardware sets a flag PTE_CHG_32.  The
LIST_FOREACH loop in pmap_test_attrs() seems to iterate each mapping
(struct pte_desc pted) of a physical page (struct vm_page *pg).  For
each such mapping, the kernel would find the pte in the hashtable
and check its PTE_CHG_32 flag.

If the kernel never enters the loop, it would miss the PTE_CHG_32
flag and fail to detect that the page is modified.

--
George Koehler <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: macppc can't modify pages in swap

George Koehler-2
On Wed, 19 Dec 2018 00:13:13 -0500
George Koehler <[hidden email]> wrote:

> By my guess, pmap_is_modified() is broken on powerpc.  It seems to
> fail to return true, so uvm wouldn't know that the page is modified,
> and then uvm wouldn't write the modified page to swap.

Turns out that pmap_page_protect(pg, PROT_NONE) forgot to check if
the page was modified.  The below diff seems to fix it.

pmap_is_modified(pg) calls pmap_test_attrs(pg, PG_PMAP_MOD), which
iterates pg->mdpage.pv_list to check if the hardware had set
PTE_CHG_32 on any mapping of this physical page.  The list is empty
because uvm seems to remove all the mappings before it asks if the
page is modified, then swaps out the page.

A function that does LIST_REMOVE a mapping with PTE_CHG_32 must set
PG_PMAP_MOD in pg->pg_flags, but pmap_page_protect(pg, PROT_NONE)
fails to do so.  This function does
                        pted->pted_va &= ~PTED_VA_MANAGED_M;
                        LIST_REMOVE(pted, pted_pv_list);
before
                        pmap_remove_pted(pm, pted);
Then pmap_remove_pted() calls pte_zap(), which would check PTE_CHG_32
if PTED_MANAGED(pted) is true.  The check is skipped because we had
unset PTED_VA_MANAGED_M.

The following diff fixes my test program on my single G4 processor
(MPC7447A), where ppc_proc_is_64b is false.  I will use this diff
until someone gives me a better diff.

Index: pmap.c
===================================================================
RCS file: /cvs/src/sys/arch/powerpc/powerpc/pmap.c,v
retrieving revision 1.168
diff -u -p -r1.168 pmap.c
--- pmap.c 22 Oct 2018 17:31:25 -0000 1.168
+++ pmap.c 20 Dec 2018 03:16:13 -0000
@@ -540,6 +540,28 @@ pmap_attr_save(paddr_t pa, u_int32_t bit
  atomic_setbits_int(&pg->pg_flags,  pmap_pte2flags(bits));
 }
 
+/* Fixes pg->pg_flags by checking REF and CHG. */
+void
+pmap_fix_page_attrs(struct vm_page *pg, struct pte_desc *pted)
+{
+ void *pte;
+ u_int bits;
+ int s;
+
+ PMAP_HASH_LOCK(s);
+ if ((pte = pmap_ptedinhash(pted)) != NULL) {
+ if (ppc_proc_is_64b) {
+ struct pte_64 *pte64 = pte;
+ bits = pte64->pte_lo & (PTE_REF_64|PTE_CHG_64);
+ } else {
+ struct pte_32 *pte32 = pte;
+ bits = pte32->pte_lo & (PTE_REF_32|PTE_CHG_32);
+ }
+ atomic_setbits_int(&pg->pg_flags, pmap_pte2flags(bits));
+ }
+ PMAP_HASH_UNLOCK(s);
+}
+
 int
 pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
 {
@@ -2101,6 +2123,13 @@ pmap_page_protect(struct vm_page *pg, vm
  pted->pted_va &= ~PTED_VA_MANAGED_M;
  LIST_REMOVE(pted, pted_pv_list);
  mtx_leave(&pg->mdpage.pv_mtx);
+
+ /*
+ * Check REF and CHG now, because
+ * pmap_remove_pted() won't check them when
+ * not PTED_VA_MANAGED_M.
+ */
+ pmap_fix_page_attrs(pg, pted);
 
  pmap_remove_pted(pm, pted);
 

--
George Koehler <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: macppc can't modify pages in swap

Charlene Wendling
On Wed, 19 Dec 2018 22:36:49 -0500
George Koehler wrote:

> On Wed, 19 Dec 2018 00:13:13 -0500
> George Koehler <[hidden email]> wrote:
>
> > By my guess, pmap_is_modified() is broken on powerpc.  It seems to
> > fail to return true, so uvm wouldn't know that the page is modified,
> > and then uvm wouldn't write the modified page to swap.
>
> Turns out that pmap_page_protect(pg, PROT_NONE) forgot to check if
> the page was modified.  The below diff seems to fix it.
>
> pmap_is_modified(pg) calls pmap_test_attrs(pg, PG_PMAP_MOD), which
> iterates pg->mdpage.pv_list to check if the hardware had set
> PTE_CHG_32 on any mapping of this physical page.  The list is empty
> because uvm seems to remove all the mappings before it asks if the
> page is modified, then swaps out the page.
>
> A function that does LIST_REMOVE a mapping with PTE_CHG_32 must set
> PG_PMAP_MOD in pg->pg_flags, but pmap_page_protect(pg, PROT_NONE)
> fails to do so.  This function does
> pted->pted_va &= ~PTED_VA_MANAGED_M;
> LIST_REMOVE(pted, pted_pv_list);
> before
> pmap_remove_pted(pm, pted);
> Then pmap_remove_pted() calls pte_zap(), which would check PTE_CHG_32
> if PTED_MANAGED(pted) is true.  The check is skipped because we had
> unset PTED_VA_MANAGED_M.
>
> The following diff fixes my test program on my single G4 processor
> (MPC7447A), where ppc_proc_is_64b is false.  I will use this diff
> until someone gives me a better diff.
>

Hi,

On my Powerbook5,8 [1] with 2 gigabytes of RAM, your (adjusted) check64
code shows the same memory corruption issues, and the diff you're
providing fixes it.

Thanks a lot!

Charlène.


[1] https://dmesgd.nycbug.org/index.cgi?do=view&id=4574

> --
> George Koehler <[hidden email]>
>

Reply | Threaded
Open this post in threaded view
|

Re: macppc can't modify pages in swap

Mark Kettenis
In reply to this post by George Koehler-2
> Date: Wed, 19 Dec 2018 22:36:49 -0500
> From: George Koehler <[hidden email]>
>
> On Wed, 19 Dec 2018 00:13:13 -0500
> George Koehler <[hidden email]> wrote:
>
> > By my guess, pmap_is_modified() is broken on powerpc.  It seems to
> > fail to return true, so uvm wouldn't know that the page is modified,
> > and then uvm wouldn't write the modified page to swap.
>
> Turns out that pmap_page_protect(pg, PROT_NONE) forgot to check if
> the page was modified.  The below diff seems to fix it.
>
> pmap_is_modified(pg) calls pmap_test_attrs(pg, PG_PMAP_MOD), which
> iterates pg->mdpage.pv_list to check if the hardware had set
> PTE_CHG_32 on any mapping of this physical page.  The list is empty
> because uvm seems to remove all the mappings before it asks if the
> page is modified, then swaps out the page.
>
> A function that does LIST_REMOVE a mapping with PTE_CHG_32 must set
> PG_PMAP_MOD in pg->pg_flags, but pmap_page_protect(pg, PROT_NONE)
> fails to do so.  This function does
> pted->pted_va &= ~PTED_VA_MANAGED_M;
> LIST_REMOVE(pted, pted_pv_list);
> before
> pmap_remove_pted(pm, pted);
> Then pmap_remove_pted() calls pte_zap(), which would check PTE_CHG_32
> if PTED_MANAGED(pted) is true.  The check is skipped because we had
> unset PTED_VA_MANAGED_M.
>
> The following diff fixes my test program on my single G4 processor
> (MPC7447A), where ppc_proc_is_64b is false.  I will use this diff
> until someone gives me a better diff.

That's a very good find.  I think there still is a potential race in
your diff on MP systems since you save the bits before removing the
PTE from the has tables.  I'll see if I can come up with a better diff.

> Index: pmap.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/powerpc/powerpc/pmap.c,v
> retrieving revision 1.168
> diff -u -p -r1.168 pmap.c
> --- pmap.c 22 Oct 2018 17:31:25 -0000 1.168
> +++ pmap.c 20 Dec 2018 03:16:13 -0000
> @@ -540,6 +540,28 @@ pmap_attr_save(paddr_t pa, u_int32_t bit
>   atomic_setbits_int(&pg->pg_flags,  pmap_pte2flags(bits));
>  }
>  
> +/* Fixes pg->pg_flags by checking REF and CHG. */
> +void
> +pmap_fix_page_attrs(struct vm_page *pg, struct pte_desc *pted)
> +{
> + void *pte;
> + u_int bits;
> + int s;
> +
> + PMAP_HASH_LOCK(s);
> + if ((pte = pmap_ptedinhash(pted)) != NULL) {
> + if (ppc_proc_is_64b) {
> + struct pte_64 *pte64 = pte;
> + bits = pte64->pte_lo & (PTE_REF_64|PTE_CHG_64);
> + } else {
> + struct pte_32 *pte32 = pte;
> + bits = pte32->pte_lo & (PTE_REF_32|PTE_CHG_32);
> + }
> + atomic_setbits_int(&pg->pg_flags, pmap_pte2flags(bits));
> + }
> + PMAP_HASH_UNLOCK(s);
> +}
> +
>  int
>  pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
>  {
> @@ -2101,6 +2123,13 @@ pmap_page_protect(struct vm_page *pg, vm
>   pted->pted_va &= ~PTED_VA_MANAGED_M;
>   LIST_REMOVE(pted, pted_pv_list);
>   mtx_leave(&pg->mdpage.pv_mtx);
> +
> + /*
> + * Check REF and CHG now, because
> + * pmap_remove_pted() won't check them when
> + * not PTED_VA_MANAGED_M.
> + */
> + pmap_fix_page_attrs(pg, pted);
>  
>   pmap_remove_pted(pm, pted);
>  
>
> --
> George Koehler <[hidden email]>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: macppc can't modify pages in swap

Mark Kettenis
> Date: Sun, 23 Dec 2018 12:26:17 +0100 (CET)
> From: Mark Kettenis <[hidden email]>
>
> That's a very good find.  I think there still is a potential race in
> your diff on MP systems since you save the bits before removing the
> PTE from the has tables.  I'll see if I can come up with a better diff.

So here is the diff I propose instead.  This zaps the PTE before
unlinking.  At that point the PTED_VA_MANAGED_M flag is still set so
the MOD/REF accounting will happen.  A process running on the other
CPU can't put the PTE back into the hash as we still hold the lock on
the pmap.

Bootstrapping clang with this diff, and things are still running even
though I've hit swap.  I'll give this a spin on an MP machine as well.


Index: arch/powerpc/powerpc/pmap.c
===================================================================
RCS file: /cvs/src/sys/arch/powerpc/powerpc/pmap.c,v
retrieving revision 1.168
diff -u -p -r1.168 pmap.c
--- arch/powerpc/powerpc/pmap.c 22 Oct 2018 17:31:25 -0000 1.168
+++ arch/powerpc/powerpc/pmap.c 23 Dec 2018 18:25:32 -0000
@@ -2067,7 +2067,9 @@ void
 pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
 {
  struct pte_desc *pted;
+ void *pte;
  pmap_t pm;
+ int s;
 
  if (prot == PROT_NONE) {
  mtx_enter(&pg->mdpage.pv_mtx);
@@ -2097,6 +2099,11 @@ pmap_page_protect(struct vm_page *pg, vm
  mtx_enter(&pg->mdpage.pv_mtx);
  continue;
  }
+
+ PMAP_HASH_LOCK(s);
+ if ((pte = pmap_ptedinhash(pted)) != NULL)
+ pte_zap(pte, pted);
+ PMAP_HASH_UNLOCK(s);
 
  pted->pted_va &= ~PTED_VA_MANAGED_M;
  LIST_REMOVE(pted, pted_pv_list);

Reply | Threaded
Open this post in threaded view
|

Re: macppc can't modify pages in swap

Charlene Wendling
On Sun, 23 Dec 2018 21:24:55 +0100 (CET)
Mark Kettenis wrote:

> > Date: Sun, 23 Dec 2018 21:20:11 +0100 (CET)
> > From: Mark Kettenis <[hidden email]>
> >
> > > Date: Sun, 23 Dec 2018 19:35:02 +0100 (CET)
> > > From: Mark Kettenis <[hidden email]>
> > >
> > > > Date: Sun, 23 Dec 2018 12:26:17 +0100 (CET)
> > > > From: Mark Kettenis <[hidden email]>
> > > >
> > > > That's a very good find.  I think there still is a potential
> > > > race in your diff on MP systems since you save the bits before
> > > > removing the PTE from the has tables.  I'll see if I can come
> > > > up with a better diff.
> > >
> > > So here is the diff I propose instead.  This zaps the PTE before
> > > unlinking.  At that point the PTED_VA_MANAGED_M flag is still set
> > > so the MOD/REF accounting will happen.  A process running on the
> > > other CPU can't put the PTE back into the hash as we still hold
> > > the lock on the pmap.
> > >
> > > Bootstrapping clang with this diff, and things are still running
> > > even though I've hit swap.  I'll give this a spin on an MP
> > > machine as well.
> >
> > I fear sombody else needs to test on an MP machine as my dual G4
> > doesn't boot anymore :(.
>
> And for those only on ppc@, here is the diff again.
>
> Please test.

Hi,

It works properly on my single G4 machine, for what's it worth.

Charlène.


>
> Index: arch/powerpc/powerpc/pmap.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/powerpc/powerpc/pmap.c,v
> retrieving revision 1.168
> diff -u -p -r1.168 pmap.c
> --- arch/powerpc/powerpc/pmap.c 22 Oct 2018 17:31:25
> -0000 1.168 +++ arch/powerpc/powerpc/pmap.c 23 Dec 2018
> 18:25:32 -0000 @@ -2067,7 +2067,9 @@ void
>  pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
>  {
>   struct pte_desc *pted;
> + void *pte;
>   pmap_t pm;
> + int s;
>  
>   if (prot == PROT_NONE) {
>   mtx_enter(&pg->mdpage.pv_mtx);
> @@ -2097,6 +2099,11 @@ pmap_page_protect(struct vm_page *pg, vm
>   mtx_enter(&pg->mdpage.pv_mtx);
>   continue;
>   }
> +
> + PMAP_HASH_LOCK(s);
> + if ((pte = pmap_ptedinhash(pted)) != NULL)
> + pte_zap(pte, pted);
> + PMAP_HASH_UNLOCK(s);
>  
>   pted->pted_va &= ~PTED_VA_MANAGED_M;
>   LIST_REMOVE(pted, pted_pv_list);
>

Reply | Threaded
Open this post in threaded view
|

Re: macppc can't modify pages in swap

Landry Breuil-5
In reply to this post by Mark Kettenis
On Sun, Dec 23, 2018 at 09:20:11PM +0100, Mark Kettenis wrote:

> > Date: Sun, 23 Dec 2018 19:35:02 +0100 (CET)
> > From: Mark Kettenis <[hidden email]>
> >
> > > Date: Sun, 23 Dec 2018 12:26:17 +0100 (CET)
> > > From: Mark Kettenis <[hidden email]>
> > >
> > > That's a very good find.  I think there still is a potential race in
> > > your diff on MP systems since you save the bits before removing the
> > > PTE from the has tables.  I'll see if I can come up with a better diff.
> >
> > So here is the diff I propose instead.  This zaps the PTE before
> > unlinking.  At that point the PTED_VA_MANAGED_M flag is still set so
> > the MOD/REF accounting will happen.  A process running on the other
> > CPU can't put the PTE back into the hash as we still hold the lock on
> > the pmap.
> >
> > Bootstrapping clang with this diff, and things are still running even
> > though I've hit swap.  I'll give this a spin on an MP machine as well.
>
> I fear sombody else needs to test on an MP machine as my dual G4
> doesn't boot anymore :(.

I'll put this diff on macppc-*.p in the next bulk (in some days), both
are MP. Maybe it'll fix the random ICEs when building c++ monsters,
which probably hit swap as there's only 2Gb physmem...

Landry