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>
References:  <CAMxSDhs3cGW=E5-13jAy5RF2LDWbzBb2ENt5Wms=b2MwHwoibQ@mail.gmail.com>

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

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

> Hi All,
>=20
> 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.
>=20
> 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.
>=20
> Before module load---
> #dd if=3D/dev/zero of=3D/dev/md0 bs=3D4k count=3D10k
> 10240+0 records in
> 10240+0 records out
> 41943040 bytes transferred in 0.256835 secs (163307348 bytes/sec)
>=20
>=20
> After module load-----------
> # dd if=3D/dev/zero of=3D/dev/md0 bs=3D4k count=3D10k
> 10240+0 records in
> 10240+0 records out
> 41943040 bytes transferred in 5.162754 secs (8124160 bytes/sec)
>=20
>=20
> 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().
>=20
> reg_res =3D bus_alloc_resource(dev, SYS_RES_MEMORY, &reg_bar_id,
>                                     0UL, ~0UL, 512, RF_ACTIVE);
>=20
> 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=



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