[Top] [All Lists]

Re: [PATCH] MIPS: Alchemy: fix dbdma ring destruction memory deb

To: David Daney <>
Subject: Re: [PATCH] MIPS: Alchemy: fix dbdma ring destruction memory debugcheck.
From: Manuel Lauss <>
Date: Tue, 26 Jan 2010 18:58:42 +0100
Cc: Linux-MIPS <>, Manuel Lauss <>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=+9T+2Uz9knEkgelEuxTnRGCLYrbB9qa8+1kijWqPzqU=; b=X9AoqFOeZqz21yMYbzIlgA+K+Xjyb5N+dfDVOg1O6E4nRUCdZWHWMx6rKLSqUOl4es ztdOu4Erj7gd4xE3YrJSuHlWgR7pbqn7QPCPMQLIp5toWnYhqtMTqVVBMQDLR+G4voXC KpwZdqoCeYqCVQ2mPblPRe7aT0K8j5AiWbDoc=
Domainkey-signature: a=rsa-sha1; c=nofws;; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=DLxm7xgH9a7bTv1gM0zJY3Lw9b30wMPtDeVHlJ+KzrKosjA1L+8qs5IhUw9JNxQ6hn dfSRMn+thHlbZaBvWVMJAE9wLRFAXD/o/+603g7e+znLh8j+tZXLZHvDPRvSAODHYWRF H6M55iX7Z3ijV3XlkgIQSt89HJjJOmRI/ViWI=
In-reply-to: <>
References: <> <>
On Tue, Jan 26, 2010 at 6:44 PM, David Daney <> wrote:
> Manuel Lauss wrote:
>> DBDMA descriptors need to be located at 32-byte aligned addresses;
>> however kmalloc rarely delivers such addresses.  The dbdma code
>> works around that by allocating 63 bytes and re-aligning the
>> descriptor base afterwards.  Hoewever when freeing memory it does
>> not account for this adjustment and trips the kfree debugcheck:
> Correct me if I am wrong, but don't kmalloc et al. return blocks aligned
>  boundaries of the size rounded up the the next power of two?  So if you
> need 32-byte aligned addresses, just use a size value of 32 or greater.  You
> wouldn't have to add 63 and do masking and remember the membase value as you
> do in the patch.

The description is not completely correct (I suck a writing those):
It allocates a number
of descriptor entries (64 bytes each) specified by the driver in a single block:

        desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t),
        if (desc_base == 0)
                return 0;

        if (desc_base & 0x1f) {

So far the 3 users I have (mmc, spi, audio) always return true on the above
check (2 descriptors for audio for instance).


<Prev in Thread] Current Thread [Next in Thread>