Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jan 2014 22:09:09 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        vadiraj cs <abacusv81@gmail.com>
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: bus_alloc_resource() is degrading the system performance
Message-ID:  <EF28B015-73BB-4EC1-A847-52AC514C3F31@bsdimp.com>
In-Reply-To: <CAMxSDhs3cGW=E5-13jAy5RF2LDWbzBb2ENt5Wms=b2MwHwoibQ@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail


On Jan 21, 2014, at 9:30 PM, vadiraj cs wrote:

> 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.

Perhaps you are swapping?

> 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.

Having had a lot of experience, I'm pretty sure that you need to keep looking.

> 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.

I'd look to the resources that the nvram PCI card is using apart from those on the bus.

Warner

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EF28B015-73BB-4EC1-A847-52AC514C3F31>