Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Sep 2012 12:08:33 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Ian Lepore <freebsd@damnhippie.dyndns.org>
Cc:        freebsd-arm@freebsd.org, freebsd-mips@freebsd.org
Subject:   Re: busdma buffer management enhancements - call for review and test
Message-ID:  <2C9793BE-70B0-4A18-B5D2-FBA8C63A4552@bsdimp.com>
In-Reply-To: <1346781390.1140.641.camel@revolution.hippie.lan>
References:  <1346777897.1140.633.camel@revolution.hippie.lan> <CAP%2BM-_FMaLs1_gg4zoua52u=JPwLigBGp69Pwyf9OQKBzJ1vEQ@mail.gmail.com> <1346781390.1140.641.camel@revolution.hippie.lan>

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

On Sep 4, 2012, at 11:56 AM, Ian Lepore wrote:

> On Tue, 2012-09-04 at 12:40 -0500, Mark Tinguely wrote:
>> On Tue, Sep 4, 2012 at 11:58 AM, Ian Lepore
>> <freebsd@damnhippie.dyndns.org> wrote:
>> How about having a per processor cache line definition rather than =
using:
>>=20
>> +#define        MIN_ZONE_BUFSIZE        32
>>=20
>> For those archs that have a 64 byte cache line.
>>=20
>> I like the separation of the regular and BUS_DMA_COHERENT or
>> BUS_DMA_NOCACHE. I never liked turning the cache off the entire page
>> for a few DMA buffers.
>>=20
>> --Mark.
>=20
> The code in busdma_bufalloc.c (where that constant appears) knows
> nothing about architecture cache line sizes, that info has to be =
passed
> in to the create call as the minimum_alignment parameter.
>=20
> The point of that constant is to enforce internal limits in the
> implementation... if the caller passes in a minimum_alignment size =
less
> than 32, it will still use 32 as the smallest buffer size in the =
cache,
> purely because it only allocates enough slots in the array to handle
> log2(PAGE_SIZE) - log2(MIN_ZONE_BUFSIZE) + 1 zones, but you can't use
> log2() in a compile time constant expression, so things are a bit
> hand-tuned, and there's some code for sanity-enforcement.

kassert then, because we'll have this problem all over again.  Would be =
nice if we could make those arrays dynamically sized though...

Will read the rest of the patch later today...

Warner




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2C9793BE-70B0-4A18-B5D2-FBA8C63A4552>