bus_alloc_resource() is degrading the system performance

vadiraj cs abacusv81 at gmail.com
Wed Jan 22 04:30:29 UTC 2014


Hi All,

I'm writing a driver for a PCI device and allocating bus resource through
call bus_alloc_resource(). I see that doing this is making my system
performance go down.

Here is the dd output before loading my module and soon after loading my
module.
I'm running dd on a ramdisk before and after loading the module.

Before module load---
#dd if=/dev/zero of=/dev/md0 bs=4k count=10k
10240+0 records in
10240+0 records out
41943040 bytes transferred in 0.256835 secs (163307348 bytes/sec)


After module load-----------
# dd if=/dev/zero of=/dev/md0 bs=4k count=10k
10240+0 records in
10240+0 records out
41943040 bytes transferred in 5.162754 secs (8124160 bytes/sec)


Why dd? The device for which I'm writing a driver is a nvram pci card.
Hence this
will be storage device. The performance of this disk is way low. I
suspected the driver. But once the driver is loaded even the ramdisk starts
performing low.

After some debugging I realized that allocating bus resource is causing
this behavior. The size reserved varied from 512 bytes to 512K. There was
no change in the behavior. So resource size is not an issue.

Parameters passed to bus_alloc_resource().

reg_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &reg_bar_id,
                                     0UL, ~0UL, 512, RF_ACTIVE);

Any pointers to this will be of great help.

Thanks,


More information about the freebsd-drivers mailing list