Hi,

I found 2 possible null pointers by clang static analyzer and I have
attached it to email later. I was also reading the code in this file
and I found out that

1) most of the time in uvm_pmr_getpages(), a newly inserted printf at
line 792 is never reached. I put that printf just to check and verify
a clang warning that search[] is uninitialized. Almost all page
allocations during boot and seen in dmesg are happening in either on
line 786 or line 789 in

if (maxseg == 1 || count == 1)
and
else if (maxseg >= count && (flags & UVM_PLA_TRYCONTIG) == 0) {

So is that else {} block not being reached and is redundant? It looks
like it from the code, as it is only called from uvm_page.c and
uvm_pglist.c and the if () condition. Is the allocator then spending a
lot of time in the search[2] case? Or am I crazy to think that
something's off in that area?



2) another question. Most allocations are either 1 or a power of two.
But there are a few allocations of 3 pages, specifically most
allocations are either 1 page, 2 page, some 16's, some 32's, one
single 128. I printed this info by checking for value of search[try]
at label rescan: on line 901 in uvm_pmemrange.c

Would this cause fragmentation or misalignment and ultimately a
problem? There were exactly eight 3 page allocations after bios got
handed control to /bsd immediately after the lines

real mem = 8587771904 (8189MB)
avail mem = 8345174016 (7958MB)

and a single 3 page allocation after mtrr:Pentium Pro MTRR support. I
get a usb_allocmem() issue right after this line on a NVIDIA USB EHCI
controller on this Sun Ultra 40 with NVIDIA everything. I am attaching
a dmesg also. I have to keep the ehci commented in GENERIC to get it
to boot or disable ehci in UKC everytime.

Would this single odd 3 page alloc cause a problem? Or am I crazy to
think it should?

Thanks for your time,
amit

clang reports for the null pointers

https://filestogeaux.lsu.edu/public/download.php?FILE=akulka1/20861LJ6oU4
https://filestogeaux.lsu.edu/public/download.php?FILE=akulka1/32877HWMeIq
https://filestogeaux.lsu.edu/public/download.php?FILE=akulka1/12907BUBXhj


Index: uvm_pmemrange.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_pmemrange.c,v
retrieving revision 1.18
diff -u -i uvm_pmemrange.c
--- uvm_pmemrange.c     28 Aug 2010 22:27:47 -0000      1.18
+++ uvm_pmemrange.c     1 Mar 2011 22:28:46 -0000
@@ -634,7 +634,7 @@
         * uvm_page_init() may not have initialized its array sorted by
         * page number.
         */
