[openib-general] mmap(/dev/mem) causing sigbus

Tom Duffy tomduffy at dslextreme.com
Thu Jan 13 15:12:14 PST 2005


It seems that there is an issue with either mmap or mmap'ing /dev/mem on
sparc64.  A tool (mstflint) for flashing firmware for Mellanox
Infiniband HCA's is crashing on sparc64.  It mmap's /dev/mem and when it
accesses it, a bus error is generated.

Should this work?

Attached is a small test program to demonstrate.  Change BAR0 to
something in your PCI address space (grab an address from /proc/iomem).

# cat /proc/iomem
<snip>
  1ff00100000-1ff001fffff : 0000:81:00.0
    1ff00180680-1ff0018070f : ib_mthca
    1ff001f00d8-1ff001f00df : ib_mthca
  1ff00800000-1ff00ffffff : 0000:81:00.0
    1ff00800000-1ff00ffffff : ib_mthca
  1ff08000000-1ff0fffffff : 0000:81:00.0

# gdb ./mmap-test
(gdb) run
Starting program: /root/mmap-test
warning: linux_test_for_tracefork: unexpected result from waitpid (3298, status 0xb7f)

Program received signal SIGBUS, Bus error.
0x00010630 in main () at mmap-test.c:29
29              value= *( (unsigned*)(ptr + 0x000f0014) );
(gdb) print ptr
$1 = (void *) 0x7018c000
(gdb) print ptr + 0x000f0014
$2 = (void *) 0x7027c014
(gdb) x 0x7027c014
0x7027c014:     Cannot access memory at address 0x7027c014

# cat /proc/3317/maps
<snip>
7018c000-7028c000 rw-s 1ff00100000 00:0d 316                             /dev/mem

# uname -a
Linux tat 2.6.10 #14 SMP Mon Jan 3 12:30:51 PST 2005 sparc64 GNU/Linux

-tduffy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mmap-test.c
Type: text/x-csrc
Size: 659 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050113/a4b3e8a1/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050113/a4b3e8a1/attachment.sig>


More information about the general mailing list