[1.] ioremap returning NULL and non-NULL for the same high memory adresses [2.] some drivers uses high memory limiting the kernel usage with mem=800M and using the above memory. With a kernel compiled with CONFIG_HIGHMEM4G=y, ioremap returns NULL for some high memory adress where it returned a non-NULL value for the same high memory adress. To test the available memory, the driver starts at high-memory and probes each page (ioremap it, write into it, read the written value, iounmap it). When the read value != from the written value it assumes that it is the end of the physical memory. After the driver try to ioremap buffers in this high memory, for the first buffers ioremap returns right values but after some calls it returns 0x00000. In the case of mem=800M, it stops around 180M (430 buffers of 442368 bytes) instead of the 224M free reported by the available memory test. [3.] keywords: kernel, memory, ioremap [4.] Kernel version : Linux version 2.4.17 (dgeld@orcus) (gcc version 2.95.3 20010315 (release)) #1 Mon Jan 27 14:02:56 MET 2003 [5.] no Oops on a 1GB machine, with mem=950M, and a debug kernel, I got a "kernel BUG at page_alloc:84!". With mem=800M, I did not get this message [6.] attached a small module that reproduce the problem. To use it make make install insmod mem1 dmask=2 on a 1GB machine with kernel option mem=800M, all the tests in himem_search works OK, this returns 224MB free. When mem1_module_init try to use this high memory, ioremap returns NULL after the 980MB barrier. [7.] [7.1] Software Linux forceps 2.4.17 #1 Mon Jan 27 14:02:56 MET 2003 i686 unknown Gnu C 2.95.3 Gnu make 3.80 binutils 2.11.90.0.8 util-linux 2.11n mount 2.11n modutils 2.4.12 e2fsprogs 1.25 pcmcia-cs 3.1.33 PPP 2.3.11 Linux C Library 2.1.3 Dynamic linker (ldd) 2.1.3 Procps 2.0.6 Net-tools 1.54 Console-tools 1999.03.02 Sh-utils 2.0 Modules Loaded mousedev keybdev hid input usb-storage usb-uhci usbcore [7.2.] biXeon 2GHz computer, configured in non-SMP (due to meteor2 driver SMP bug) root@forceps# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) XEON(TM) CPU 2.00GHz stepping : 4 cpu MHz : 1995.162 cache size : 512 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm bogomips : 3984.58 [7.3.] root@forceps# cat /proc/modules mousedev 3872 0 (unused) keybdev 1664 0 (unused) hid 12736 0 (unused) input 3072 0 [mousedev keybdev hid] usb-storage 22748 0 (unused) usb-uhci 21316 0 (unused) usbcore 49216 1 [hid usb-storage usb-uhci] [7.4.] root@forceps# cat /proc/ioports 0000-001f : dma1 0020-003f : pic1 0040-005f : timer 0060-006f : keyboard 0070-007f : rtc 0080-008f : dma page reg 00a0-00bf : pic2 00c0-00df : dma2 00f0-00ff : fpu 0170-0177 : ide1 01f0-01f7 : ide0 0376-0376 : ide1 03c0-03df : vga+ 03f6-03f6 : ide0 03f8-03ff : serial(auto) 0cf8-0cff : PCI conf1 1080-10bf : Intel Corp. 82820 820 (Camino 2) Chipset AC'97 Audio Controller 10c0-10df : Intel Corp. 82820 820 (Camino 2) Chipset USB (Hub A) 10c0-10df : usb-uhci 10e0-10ef : Intel Corp. 82820 820 (Camino 2) Chipset IDE U100 10e0-10e7 : ide0 10e8-10ef : ide1 10f0-10ff : Intel Corp. 82820 820 (Camino 2) Chipset SMBus 1400-14ff : Intel Corp. 82820 820 (Camino 2) Chipset AC'97 Audio Controller 2000-2fff : PCI Bus #02 2000-2fff : PCI Bus #03 2000-201f : Advanced Micro Devices [AMD] 79c970 [PCnet LANCE] 2000-201f : PCnet/FAST III 79C973 3000-3fff : PCI Bus #04 3000-307f : PLX Technology, Inc. PCI <-> IOBus Bridge 3080-30bf : Intel Corp. 82557 [Ethernet Pro 100] 3080-30bf : eepro100 root@forceps# cat /proc/iomem 00000000-0009efff : System RAM 000a0000-000bffff : Video RAM area 000c0000-000c7fff : Video ROM 000f0000-000fffff : System ROM 00100000-31ffffff : System RAM 00100000-002450d1 : Kernel code 002450d2-002ccc77 : Kernel data c0000000-c0ffffff : PCI Bus #01 c0000000-c0ffffff : PCI device 10de:0250 (nVidia Corporation) c1000000-c10fffff : PCI Bus #02 c1000000-c10fffff : PCI Bus #03 c1000000-c100ffff : Intel Corp. 82543GC Gigabit Ethernet Controller c1010000-c1010fff : Intel Corp. 82806AA PCI64 Hub Advanced Programmable Interrupt Controller c1011000-c101101f : Advanced Micro Devices [AMD] 79c970 [PCnet LANCE] c1020000-c103ffff : Intel Corp. 82543GC Gigabit Ethernet Controller c1100000-c11fffff : PCI Bus #04 c1100000-c1100fff : Matrox Graphics, Inc. VIA Framegrabber c1101000-c11010ff : PLX Technology, Inc. PCI <-> IOBus Bridge c1101400-c11014ff : PLX Technology, Inc. PCI <-> IOBus Bridge c1101800-c11018ff : PLX Technology, Inc. PCI <-> IOBus Bridge c1101c00-c1101cff : PLX Technology, Inc. PCI <-> IOBus Bridge c1102000-c110207f : PLX Technology, Inc. PCI <-> IOBus Bridge c1103000-c1103fff : Intel Corp. 82557 [Ethernet Pro 100] c1103000-c1103fff : eepro100 c1120000-c113ffff : Intel Corp. 82557 [Ethernet Pro 100] d0000000-dfffffff : Intel Corp. 82850 860 (Wombat) Chipset Host Bridge (MCH) e0000000-e80fffff : PCI Bus #01 e0000000-e7ffffff : PCI device 10de:0250 (nVidia Corporation) e8000000-e807ffff : PCI device 10de:0250 (nVidia Corporation) f0000000-f7ffffff : PCI Bus #04 f0000000-f7ffffff : Matrox Graphics, Inc. VIA Framegrabber [7.5.] 00:00.0 Host bridge: Intel Corp. 82850 860 (Wombat) Chipset Host Bridge (MCH) (rev 04) Subsystem: Hewlett-Packard Company: Unknown device 1274 Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- Status: Cap+ 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- SERR- 00:01.0 PCI bridge: Intel Corp. 82850 850 (Tehama) Chipset AGP Bridge (rev 04) (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- Status: Cap- 66Mhz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- SERR- Reset- FastB2B- 00:02.0 PCI bridge: Intel Corp. 82860 860 (Wombat) Chipset AGP Bridge (rev 04) (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- Status: Cap- 66Mhz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- SERR- Reset- FastB2B- 00:1e.0 PCI bridge: Intel Corp. 82801BA/CA PCI Bridge (rev 04) (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- SERR- Reset- FastB2B- 00:1f.0 ISA bridge: Intel Corp. 82801BA ISA Bridge (LPC) (rev 04) Control: I/O+ Mem+ BusMaster+ SpecCycle+ MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- [disabled] [size=128K] Capabilities: [60] Power Management version 2 Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-) Status: D0 PME-Enable- DSel=0 DScale=0 PME- Capabilities: [44] AGP version 2.0 Status: RQ=31 SBA+ 64bit- FW+ Rate=x1,x2 Command: RQ=0 SBA- AGP- 64bit- FW- Rate= 02:1f.0 PCI bridge: Intel Corp. 82806AA PCI64 Hub PCI Bridge (rev 03) (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- Status: Cap- 66Mhz+ UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- Reset- FastB2B- 03:00.0 PIC: Intel Corp. 82806AA PCI64 Hub Advanced Programmable Interrupt Controller (rev 01) (prog-if 20 [IO(X)-APIC]) Subsystem: Intel Corp. 82806AA PCI64 Hub APIC Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- Status: Cap- 66Mhz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- TAbort- SERR- [disabled] [size=1M] Capabilities: [40] Power Management version 2 Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold-) Status: D0 PME-Enable- DSel=0 DScale=1 PME- 03:05.0 Ethernet controller: Intel Corp. 82543GC Gigabit Ethernet Controller (rev 02) Subsystem: Intel Corp. PRO/1000 F Server Adapter Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR+ FastB2B- Status: Cap+ 66Mhz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- SERR- [disabled] [size=64K] Capabilities: [dc] Power Management version 2 Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-) Status: D0 PME-Enable- DSel=0 DScale=0 PME- 04:06.0 Bridge: PLX Technology, Inc. PCI <-> IOBus Bridge (rev 01) Subsystem: PLX Technology, Inc. PCI <-> IOBus Bridge Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- SERR- TAbort- SERR- TAbort- SERR-