-       for (iter = start; iter != end; iter = iter_end) {
+       for (iter = start; iter != NULL && iter != end; iter = iter_end) {
                iter_end = TAILQ_NEXT(iter, pageq);
                TAILQ_REMOVE(pgl, iter, pageq);
        }
@@ -1628,7 +1628,7 @@
         * Ack, no hits. Walk the address tree until to find something usable.
         */
        for (low = RB_NEXT(uvm_pmr_addr, &pmr->addr, low);
-           low != high;
+           low != high && high_next != NULL;
            low = RB_NEXT(uvm_pmr_addr, &pmr->addr, low)) {
                KASSERT(PMR_IS_SUBRANGE_OF(atop(VM_PAGE_TO_PHYS(high_next)),
                    atop(VM_PAGE_TO_PHYS(high_next)) + high_next->fpgsz,







OpenBSD 4.9 (GENERIC.MP) #4: Tue Mar  1 16:14:15 CST 2011
    r...@rsgis02.lsu.edu:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 8587771904 (8189MB)
avail mem = 8345174016 (7958MB)
XXX: search [2] = 2
XXX: search [2] = 2
XXX: search [2] = 2
XXX: search [2] = 2
XXX: search [2] = 2
XXX: search [2] = 2
XXX: search [2] = 2
XXX: search [2] = 2
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 3
XXX: search [2] = 3
XXX: search [2] = 3
XXX: search [2] = 3
XXX: search [2] = 3
XXX: search [2] = 3
XXX: search [2] = 3
XXX: search [2] = 3
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 4
XXX: search [2] = 16
XXX: search [2] = 16
XXX: search [2] = 16
XXX: search [2] = 16
XXX: search [2] = 16
XXX: search [2] = 16
XXX: search [2] = 16
XXX: search [2] = 16
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xaff64000 (40 entries)
bios0: vendor Phoenix Technologies Ltd. version "1.30" date 05/18/2006
bios0: Sun Microsystems Sun Ultra 40 Workstation
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP TCPA SSDT SRAT SPCR MCFG APIC BOOT
acpi0: wakeup devices PCI0(S5) USB0(S3) USB2(S3) MAC0(S5) P2P0(S5)
XVR0(S5) XVR1(S5) MAC0(S5) XVR0(S5) XVR1(S5)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimcfg0 at acpi0 addr 0xe0000000, bus 0-129
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Dual Core AMD Opteron(tm) Processor 280, 2411.44 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,NXE,MMXX,FFXSR,LONG,3DNOW2,3DNOW
cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 1MB
64b/line 16-way L2 cache
cpu0: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu0: DTLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu0: AMD erratum 89 present, BIOS upgrade may be required
cpu0: apic clock running at 200MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Dual Core AMD Opteron(tm) Processor 280, 2411.11 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,NXE,MMXX,FFXSR,LONG,3DNOW2,3DNOW
cpu1: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 1MB
64b/line 16-way L2 cache
cpu1: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu1: DTLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu1: AMD erratum 89 present, BIOS upgrade may be required
cpu2 at mainbus0: apid 2 (application processor)
cpu2: Dual Core AMD Opteron(tm) Processor 280, 2411.11 MHz
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,NXE,MMXX,FFXSR,LONG,3DNOW2,3DNOW
cpu2: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 1MB
64b/line 16-way L2 cache
cpu2: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu2: DTLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu2: AMD erratum 89 present, BIOS upgrade may be required
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Dual Core AMD Opteron(tm) Processor 280, 2411.11 MHz
cpu3: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,NXE,MMXX,FFXSR,LONG,3DNOW2,3DNOW
cpu3: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 1MB
64b/line 16-way L2 cache
cpu3: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu3: DTLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu3: AMD erratum 89 present, BIOS upgrade may be required
ioapic0 at mainbus0: apid 4 pa 0xfec00000, version 11, 24 pins
ioapic1 at mainbus0: apid 5 pa 0xd0000000, version 11, 24 pins
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (P2P0)
acpiprt2 at acpi0: bus 3 (XVR0)
acpiprt3 at acpi0: bus 2 (XVR1)
acpiprt4 at acpi0: bus 128 (PCI1)
acpiprt5 at acpi0: bus 130 (XVR0)
acpiprt6 at acpi0: bus 129 (XVR1)
acpicpu0 at acpi0: PSS
acpicpu1 at acpi0: PSS
acpicpu2 at acpi0: PSS
acpicpu3 at acpi0: PSS
acpibtn0 at acpi0: PWRB
cpu0: Cool'n'Quiet K8 2411 MHz: speeds: 2400 2200 2000 1800 1000 MHz
pci0 at mainbus0 bus 0uvm_pglistalloc: Upper boundary 0x4000000000 not
on pagemask.
XXX: search [2] = 128

iommu0 at cpu0: base 0x80000000 length 512MB pte 0x10da00000
iommu1 at cpu1: base 0x80000000 length 512MB pte 0x10da00000
"NVIDIA nForce4 DDR" rev 0xa3 at pci0 dev 0 function 0 not configured
pcib0 at pci0 dev 1 function 0 "NVIDIA nForce4 ISA" rev 0xa3
nviic0 at pci0 dev 1 function 1 "NVIDIA nForce4 SMBus" rev 0xa2
iic0 at nviic0
spdmem0 at iic0 addr 0x50: 2GB DDR SDRAM registered ECC PC3200CL3.0
spdmem1 at iic0 addr 0x51: 2GB DDR SDRAM registered ECC PC3200CL3.0
spdmem2 at iic0 addr 0x54: 2GB DDR SDRAM registered ECC PC3200CL3.0
spdmem3 at iic0 addr 0x55: 2GB DDR SDRAM registered ECC PC3200CL3.0
iic1 at nviic0
iic1: addr 0x18 00=0f 02=f0 03=ff 04=0f 06=f0 07=ff 08=0f 0a=f0 0b=ff
0c=0f 0e=f0 0f=ff 10=0f 12=f0 13=ff 14=0f 16=f0 17=ff 18=0f 1a=f0
1b=ff 1c=0f 1e=f0 1f=ff 20=0f 22=f0 23=ff 24=0f 26=f0 27=ff 28=0f
2a=f0 2b=ff 2c=0f 2e=f0 2f=ff 30=0f 32=f0 33=ff 34=0f 36=f0 37=ff
38=0f 3a=f0 3b=ff 3c=0f 3e=f0 3f=ff 40=0f 42=f0 43=ff 44=0f 46=f0
47=ff 48=0f 4a=f0 4b=ff 4c=0f 4e=f0 4f=ff 50=0f 52=f0 53=ff 54=0f
56=f0 57=ff 58=0f 5a=f0 5b=ff 5c=0f 5e=f0 5f=ff 60=0f 62=f0 63=ff
64=0f 66=f0 67=ff 68=0f 6a=f0 6b=ff 6c=0f 6e=f0 6f=ff 70=0f 72=f0
73=ff 74=0f 76=f0 77=ff 78=0f 7a=f0 7b=ff 7c=0f 7e=f0 7f=ff 80=0f
82=f0 83=ff 84=0f 86=f0 87=ff 88=0f 8a=f0 8b=ff 8c=0f 8e=f0 8f=ff
90=0f 92=f0 93=ff 94=0f 96=f0 97=ff 98=0f 9a=f0 9b=ff 9c=0f 9e=f0
9f=ff a0=0f a2=f0 a3=ff a4=0f a6=f0 a7=ff a8=0f aa=f0 ab=ff ac=0f
ae=f0 af=ff b0=0f b2=f0 b3=ff b4=0f b6=f0 b7=ff b8=0f ba=f0 bb=ff
bc=0f be=f0 bf=ff c0=0f c2=f0 c3=ff c4=0f c6=f0 c7=ff c8=0f ca=f0
cb=ff cc=0f ce=f0 cf=ff d0=0f d2=f0 d3=ff d4=0f d6=f0 d7=ff d8=0f
da=f0 db=ff dc=0f de=f0 df=ff e0=0f e2=f0 e3=ff e4=0f e6=f0 e7=ff
e8=0f ea=f0 eb=ff ec=0f ee=f0 ef=ff f0=0f f2=f0 f3=ff f4=0f f6=f0
f7=ff f8=0f fa=f0 fb=ff fc=0f fe=f0 ff=ff words 00=0f0f 01=0000
02=f0f0 03=ffff 04=0f0f 05=0000 06=f0f0 07=ffff
adt0 at iic1 addr 0x2d: emc6d100 rev 0x68
adt1 at iic1 addr 0x2e: sch5017 rev 0x89
iic1: addr 0x48 22=4b 40=4b 41=50 42=4b 43=4b 44=4b 45=4b 46=4b 47=4b
48=0c 49=10 4a=c4 4b=01 4c=0e 4d=00 4e=00 4f=00 51=50 a1=50 a2=4b
a8=0c a9=10 aa=c4 ac=8e ee=08 words 00=ffff 01=ffff 02=ffff 03=ffff
04=ffff 05=ffff 06=ffff 07=ffff
ohci0 at pci0 dev 2 function 0 "NVIDIA nForce4 USB" rev 0xa2: apic 4
int 20 (irq 10), version 1.0, legacy support
"NVIDIA nForce4 USB" rev 0xa3 at pci0 dev 2 function 1 not configured
auich0 at pci0 dev 4 function 0 "NVIDIA nForce4 AC97" rev 0xa2: apic 4
int 20 (irq 11), nForce4 AC97
ac97: codec id 0x414c4790 (Avance Logic ALC850 rev 0)
audio0 at auich0
XXX: search [2] = 16
XXX: search [2] = 16
pciide0 at pci0 dev 6 function 0 "NVIDIA nForce4 IDE" rev 0xf2: DMA,
channel 0 configured to compatibility, channel 1 configured to
compatibility
atapiscsi0 at pciide0 channel 0 drive 0
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: <MATSHITA, DVD-RAM UJ-845S, D102> ATAPI
5/cdrom removable
cd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
pciide0: channel 1 disabled (no drives)
pciide1 at pci0 dev 7 function 0 "NVIDIA nForce4 SATA" rev 0xf3: DMA
pciide1: using apic 4 int 20 (irq 10) for native-PCI interrupt
wd0 at pciide1 channel 0 drive 0: <HITACHI HDS7225SBSUN250G 0615NE18BJ>
wd0: 16-sector PIO, LBA48, 238471MB, 488390625 sectors
wd0(pciide1:0:0): using PIO mode 4, Ultra-DMA mode 6
wd1 at pciide1 channel 1 drive 0: <HITACHI HDS7225SCSUN250G 0719BN9GWK>
wd1: 16-sector PIO, LBA48, 238471MB, 488390625 sectors
wd1(pciide1:1:0): using PIO mode 4, Ultra-DMA mode 6
pciide2 at pci0 dev 8 function 0 "NVIDIA nForce4 SATA" rev 0xf3: DMA
pciide2: using apic 4 int 20 (irq 11) for native-PCI interrupt
wd2 at pciide2 channel 0 drive 0: <HITACHI HDS7225SBSUN250G 0615NDXA1J>
wd2: 16-sector PIO, LBA48, 238471MB, 488390625 sectors
wd2(pciide2:0:0): using PIO mode 4, Ultra-DMA mode 6
ppb0 at pci0 dev 9 function 0 "NVIDIA nForce4 PCI-PCI" rev 0xa2
pci1 at ppb0 bus 1
"TI TSB43AB22 FireWire" rev 0x00 at pci1 dev 7 function 0 not configured
nfe0 at pci0 dev 10 function 0 "NVIDIA CK804 LAN" rev 0xa3: apic 4 int
20 (irq 10), address 00:14:4f:3b:7d:68
eephy0 at nfe0 phy 1: 88E1111 Gigabit PHY, rev. 2
ppb1 at pci0 dev 13 function 0 "NVIDIA nForce4 PCIE" rev 0xa3
pci2 at ppb1 bus 2
ppb2 at pci0 dev 14 function 0 "NVIDIA nForce4 PCIE" rev 0xa3
pci3 at ppb2 bus 3
vga1 at pci3 dev 0 function 0 vendor "NVIDIA", unknown product 0x0658 rev 0xa1
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
pchb0 at pci0 dev 24 function 0 "AMD AMD64 0Fh HyperTransport" rev 0x00
pchb1 at pci0 dev 24 function 1 "AMD AMD64 0Fh Address Map" rev 0x00
pchb2 at pci0 dev 24 function 2 "AMD AMD64 0Fh DRAM Cfg" rev 0x00
kate0 at pci0 dev 24 function 3 "AMD AMD64 0Fh Misc Cfg" rev 0x00
pchb3 at pci0 dev 25 function 0 "AMD AMD64 0Fh HyperTransport" rev 0x00
pci4 at pchb3 bus 128
"NVIDIA nForce4 DDR" rev 0xa3 at pci4 dev 0 function 0 not configured
"NVIDIA CK804" rev 0xa3 at pci4 dev 1 function 0 not configured
pciide3 at pci4 dev 7 function 0 "NVIDIA nForce4 SATA" rev 0xf3: DMA
pciide3: using apic 5 int 20 (irq 11) for native-PCI interrupt
pciide4 at pci4 dev 8 function 0 "NVIDIA nForce4 SATA" rev 0xf3: DMA
pciide4: using apic 5 int 20 (irq 10) for native-PCI interrupt
nfe1 at pci4 dev 10 function 0 "NVIDIA CK804 LAN" rev 0xa3: apic 5 int
20 (irq 10), address 00:14:4f:3b:7d:69
eephy1 at nfe1 phy 1: 88E1111 Gigabit PHY, rev. 2
ppb3 at pci4 dev 13 function 0 "NVIDIA nForce4 PCIE" rev 0xa3
pci5 at ppb3 bus 129
ppb4 at pci4 dev 14 function 0 "NVIDIA nForce4 PCIE" rev 0xa3
pci6 at ppb4 bus 130
pchb4 at pci0 dev 25 function 1 "AMD AMD64 0Fh Address Map" rev 0x00
pchb5 at pci0 dev 25 function 2 "AMD AMD64 0Fh DRAM Cfg" rev 0x00
kate1 at pci0 dev 25 function 3 "AMD AMD64 0Fh Misc Cfg" rev 0x00
isa0 at pcib0
isadma0 at isa0XXX: search [2] = 16
XXX: search [2] = 16
XXX: search [2] = 16
XXX: search [2] = 16
XXX: search [2] = 32
XXX: search [2] = 32
XXX: search [2] = 32
XXX: search [2] = 32

pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
usb0 at ohci0: USB revision 1.0
uhub0 at usb0 "NVIDIA OHCI root hub" rev 1.00/1.00 addr 1
mtrr: Pentium Pro MTRR support
XXX: search [2] = 3
uhub1 at uhub0 port 4 "Sun Microsystems product 0x100e" rev 2.00/1.03 addr 2
uhidev0 at uhub1 port 4 configuration 1 interface 0 "Sun Microsystems
Type 7 Keyboard" rev 2.00/1.03 addr 3
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 modifier keys, 6 key codes, country code 33
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
uhub2 at uhub0 port 7 "Standard Microsystems product 0x2502" rev
2.00/0.01 addr 4
uhidev1 at uhub2 port 1 configuration 1 interface 0 "Raptor Gaming
PS/2+USB Mouse" rev 1.10/51.15 addr 5
uhidev1: iclass 3/1
ums0 at uhidev1: 3 buttons, Z dir
wsmouse0 at ums0 mux 0
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 1 targets
sd0 at scsibus2 targ 0 lun 0: <OPENBSD, SR RAID 1, 004> SCSI2 0/direct fixed
sd0: 238464MB, 512 bytes/sec, 488375408 sec total
root on wd0a swap on wd0b dump on wd0b

[demime 1.01d removed an attachment of type application/octet-stream which had 
a name of uvm_pmemrange_1.diff]

[demime 1.01d removed an attachment of type application/octet-stream which had 
a name of dmesg_uvm_pmemchange]

Reply via email to